mirror of
https://github.com/signalapp/libsignal.git
synced 2026-04-25 17:25:18 +02:00
88 lines
2.4 KiB
TypeScript
88 lines
2.4 KiB
TypeScript
//
|
|
// Copyright 2020-2022 Signal Messenger, LLC.
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
// WARNING: this file was automatically generated
|
|
|
|
type Uuid = Buffer;
|
|
|
|
/// A Native.Timestamp may be measured in seconds or in milliseconds;
|
|
/// what's important is that it's an integer less than Number.MAX_SAFE_INTEGER.
|
|
type Timestamp = number;
|
|
|
|
type LookupResponse = Map<string, LookupResponseEntry>;
|
|
|
|
interface LookupResponseEntry {
|
|
readonly aci: string | undefined;
|
|
readonly pni: string | undefined;
|
|
}
|
|
|
|
export abstract class IdentityKeyStore {
|
|
_getIdentityKey(): Promise<PrivateKey>;
|
|
_getLocalRegistrationId(): Promise<number>;
|
|
_saveIdentity(name: ProtocolAddress, key: PublicKey): Promise<boolean>;
|
|
_isTrustedIdentity(
|
|
name: ProtocolAddress,
|
|
key: PublicKey,
|
|
sending: boolean
|
|
): Promise<boolean>;
|
|
_getIdentity(name: ProtocolAddress): Promise<PublicKey | null>;
|
|
}
|
|
|
|
export abstract class SessionStore {
|
|
_saveSession(addr: ProtocolAddress, record: SessionRecord): Promise<void>;
|
|
_getSession(addr: ProtocolAddress): Promise<SessionRecord | null>;
|
|
}
|
|
|
|
export abstract class PreKeyStore {
|
|
_savePreKey(preKeyId: number, record: PreKeyRecord): Promise<void>;
|
|
_getPreKey(preKeyId: number): Promise<PreKeyRecord>;
|
|
_removePreKey(preKeyId: number): Promise<void>;
|
|
}
|
|
|
|
export abstract class SignedPreKeyStore {
|
|
_saveSignedPreKey(
|
|
signedPreKeyId: number,
|
|
record: SignedPreKeyRecord
|
|
): Promise<void>;
|
|
_getSignedPreKey(signedPreKeyId: number): Promise<SignedPreKeyRecord>;
|
|
}
|
|
|
|
export abstract class KyberPreKeyStore {
|
|
_saveKyberPreKey(
|
|
kyberPreKeyId: number,
|
|
record: KyberPreKeyRecord
|
|
): Promise<void>;
|
|
_getKyberPreKey(kyberPreKeyId: number): Promise<KyberPreKeyRecord>;
|
|
_markKyberPreKeyUsed(kyberPreKeyId: number): Promise<void>;
|
|
}
|
|
|
|
export abstract class SenderKeyStore {
|
|
_saveSenderKey(
|
|
sender: ProtocolAddress,
|
|
distributionId: Uuid,
|
|
record: SenderKeyRecord
|
|
): Promise<void>;
|
|
_getSenderKey(
|
|
sender: ProtocolAddress,
|
|
distributionId: Uuid
|
|
): Promise<SenderKeyRecord | null>;
|
|
}
|
|
|
|
export abstract class InputStream {
|
|
_read(amount: number): Promise<Buffer>;
|
|
_skip(amount: number): Promise<void>;
|
|
}
|
|
|
|
export abstract class SyncInputStream extends Buffer {}
|
|
|
|
interface Wrapper<T> {
|
|
readonly _nativeHandle: T;
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
type Serialized<T> = Buffer;
|
|
|
|
export function registerErrors(errorsModule: Record<string, unknown>): void;
|