UNPKG

e2ee-ts

Version:

A module that provides RSA & AES encryption interfaces

39 lines 1.22 kB
/// <reference types="node" /> /// <reference types="node" /> import { webcrypto } from "crypto"; import { BufferSource } from "stream/web"; export declare class RSAClient { private _privateKey; private _clientPublicKey; publicKey: webcrypto.CryptoKey | undefined; constructor(); /** * Initializes the RSA key pair - public & private */ init(): Promise<void>; /** * Exports this object's public key so that the client can * encrypt their data using this person's public key */ exportPublicKey(): Promise<ArrayBuffer>; /** * Loads the ArrayBuffer representing the client's public key * to this object */ importClientPublic(clientPublicBuffer: ArrayBuffer): Promise<void>; /** * Encrypts BufferSource using the client's public key */ encrypt(data: BufferSource): Promise<ArrayBuffer>; /** * Decrypts ArrayBuffer using the private key */ decrypt(data: ArrayBuffer): Promise<ArrayBuffer>; arrayBufferToString(buffer: ArrayBuffer): string; private formatAsPem; /** * Returns human readable PEM */ spkiToPEM(keydata: ArrayBuffer): string; } //# sourceMappingURL=RSAClient.d.ts.map