Skip to content

decryptWith

decryptWith(encoded, unwrapper): Promise<Uint8Array<ArrayBufferLike>>

Defined in: packages/filecoin-encryption-envelope/src/aes-gcm.ts:182

Authenticate and decrypt a complete scheme-1 FEE object, recovering its CEK from a recipient via unwrapper.

Accepts only COSE_Encrypt (tag 96); a tag-16 envelope carries no recipients and fails with NoUsableRecipientError without calling unwrapper. Borrows encoded: callers must not modify it until the returned promise settles. Each recipient is copied into an isolated RecipientInfo before reaching unwrapper, so the caller’s encoded bytes are unaffected by anything the unwrapper does to what it receives. unwrapper is called at most once, with every recipient in wire order; its resolved CEK is validated as an exactly 32-byte, non-zero key before use.

ParameterType
encodedUint8Array
unwrapperUnwrapper

Promise<Uint8Array<ArrayBufferLike>>