Skip to content

KeyResolver

KeyResolver = (info, signal) => Promise<Uint8Array> | Uint8Array

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

Derives or fetches the CEK for a chunked object, given its EnvelopeInfo and an AbortSignal.

Called at most once, after the envelope decodes and before any ciphertext is decrypted. signal aborts if the stream is cancelled, aborted (including via options.signal), or fails, and stays un-aborted on successful completion.

Ownership: 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 import and FEE skips validation and import) — and should zero it once the stream settles.

Parameter Type
info EnvelopeInfo
signal AbortSignal

Promise<Uint8Array> | Uint8Array