makeKeyResolver
@rotorsoft/act-root / act-crypto/src / makeKeyResolver
Function: makeKeyResolver()
makeKeyResolver(
encryption): () =>Promise<Buffer<ArrayBufferLike>>
Defined in: libs/act-crypto/src/envelope.ts:91
Wrap an Encryption config into a memoized key resolver.
The returned function calls encryption.keyProvider on first use,
validates the result is a 32-byte Buffer, and caches it for the
resolver's lifetime. Subsequent calls hit the cache without
re-invoking the provider โ important when the provider is a KMS
round-trip.
Operators who need key rotation construct a new adapter (which makes a new resolver) rather than mutating the in-flight one. The resolver's lifecycle matches the adapter's, not the application's.
Parametersโ
encryptionโ
Returnsโ
() => Promise<Buffer<ArrayBufferLike>>
Throwsโ
Error if keyProvider returns anything other than a
32-byte Buffer.