Skip to content

Commit

Permalink
optional predecessor
Browse files Browse the repository at this point in the history
  • Loading branch information
ppca committed Jul 18, 2024
1 parent 8f6fa1a commit 852297e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions chain-signatures/contract/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,10 @@ impl VersionedMpcContract {
}
}

/// This is the derived public key of the caller given path
pub fn derived_public_key(&self, path: String) -> PublicKey {
let predecessor = env::predecessor_account_id();
/// This is the derived public key of the caller given path and predecessor
/// if predecessor is not provided, it will be the caller of the contract
pub fn derived_public_key(&self, path: String, predecessor: Option<AccountId>) -> PublicKey {
let predecessor = predecessor.unwrap_or_else(env::predecessor_account_id);
let epsilon = derive_epsilon(&predecessor, &path);
let derived_public_key =
derive_key(near_public_key_to_affine_point(self.public_key()), epsilon);
Expand Down

0 comments on commit 852297e

Please sign in to comment.