Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions integration_test/tests/signer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// SPDX-License-Identifier: CC0-1.0

//! Tests for methods found under the `== Signer ==` section of the API docs.

#![allow(non_snake_case)] // Test names intentionally use double underscore.
#![allow(unused_imports)] // Because of feature gated tests.

use integration_test::{Node, NodeExt as _, Wallet};
use node::{mtype, Input, Output};
use node::vtype::*; // All the version specific types.

#[test]
#[cfg(not(feature = "v21_and_below"))]
fn signer__enumerate_signers() {
let script_path = integration_test::random_tmp_file();
let script_body = "#!/bin/sh\necho '[{\"fingerprint\":\"deadbeef\",\"name\":\"TestSigner\"}]'\n";
std::fs::write(&script_path, script_body).expect("write signer script");

#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
std::fs::set_permissions(&script_path, std::fs::Permissions::from_mode(0o755))
.expect("chmod");
}

let signer_arg = format!("-signer={}", script_path.to_str().unwrap());
let node = Node::with_wallet(Wallet::None, &[&signer_arg]);
let json: EnumerateSigners = node.client.enumerate_signers().expect("enumeratesigners");

assert_eq!(json.signers[0].fingerprint, "deadbeef");
}
2 changes: 1 addition & 1 deletion types/src/v22/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
//!
//! | JSON-RPC Method Name | Returns | Notes |
//! |:-----------------------------------|:---------------:|:--------------------------------------:|
//! | enumeratesigners | version | UNTESTED |
//! | enumeratesigners | version | |
//!
//! </details>
//!
Expand Down
10 changes: 6 additions & 4 deletions types/src/v22/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ use serde::{Deserialize, Serialize};
/// > Returns a list of external signers from -signer.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct EnumerateSigners(pub Vec<Signers>);
pub struct EnumerateSigners {
/// List of external signers.
pub signers: Vec<Signers>,
}

/// An item from the list returned by the JSON-RPC method `enumeratesigners`
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Signers {
/// Master key fingerprint.
pub hex: String,
pub fingerprint: String,
/// Device name.
#[serde(rename = "str")]
pub device_name: String,
pub name: String,
}
2 changes: 1 addition & 1 deletion types/src/v23/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
//!
//! | JSON-RPC Method Name | Returns | Notes |
//! |:-----------------------------------|:---------------:|:--------------------------------------:|
//! | enumeratesigners | version | UNTESTED |
//! | enumeratesigners | version | |
//!
//! </details>
//!
Expand Down
2 changes: 1 addition & 1 deletion types/src/v24/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
//!
//! | JSON-RPC Method Name | Returns | Notes |
//! |:-----------------------------------|:---------------:|:--------------------------------------:|
//! | enumeratesigners | version | UNTESTED |
//! | enumeratesigners | version | |
//!
//! </details>
//!
Expand Down
2 changes: 1 addition & 1 deletion types/src/v25/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
//!
//! | JSON-RPC Method Name | Returns | Notes |
//! |:-----------------------------------|:---------------:|:--------------------------------------:|
//! | enumeratesigners | version | UNTESTED |
//! | enumeratesigners | version | |
//!
//! </details>
//!
Expand Down
2 changes: 1 addition & 1 deletion types/src/v26/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
//!
//! | JSON-RPC Method Name | Returns | Notes |
//! |:-----------------------------------|:---------------:|:--------------------------------------:|
//! | enumeratesigners | version | UNTESTED |
//! | enumeratesigners | version | |
//!
//! </details>
//!
Expand Down
2 changes: 1 addition & 1 deletion types/src/v27/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
//!
//! | JSON-RPC Method Name | Returns | Notes |
//! |:-----------------------------------|:---------------:|:--------------------------------------:|
//! | enumeratesigners | version | UNTESTED |
//! | enumeratesigners | version | |
//!
//! </details>
//!
Expand Down
2 changes: 1 addition & 1 deletion types/src/v28/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
//!
//! | JSON-RPC Method Name | Returns | Notes |
//! |:-----------------------------------|:---------------:|:--------------------------------------:|
//! | enumeratesigners | version | UNTESTED |
//! | enumeratesigners | version | |
//!
//! </details>
//!
Expand Down
2 changes: 1 addition & 1 deletion types/src/v29/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
//!
//! | JSON-RPC Method Name | Returns | Notes |
//! |:-----------------------------------|:---------------:|:--------------------------------------:|
//! | enumeratesigners | version | UNTESTED |
//! | enumeratesigners | version | |
//!
//! </details>
//!
Expand Down