Skip to content

decryptWith

decryptWith(unwrapper, options?): ReadableWritablePair<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>

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

Decrypt a scheme-2 object using a CEK recovered by unwrapper.

For tag 96, the unwrapper is called once with isolated copies of all recipients in wire order and an AbortSignal that aborts if the stream is cancelled, aborted (including via options.signal), or fails (but not on successful EOF). A tag-16 object has no recipients and fails without calling it. The returned CEK is validated before any chunk is decrypted. When options.signal aborts, both sides of the returned pair error with the exact signal.reason, pending writes are unblocked, and any late key result is discarded without importing it. As with decrypt, discard plaintext already read if the stream fails.

Parameter Type
unwrapper Unwrapper
options? DecryptOptions

ReadableWritablePair<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>