fixed test
This commit is contained in:
16
src/age.rs
16
src/age.rs
@@ -378,18 +378,24 @@ pub async fn cmd_age_keygen(server: &Server, name: &str) -> Protocol {
|
||||
// Derive X25519 raw (32-byte) keys and encode as base64
|
||||
let (xpub_b64, xsec_b64) = derive_x25519_raw_b64_from_ed25519(&signing_key);
|
||||
|
||||
// Decode to create age-formatted strings
|
||||
let xpub_bytes = B64.decode(&xpub_b64).unwrap();
|
||||
let xsec_bytes = B64.decode(&xsec_b64).unwrap();
|
||||
let xpub_arr: [u8; 32] = xpub_bytes.as_slice().try_into().unwrap();
|
||||
let xsec_arr: [u8; 32] = xsec_bytes.as_slice().try_into().unwrap();
|
||||
let recip_str = format!("age1{}", B64.encode(xpub_arr));
|
||||
let ident_str = format!("AGE-SECRET-KEY-1{}", B64.encode(xsec_arr));
|
||||
|
||||
// Persist Ed25519 and derived X25519 (key-managed mode)
|
||||
if let Err(e) = sset(server, &sign_pub_key_key(name), &verify_b64) { return e.to_protocol(); }
|
||||
if let Err(e) = sset(server, &sign_priv_key_key(name), &sign_b64) { return e.to_protocol(); }
|
||||
if let Err(e) = sset(server, &enc_pub_key_key(name), &xpub_b64) { return e.to_protocol(); }
|
||||
if let Err(e) = sset(server, &enc_priv_key_key(name), &xsec_b64) { return e.to_protocol(); }
|
||||
|
||||
// Return unified 4-tuple
|
||||
// Return [recipient, identity] in age format
|
||||
Protocol::Array(vec![
|
||||
Protocol::BulkString(verify_b64),
|
||||
Protocol::BulkString(sign_b64),
|
||||
Protocol::BulkString(xpub_b64),
|
||||
Protocol::BulkString(xsec_b64),
|
||||
Protocol::BulkString(recip_str),
|
||||
Protocol::BulkString(ident_str),
|
||||
])
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user