diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-06-25 09:06:47 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-06-25 09:06:47 +0100 |
| commit | b63bfc9a34657c5767c507deb7c059e24dd22779 (patch) | |
| tree | 462be1e29e6f21c5e0d75458e4966f574389451c /test_utils/src | |
| parent | 20d201740f0ace8437cf595476a52f9e42407724 (diff) | |
refactor: replace keys with signer
so that nip46 bunker signing can be added
Diffstat (limited to 'test_utils/src')
| -rw-r--r-- | test_utils/src/lib.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs index bf6c37b..ade60fc 100644 --- a/test_utils/src/lib.rs +++ b/test_utils/src/lib.rs | |||
| @@ -4,7 +4,7 @@ use anyhow::{bail, ensure, Context, Result}; | |||
| 4 | use dialoguer::theme::{ColorfulTheme, Theme}; | 4 | use dialoguer::theme::{ColorfulTheme, Theme}; |
| 5 | use directories::ProjectDirs; | 5 | use directories::ProjectDirs; |
| 6 | use nostr::{self, nips::nip65::RelayMetadata, Kind, Tag}; | 6 | use nostr::{self, nips::nip65::RelayMetadata, Kind, Tag}; |
| 7 | use nostr_sdk::{serde_json, TagStandard}; | 7 | use nostr_sdk::{serde_json, NostrSigner, TagStandard}; |
| 8 | use once_cell::sync::Lazy; | 8 | use once_cell::sync::Lazy; |
| 9 | use rexpect::session::{Options, PtySession}; | 9 | use rexpect::session::{Options, PtySession}; |
| 10 | use strip_ansi_escapes::strip_str; | 10 | use strip_ansi_escapes::strip_str; |
| @@ -29,6 +29,13 @@ pub static TEST_KEY_1_ENCRYPTED_WEAK: &str = "ncryptsec1qg835almhlrmyxqtqeva44d5 | |||
| 29 | pub static TEST_KEY_1_KEYS: Lazy<nostr::Keys> = | 29 | pub static TEST_KEY_1_KEYS: Lazy<nostr::Keys> = |
| 30 | Lazy::new(|| nostr::Keys::from_str(TEST_KEY_1_NSEC).unwrap()); | 30 | Lazy::new(|| nostr::Keys::from_str(TEST_KEY_1_NSEC).unwrap()); |
| 31 | 31 | ||
| 32 | pub static TEST_KEY_1_SIGNER: Lazy<NostrSigner> = | ||
| 33 | Lazy::new(|| NostrSigner::Keys(nostr::Keys::from_str(TEST_KEY_1_NSEC).unwrap())); | ||
| 34 | |||
| 35 | pub fn generate_test_key_1_signer() -> NostrSigner { | ||
| 36 | NostrSigner::Keys(nostr::Keys::from_str(TEST_KEY_1_NSEC).unwrap()) | ||
| 37 | } | ||
| 38 | |||
| 32 | pub fn generate_test_key_1_metadata_event(name: &str) -> nostr::Event { | 39 | pub fn generate_test_key_1_metadata_event(name: &str) -> nostr::Event { |
| 33 | nostr::event::EventBuilder::metadata(&nostr::Metadata::new().name(name)) | 40 | nostr::event::EventBuilder::metadata(&nostr::Metadata::new().name(name)) |
| 34 | .to_event(&TEST_KEY_1_KEYS) | 41 | .to_event(&TEST_KEY_1_KEYS) |