Skip to content

Unwrapper

Unwrapper = (recipients, signal?) => Promise<Uint8Array | undefined>

Defined in: packages/filecoin-encryption-envelope/src/recipients/types.ts:61

Recover a CEK from an ordered, structurally validated recipient list.

Return undefined when none of the recipients can be handled. Throwing aborts key recovery; decryptWith, decryptRangeWith, and aesGcm.decryptWith report it as RecipientUnwrapError with the original error as its cause, unless signal aborted.

Ownership: for a custom unwrapper, FEE borrows the returned key bytes only long enough to import them into a non-extractable CryptoKey and never zeroes or mutates the caller’s buffer. The caller owns every key it returns, including one FEE discards after cancellation (when signal?.aborted becomes true before recovery settles and FEE skips validation and import), and should zero it once the operation settles. When the built-in unwrapper from createA256KWUnwrapper is passed directly, FEE zeroes its own temporary unwrapped buffer after import or on abort/failure.

Parameter Type
recipients readonly RecipientInfo[]
signal? AbortSignal

Promise<Uint8Array | undefined>