ts-mls
Version:
[](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml) [](https://badge.fury.io/js/ts-mls) [ • 2.18 kB
TypeScript
import { AeadAlgorithm } from "./aead.js";
import { KdfAlgorithm } from "./kdf.js";
import { KemAlgorithm } from "./kem.js";
export type PublicKey = CryptoKey & {
type: "public";
};
export type SecretKey = CryptoKey & {
type: "secret";
};
export type PrivateKey = CryptoKey & {
type: "private";
};
export interface HpkeAlgorithm {
kem: KemAlgorithm;
kdf: KdfAlgorithm;
aead: AeadAlgorithm;
}
export declare function encryptWithLabel(publicKey: PublicKey, label: string, context: Uint8Array, plaintext: Uint8Array, hpke: Hpke): Promise<{
ct: Uint8Array;
enc: Uint8Array;
}>;
export declare function decryptWithLabel(privateKey: PrivateKey, label: string, context: Uint8Array, kemOutput: Uint8Array, ciphertext: Uint8Array, hpke: Hpke): Promise<Uint8Array>;
export interface Hpke {
open(privateKey: PrivateKey, kemOutput: Uint8Array, ciphertext: Uint8Array, info: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
seal(publicKey: PublicKey, plaintext: Uint8Array, info: Uint8Array, aad?: Uint8Array): Promise<{
ct: Uint8Array;
enc: Uint8Array;
}>;
importPrivateKey(k: Uint8Array): Promise<PrivateKey>;
importPublicKey(k: Uint8Array): Promise<PublicKey>;
exportPublicKey(k: PublicKey): Promise<Uint8Array>;
exportPrivateKey(k: PrivateKey): Promise<Uint8Array>;
encryptAead(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array | undefined, plaintext: Uint8Array): Promise<Uint8Array>;
decryptAead(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array | undefined, ciphertext: Uint8Array): Promise<Uint8Array>;
exportSecret(publicKey: PublicKey, exporterContext: Uint8Array, length: number, info: Uint8Array): Promise<{
enc: Uint8Array;
secret: Uint8Array;
}>;
importSecret(privateKey: PrivateKey, exporterContext: Uint8Array, kemOutput: Uint8Array, length: number, info: Uint8Array): Promise<Uint8Array>;
deriveKeyPair(ikm: Uint8Array): Promise<{
privateKey: PrivateKey;
publicKey: PublicKey;
}>;
generateKeyPair(): Promise<{
privateKey: PrivateKey;
publicKey: PublicKey;
}>;
keyLength: number;
nonceLength: number;
}