···
fn display_key(pubkey: &[u8], index: u32) -> bool {
use alloc::string::ToString;
···
"Verify Atproto DID key",
-
value: index.to_string(),
···
return Err("Derivation path is too long");
-
let hd_node = sdk::curve::Secp256k1::derive_hd_node(&[index])?;
let privkey: EcfpPrivateKey<Secp256k1, 32> = EcfpPrivateKey::new(*hd_node.privkey);
let pubkey = privkey.to_public_key();
let uncompressed_pubkey = pubkey.as_ref().to_bytes();
···
+
const HARDENED_PATH: u32 = '🦋' as u32 | (1 << 31);
fn display_key(pubkey: &[u8], index: u32) -> bool {
use alloc::string::ToString;
···
"Verify Atproto DID key",
+
tag: "Key index".into(),
+
value: index.to_string(),
+
value: alloc::format!("m/{}'/{}", '🦋' as u32, index),
···
return Err("Derivation path is too long");
+
let hd_node = sdk::curve::Secp256k1::derive_hd_node(&[HARDENED_PATH, index])?;
let privkey: EcfpPrivateKey<Secp256k1, 32> = EcfpPrivateKey::new(*hd_node.privkey);
let pubkey = privkey.to_public_key();
let uncompressed_pubkey = pubkey.as_ref().to_bytes();