@hpke/ohttp
Version:
Oblivious HTTP (RFC 9458) client and server using HPKE
16 lines (15 loc) • 654 B
JavaScript
/**
* Returns a KDF to be used by a single HPKE cipher suite.
*
* `CipherSuite` initializes the KDF it is given with its `suite_id`, which
* the KDF keeps as mutable state. A KDF instance shared by multiple cipher
* suites (e.g. the same `HkdfSha256` paired with different AEADs) would
* therefore end up with the `suite_id` of the suite created last.
*
* The returned object inherits everything from `kdf` through its prototype
* chain, while state assigned afterwards (such as the `suite_id`) is stored
* on the returned object itself. The given instance is never modified.
*/
export function bindKdf(kdf) {
return Object.create(kdf);
}