Files
libsignal/rust/bridge/node/bin/Native.ts.in
marc-signal c706b7f5ce Expose getUploadForm() to clients
Co-authored-by: Jordan Rose <jrose@signal.org>
2026-03-24 14:32:59 -04:00

159 lines
3.8 KiB
TypeScript

//
// Copyright 2020 Signal Messenger, LLC.
// SPDX-License-Identifier: AGPL-3.0-only
//
// WARNING: this file was automatically generated
export type Uuid = Uint8Array<ArrayBuffer>;
/// 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.
export type Timestamp = number;
// Rust code produces or consumes values that conform to these interface
// definitions. They must be kept in sync to prevent bridging errors.
export type LookupResponse = {
entries: Map<string, LookupResponseEntry>;
debugPermitsUsed: number;
};
export type LookupResponseEntry = {
readonly aci: string | undefined;
readonly pni: string | undefined;
};
export type ChatResponse = {
status: number;
message: string | undefined;
headers: ReadonlyArray<[string, string]>;
body: Uint8Array<ArrayBuffer> | undefined;
};
export type ChatServiceDebugInfo = {
ipType: number;
durationMillis: number;
connectionInfo: string;
};
export type ResponseAndDebugInfo = {
response: ChatResponse;
debugInfo: ChatServiceDebugInfo;
};
export type SealedSenderMultiRecipientMessageRecipient = {
deviceIds: number[];
registrationIds: number[];
rangeOffset: number;
rangeLen: number;
};
export type SealedSenderMultiRecipientMessage = {
recipientMap: {
[serviceId: string]: SealedSenderMultiRecipientMessageRecipient;
};
excludedRecipients: string[];
offsetOfSharedData: number;
};
export enum IdentityChange {
// This must be kept in sync with the Rust enum of the same name.
NewOrUnchanged = 0,
ReplacedExisting = 1,
}
// TODO: Resolve the different names here.
export type IdentityKeyStore = BridgeIdentityKeyStore;
export type PreKeyStore = BridgePreKeyStore;
export type SignedPreKeyStore = BridgeSignedPreKeyStore;
export type KyberPreKeyStore = BridgeKyberPreKeyStore;
export type SessionStore = BridgeSessionStore;
export type SenderKeyStore = BridgeSenderKeyStore;
export type InputStream = BridgeInputStream;
export type SyncInputStream = Uint8Array<ArrayBuffer>;
export type ChallengeOption = 'pushChallenge' | 'captcha';
export type RegistrationPushTokenType = 'apn' | 'fcm';
export type RegistrationCreateSessionRequest = {
number: string;
push_token?: string;
push_token_type?: RegistrationPushTokenType;
mcc?: string;
mnc?: string;
};
export type RegisterResponseBadge = {
id: string;
visible: boolean;
expirationSeconds: number;
};
export type CheckSvr2CredentialsResponse = Map<
string,
'match' | 'no-match' | 'invalid'
>;
export type SignedPublicPreKey = {
keyId: number;
publicKey: Uint8Array<ArrayBuffer>;
signature: Uint8Array<ArrayBuffer>;
};
export type Wrapper<T> = Readonly<{
_nativeHandle: T;
}>;
export type MessageBackupValidationOutcome = {
errorMessage: string | null;
unknownFieldMessages: Array<string>;
};
export type JsonFrameExportResult = [
line: string | null,
errorMessage: string | null
];
export type PreKeysResponse = {
identityKey: PublicKey;
preKeyBundles: PreKeyBundle[];
};
export type UploadForm = {
cdn: number;
key: string;
headers: [string, string][];
signedUploadUrl: string;
};
export type AccountEntropyPool = string;
export type CancellablePromise<T> = Promise<T> & {
_cancellationToken: bigint;
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export type Serialized<T> = Uint8Array<ArrayBuffer>;
type ConnectChatBridge = Wrapper<ConnectionManager>;
type TestingFutureCancellationGuard = Wrapper<TestingFutureCancellationCounter>;
import load from 'node-gyp-build';
type NativeFunctions = {
registerErrors: (errorsModule: Record<string, unknown>) => void;
NATIVE_FNS;
};
const { registerErrors, NATIVE_FN_NAMES } = load(
`${import.meta.dirname}/../`
) as NativeFunctions;
export { registerErrors, NATIVE_FN_NAMES };
/* eslint-disable comma-dangle */
NATIVE_TYPES;