open<T> function
T
open<T>({})
Decrypts and verifies a sealed message.
Uses the current system time for drift checking.
msgToOpen: The serialized COSE_Encrypt0 structuremsgToAuth: The same additional authenticated data used during sealingrecipient: The xHPKE secret key to decrypt withsender: The xDSA public key to verify the signature againstdomain: Application domain for HPKE key derivationmaxDriftSecs: Signatures more in the past or future are rejected
Returns the CBOR-decoded payload if decryption and verification succeed.
Implementation
T open<T>({
required Uint8List msgToOpen,
required Object? msgToAuth,
required xhpke.SecretKey recipient,
required xdsa.PublicKey sender,
required Uint8List domain,
int? maxDriftSecs,
}) =>
_decode(
ffi.coseOpen(
msgToOpen: msgToOpen,
msgToAuth: _encode(msgToAuth),
recipient: recipient.inner,
sender: sender.inner,
domain: domain,
maxDriftSecs: maxDriftSecs != null
? BigInt.from(maxDriftSecs)
: null,
),
)
as T;