UNPKG

2key-ratchet

Version:

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

32 lines (31 loc) 1.1 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 { IECKeyPair } from "../crypto"; import { IJsonSerializable } from "../type"; export interface IJsonIdentity { id: number; signingKey: CryptoKeyPair; exchangeKey: CryptoKeyPair; preKeys: CryptoKeyPair[]; signedPreKeys: CryptoKeyPair[]; createdAt: string; } export declare class Identity implements IJsonSerializable { static fromJSON(obj: IJsonIdentity): Promise<Identity>; static create(id: number, signedPreKeyAmount?: number, preKeyAmount?: number, extractable?: boolean): Promise<Identity>; id: number; signingKey: IECKeyPair; exchangeKey: IECKeyPair; createdAt: Date; preKeys: IECKeyPair[]; signedPreKeys: IECKeyPair[]; protected constructor(id: number, signingKey: IECKeyPair, exchangeKey: IECKeyPair); toJSON(): Promise<IJsonIdentity>; fromJSON(obj: IJsonIdentity): Promise<void>; }