Skip to main content

approval_message

Function approval_message 

Source
pub fn approval_message<T: Serialize>(
    canister: Principal,
    account_id: &AccountId,
    domain: &str,
    command: &T,
    approval: &Approval,
) -> Hash
Expand description

Build the digest signed by a device to authorize an operation.

Uses dmsg/device-approval/v2 and binds the target user canister, account, operation domain, device, epoch, sequence, request ID, deadline, and digest(domain, command). The approval’s signature field is excluded. For attestations use crate::ATTEST_APPROVAL_DOMAIN and crate::attest_approval_command; for root derivations use crate::DERIVE_APPROVAL_DOMAIN and crate::derive_approval_command. For account mutations use domain dmsg/account/v2 and the command tuple (expected_version, AccountCommand).

This constructs bytes only; it neither verifies the signature nor consumes sequences or checks expiry. Sign the returned digest bytes with the device key.

§Panics

Panics if command serialization fails.