UNPKG

2key-ratchet

Version:

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

39 lines (38 loc) 1.17 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 { ECPublicKey } from "../crypto"; import { IdentityProtocol } from "../protocol"; import { IJsonSerializable } from "../type"; export interface IJsonRemoteIdentity { id: number; /** * Thumbprint of signing key * * @type {string} * @memberOf IJsonRemoteIdentity */ thumbprint: string; signingKey: CryptoKey; exchangeKey: CryptoKey; signature: ArrayBuffer; createdAt: string; } export declare class RemoteIdentity implements IJsonSerializable { static fill(protocol: IdentityProtocol): RemoteIdentity; static fromJSON(obj: IJsonRemoteIdentity): Promise<RemoteIdentity>; id: number; signingKey: ECPublicKey; exchangeKey: ECPublicKey; signature: ArrayBuffer; createdAt: Date; fill(protocol: IdentityProtocol): void; verify(): PromiseLike<boolean>; toJSON(): Promise<IJsonRemoteIdentity>; fromJSON(obj: IJsonRemoteIdentity): Promise<void>; }