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

52 lines (51 loc) 2.19 kB
import { Decoder } from "./codec/tlsDecoder.js"; import { Encoder } from "./codec/tlsEncoder.js"; import { CiphersuiteImpl } from "./crypto/ciphersuite.js"; export declare const pskTypes: { readonly external: 1; readonly resumption: 2; }; export type PSKTypeName = keyof typeof pskTypes; export type PSKType = (typeof pskTypes)[PSKTypeName]; export declare const encodePskType: Encoder<PSKTypeName>; export declare const decodePskType: Decoder<PSKTypeName>; declare const resumptionPSKUsages: { readonly application: 1; readonly reinit: 2; readonly branch: 3; }; export type ResumptionPSKUsageName = keyof typeof resumptionPSKUsages; export type ResumptionPSKUsage = (typeof resumptionPSKUsages)[ResumptionPSKUsageName]; export declare const encodeResumptionPSKUsage: Encoder<ResumptionPSKUsageName>; export declare const decodeResumptionPSKUsage: Decoder<ResumptionPSKUsageName>; export interface PSKInfoExternal { psktype: "external"; pskId: Uint8Array; } export interface PSKInfoResumption { psktype: "resumption"; usage: ResumptionPSKUsageName; pskGroupId: Uint8Array; pskEpoch: bigint; } export type PSKInfo = PSKInfoExternal | PSKInfoResumption; export declare const encodePskInfo: Encoder<PSKInfo>; export declare const decodePskInfo: Decoder<PSKInfo>; type PSKNonce = { pskNonce: Uint8Array; }; export type PreSharedKeyID = PSKInfo & PSKNonce; export declare const encodePskId: Encoder<PreSharedKeyID>; export declare const decodePskId: Decoder<PreSharedKeyID>; type PSKLabel = { id: PreSharedKeyID; index: number; count: number; }; export declare const encodePskLabel: Encoder<PSKLabel>; export declare const decodePskLabel: Decoder<PSKLabel>; export type PreSharedKeyIdExternal = PSKInfoExternal & PSKNonce; export type PreSharedKeyIdResumption = PSKInfoResumption & PSKNonce; export declare function computePskSecret(psks: [PreSharedKeyID, Uint8Array][], impl: CiphersuiteImpl): Promise<Uint8Array<ArrayBufferLike>>; export declare function updatePskSecret(secret: Uint8Array, pskId: PreSharedKeyID, psk: Uint8Array, index: number, count: number, impl: CiphersuiteImpl): Promise<Uint8Array<ArrayBufferLike>>; export {};