UNPKG

ts-mls

Version:

[![CI](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml/badge.svg)](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml) [![npm version](https://badge.fury.io/js/ts-mls.svg)](https://badge.fury.io/js/ts-mls) [![Coverage Status](https://co

9 lines 667 B
import { encodeVarLenData } from "../codec/variableLength.js"; import { concatUint8Arrays } from "../util/byteArray.js"; export function encryptWithLabel(publicKey, label, context, plaintext, hpke) { return hpke.seal(publicKey, plaintext, concatUint8Arrays(encodeVarLenData(new TextEncoder().encode(`MLS 1.0 ${label}`)), encodeVarLenData(context)), new Uint8Array()); } export function decryptWithLabel(privateKey, label, context, kemOutput, ciphertext, hpke) { return hpke.open(privateKey, kemOutput, ciphertext, concatUint8Arrays(encodeVarLenData(new TextEncoder().encode(`MLS 1.0 ${label}`)), encodeVarLenData(context))); } //# sourceMappingURL=hpke.js.map