UNPKG

2key-ratchet

Version:

2key-ratchet is an implementation of a Double Ratchet protocol and X3DH in TypeScript utilizing WebCrypto.

87 lines (86 loc) 1.86 kB
/** * * 2key-ratchet * Copyright (c) 2016 Peculiar Ventures, Inc * Based on https://whispersystems.org/docs/specifications/doubleratchet/ and * https://whispersystems.org/docs/specifications/x3dh/ by Open Whisper Systems * */ import { ECKeyType } from "../type"; /** * Implementation of EC public key * * @export * @class ECPublicKey */ export declare class ECPublicKey { /** * Creates new instance of ECPublicKey from CryptoKey * * @static * @param {CryptoKey} publicKey * @returns * * @memberOf ECPublicKey */ static create(publicKey: CryptoKey): Promise<ECPublicKey>; /** * Creates ECPublicKey from raw data * * @static * @param {ArrayBuffer} bytes * @param {ECKeyType} type type of EC key. ECDSA | ECDH * @returns * * @memberOf ECPublicKey */ static importKey(bytes: ArrayBuffer, type: ECKeyType): Promise<ECPublicKey>; /** * Identity of ECPublicKey * HEX string of thumbprint of EC key * * @type {string} * @memberOf ECPublicKey */ id: string; /** * Crypto key * * @type {CryptoKey} * @memberOf ECPublicKey */ key: CryptoKey; /** * raw data of key * * @protected * @type {ArrayBuffer} * @memberOf ECPublicKey */ protected serialized: ArrayBuffer; /** * Returns key in raw format * * @returns * * @memberOf ECPublicKey */ serialize(): ArrayBuffer; /** * Returns SHA-256 digest of key * * @returns * * @memberOf ECPublicKey */ thumbprint(): Promise<string>; /** * Returns `true` if current is equal to given parameter * * @param {*} other * @returns * * @memberOf ECPublicKey */ isEqual(other: any): Promise<boolean>; }