Function pallet_msa::pallet::dispatchables::add_public_key_to_msa
source · pub fn add_public_key_to_msa<T: Config>(
msa_owner_public_key: T::AccountId,
msa_owner_proof: MultiSignature,
new_key_owner_proof: MultiSignature,
add_key_payload: AddKeyData<T>
)
Expand description
Adds a new public key to an existing Message Source Account (MSA). This functionality enables the MSA owner to manage multiple keys for their account or rotate keys for enhanced security.
The origin
parameter represents the account from which the function is called and can be either the MSA owner’s account or a delegated provider’s account,
depending on the intended use.
The function requires two signatures: msa_owner_proof
and new_key_owner_proof
, which serve as proofs of ownership for the existing MSA
and the new public key account, respectively. This ensures that a new key cannot be added without permission of both the MSA owner and the owner of the new key.
The necessary information for the key addition, the new public key and the MSA ID, is contained in the add_key_payload
parameter of type AddKeyData.
It also contains an expiration block number for both proofs, ensuring they are valid and must be greater than the current block.
Events
Errors
Error::MsaOwnershipInvalidSignature
-key
is not a valid signer of the providedadd_key_payload
.Error::NewKeyOwnershipInvalidSignature
-key
is not a valid signer of the providedadd_key_payload
.Error::NoKeyExists
- the MSA id for the account inadd_key_payload
does not exist.Error::NotMsaOwner
- Origin’s MSA is not the same as ’add_key_payload` MSA. Essentially you can only add a key to your own MSA.Error::ProofHasExpired
- the current block is less than theexpired
block number set inAddKeyData
.Error::ProofNotYetValid
- theexpired
block number set inAddKeyData
is greater than the current block number plus mortality_block_limit().Error::SignatureAlreadySubmitted
- signature has already been used.
Warning: Doc-Only
This function is an automatically generated, and is doc-only, uncallable
stub. See the real version in
Pallet::add_public_key_to_msa
.