mirror of
https://github.com/aljazceru/cdk.git
synced 2026-02-19 12:05:38 +01:00
feat(cdk-cli): support nostr nsec secret keys
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
- cdk(NUT-11): Add `Copy` on `SigFlag` ([thesimplekid]).
|
||||
- cdk(wallet): Add `fn send_proofs` that marks proofs as `reserved` and creates token ([thesimplekid]).
|
||||
- cdk(wallet): Add `fn melt_proofs` that uses specific proofs for `melt` instead of selecting ([thesimplekid]).
|
||||
- cdk-cli(receive): Add support for signing keys to be nostr nsec encoded ([thesimplekid]).
|
||||
|
||||
### Fixed
|
||||
- cdk(mint): `SIG_ALL` is not allowed in `melt` ([thesimplekid]).
|
||||
|
||||
@@ -46,7 +46,15 @@ pub async fn receive(
|
||||
let mut s_keys: Vec<SecretKey> = sub_command_args
|
||||
.signing_key
|
||||
.iter()
|
||||
.map(|s| SecretKey::from_str(s).unwrap())
|
||||
.flat_map(|s| {
|
||||
if s.starts_with("nsec") {
|
||||
let nostr_key = nostr_sdk::SecretKey::from_str(s).expect("Invalid secret key");
|
||||
|
||||
SecretKey::from_str(&nostr_key.to_secret_hex())
|
||||
} else {
|
||||
SecretKey::from_str(s)
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
signing_keys.append(&mut s_keys);
|
||||
}
|
||||
@@ -67,7 +75,8 @@ pub async fn receive(
|
||||
//wallet.add_p2pk_signing_key(nostr_signing_key).await;
|
||||
let nostr_key = match sub_command_args.nostr_key.as_ref() {
|
||||
Some(nostr_key) => {
|
||||
let secret_key = SecretKey::from_str(nostr_key)?;
|
||||
let secret_key = nostr_sdk::SecretKey::from_str(nostr_key)?;
|
||||
let secret_key = SecretKey::from_str(&secret_key.to_secret_hex())?;
|
||||
Some(secret_key)
|
||||
}
|
||||
None => None,
|
||||
|
||||
Reference in New Issue
Block a user