1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! The gate directory's `app_keys` entry.
//!
//! The controller's `gate.sock` directory answer carries
//! `"app_keys":[{"pk":hex,"owner":hex}]`: the enabled application keys and
//! their `active` owners. Absent means empty, and every change to the list
//! is a new directory revision. Keys are written as 64 lower-case hex
//! digits, not as `did:nostr:` text. The gate keeps its own tolerant parser;
//! this is the published shape.
use ;
use crateDidNostr;
/// One listed application key: an enabled key and its active owner.
///
/// # Examples
///
/// ```
/// use stratum_node_core::{DidNostr, DirectoryAppKey};
///
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// let pk = DidNostr::from_hex(&"c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5")?;
/// let owner = DidNostr::from_hex(&"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")?;
/// let entry = DirectoryAppKey { pk, owner };
/// let text = serde_json::to_string(&entry)?;
/// assert_eq!(text, format!(r#"{{"pk":"{}","owner":"{}"}}"#, pk.to_hex(), owner.to_hex()));
/// assert_eq!(serde_json::from_str::<DirectoryAppKey>(&text)?, entry);
/// # Ok(())
/// # }
/// ```
/// Serde for a key as 64 lower-case hex digits, for the wire members the
/// contract types `hex`.
pub