@hpke/ohttp
Version:
Oblivious HTTP (RFC 9458) client and server using HPKE
37 lines • 1.13 kB
TypeScript
/** A KDF/AEAD pair advertised in a KeyConfig. */
export interface OhttpCipherSuite {
kdf: number;
aead: number;
}
/** Parsed public key configuration for OHTTP (RFC 9458 Section 3). */
export interface OhttpKeyConfig {
keyId: number;
kem: number;
publicKey: Uint8Array;
cipherSuites: OhttpCipherSuite[];
}
/**
* Deserialize an `application/ohttp-keys` payload into key configurations.
*
* The wire format is a sequence of length-prefixed KeyConfig entries:
*
* KeyConfig {
* Key Identifier (8),
* KEM ID (16),
* Public Key (Npk bytes, determined by KEM),
* Cipher Suites Length (16),
* Cipher Suites (variable) {
* KDF ID (16),
* AEAD ID (16),
* } ...
* }
*
* Each KeyConfig is prefixed with its 2-byte length.
*/
export declare function deserializeKeyConfig(data: Uint8Array): OhttpKeyConfig[];
/**
* Serialize a single key configuration to `application/ohttp-keys` format.
* The result is a length-prefixed KeyConfig entry.
*/
export declare function serializeKeyConfig(config: OhttpKeyConfig): Uint8Array;
//# sourceMappingURL=keyConfig.d.ts.map