UNPKG

@twilio/plugin-microvisor

Version:

Interact with your Twilio Microvisor devices

50 lines (49 loc) 1.53 kB
/// <reference types="node" /> /// <reference types="node" /> import * as crypto from 'node:crypto'; export declare class UnsuitablePrivateKeyError extends Error { constructor(message: string); } /** Type-checked wrapper on createPrivateKey. */ export declare class EcdhPrivateKey { key: crypto.KeyObject; constructor(pemEncoded: Buffer); exchange(publicKey: Buffer): { secret: Buffer; publicKey: Buffer; }; } declare class AesGcm128Encrypter { key: Buffer; nonce: Buffer; seq: Uint8Array; constructor(key: Buffer, nonce: Buffer); encrypt(plaintext: Buffer): Buffer; } declare class AesGcm128Decrypter { key: Buffer; nonce: Buffer; seq: Uint8Array; constructor(key: Buffer, nonce: Buffer); decrypt(ciphertext: Buffer): Buffer; } declare class HpkeContext { encap: Buffer; sender: AesGcm128Encrypter; receiver: AesGcm128Decrypter; constructor(encap: Buffer, sender: AesGcm128Encrypter, receiver: AesGcm128Decrypter); static setupAuthS(pkR: Buffer, info: Buffer, skS: EcdhPrivateKey): HpkeContext; static setupBaseS(pkR: Buffer, info: Buffer): HpkeContext; } export declare class Session { context: HpkeContext; constructor(peerPublicKey: Buffer, ourPrivateKey: EcdhPrivateKey); encap(): Buffer; encryptMessage(message: Buffer): Buffer; decryptMessage(ciphertext: Buffer): Buffer; } export declare function BaseSeal(publicKey: Buffer, message: Buffer): { encap: Buffer; ciphertext: Buffer; }; export {};