Hey everyone, i was going through ecdsa publick key generation api and i found these types
#[derive(CandidType, Serialize, Debug)]
struct ECDSAPublicKey {
pub canister_id: Option<CanisterId>,
pub derivation_path: Vec<Vec<u8>>,
pub key_id: EcdsaKeyId,
}
#[derive(CandidType, Deserialize, Debug)]
struct ECDSAPublicKeyReply {
pub public_key: Vec<u8>,
pub chain_code: Vec<u8>,
}
can someone explain more about derivation_path and chain_code?
The derivation path is a way for a canister to have multiple keys. If you want a different key per user of your canister you can e.g. use the user’s principal as a derivation path. Think of it like this: Your canister has an infinite amount of keys it can use, and the derivation path is the identifier of the key you want to use
chain code is explained in the spec:
The return result is an extended public key consisting of an ECDSA public_key
, encoded in SEC1 compressed form, and a chain_code
, which can be used to deterministically derive child keys of the public_key
.
1 Like