UNPKG

@signalapp/mock-server

Version:
76 lines (75 loc) 3.05 kB
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; isProvisioned: boolean; }>; 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, undefined>; kyberPreKeyIterator?: AsyncIterator<KyberPreKey, undefined>; }>; 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; readonly isProvisioned: boolean; capabilities: { deleteSync: boolean; versionedExpirationTimer: boolean; ssre2: boolean; usernameChangeSyncMessage: boolean; }; backupLevel: BackupLevel; accessKey?: Buffer<ArrayBuffer>; profileKeyCommitment?: ProfileKeyCommitment; profileName?: Buffer<ArrayBuffer>; private keys; private privPni; private privNumber; private privPniAddress; private readonly registrationId; private pniRegistrationId; constructor(options: DeviceOptions); get debugId(): string; getRegistrationId(serviceIdKind: ServiceIdKind): number; get aciBinary(): Uint8Array<ArrayBuffer>; get pni(): PniString; get pniBinary(): Uint8Array<ArrayBuffer>; get aciRawUuid(): Uint8Array<ArrayBuffer>; get pniRawUuid(): Uint8Array<ArrayBuffer>; 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; getServiceIdBinaryByKind(serviceIdKind: ServiceIdKind): Uint8Array<ArrayBuffer>; getServiceIdKind(serviceId: ServiceIdString): ServiceIdKind; getServiceIdBinaryKind(serviceIdBinary: Uint8Array<ArrayBuffer>): ServiceIdKind; getAddressByKind(serviceIdKind: ServiceIdKind): ProtocolAddress; }