UNPKG

@signalapp/mock-server

Version:
68 lines (67 loc) 2.57 kB
/// <reference types="node" /> import { ProtocolAddress, PublicKey } from '@signalapp/libsignal-client'; import { BackupLevel, ProfileKeyCommitment } from '@signalapp/libsignal-client/zkgroup'; import { AciString, DeviceId, KyberPreKey, PniString, PreKey, RegistrationId, ServiceIdKind, ServiceIdString, SignedPreKey } from '../types'; export type DeviceOptions = Readonly<{ aci: AciString; pni: PniString; number: string; deviceId: DeviceId; registrationId: RegistrationId; pniRegistrationId: RegistrationId; }>; export type ChangeNumberOptions = Readonly<{ number: string; pni: PniString; pniRegistrationId: RegistrationId; }>; export type DeviceKeys = Readonly<{ identityKey: PublicKey; preKeys?: ReadonlyArray<PreKey>; kyberPreKeys?: ReadonlyArray<KyberPreKey>; lastResortKey?: KyberPreKey; signedPreKey?: SignedPreKey; preKeyIterator?: AsyncIterator<PreKey>; kyberPreKeyIterator?: AsyncIterator<KyberPreKey>; }>; export type SingleUseKey = Readonly<{ identityKey: PublicKey; signedPreKey: SignedPreKey; preKey: PreKey | undefined; pqPreKey: KyberPreKey; }>; export declare class Device { readonly aci: AciString; readonly deviceId: DeviceId; readonly address: ProtocolAddress; capabilities: { deleteSync: boolean; versionedExpirationTimer: boolean; ssre2: boolean; }; backupLevel: BackupLevel; accessKey?: Buffer; profileKeyCommitment?: ProfileKeyCommitment; profileName?: Buffer; private keys; private privPni; private privNumber; private privPniAddress; private readonly registrationId; private pniRegistrationId; constructor(options: DeviceOptions); get debugId(): string; getRegistrationId(serviceIdKind: ServiceIdKind): number; get pni(): PniString; get number(): string; get pniAddress(): ProtocolAddress; changeNumber({ number, pni, pniRegistrationId, }: ChangeNumberOptions): Promise<void>; setKeys(serviceIdKind: ServiceIdKind, keys: DeviceKeys): Promise<void>; getIdentityKey(serviceIdKind?: ServiceIdKind): Promise<PublicKey>; popSingleUseKey(serviceIdKind?: ServiceIdKind): Promise<SingleUseKey>; getPreKeyCount(serviceIdKind?: ServiceIdKind): Promise<number>; getKyberPreKeyCount(serviceIdKind?: ServiceIdKind): Promise<number>; getServiceIdByKind(serviceIdKind: ServiceIdKind): ServiceIdString; getServiceIdKind(serviceId: ServiceIdString): ServiceIdKind; getAddressByKind(serviceIdKind: ServiceIdKind): ProtocolAddress; }