forked from adiwajshing/libsignal-node
-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathindex.d.ts
More file actions
55 lines (50 loc) · 1.6 KB
/
index.d.ts
File metadata and controls
55 lines (50 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
interface E2ESession {
registrationId: number;
identityKey: Uint8Array;
signedPreKey: {
keyId: number;
publicKey: Uint8Array;
signature: Uint8Array;
};
preKey: {
keyId: number;
publicKey: Uint8Array;
};
}
export interface SignalStorage {
loadSession(id: string): Promise<SessionRecord | null | undefined>;
storeSession(id: string, session: SessionRecord): Promise<void>;
isTrustedIdentity(
identifier: string,
identityKey: Uint8Array,
direction: number
): boolean;
loadPreKey(
id: number | string
): Promise<{ privKey: Buffer; pubKey: Buffer } | undefined>;
removePreKey(id: number): void;
loadSignedPreKey(): { privKey: Buffer; pubKey: Buffer };
getOurRegistrationId(): Promise<number> | number;
getOurIdentity(): { privKey: Buffer; pubKey: Buffer };
}
export class ProtocolAddress {
constructor(name: string, deviceId: number);
public id: string;
public deviceId: number;
public toString(): string;
}
export class SessionRecord {
static deserialize(serialized: Uint8Array): SessionRecord;
public serialize(): Uint8Array;
public haveOpenSession(): boolean;
}
export class SessionCipher {
constructor(storage: SignalStorage, remoteAddress: ProtocolAddress);
public decryptPreKeyWhisperMessage(ciphertext: Uint8Array): Promise<Buffer>;
public decryptWhisperMessage(ciphertext: Uint8Array): Promise<Buffer>;
public encrypt(data: Uint8Array): Promise<{ type: number; body: string }>;
}
export class SessionBuilder {
constructor(storage: SignalStorage, remoteAddress: ProtocolAddress);
public initOutgoing(session: E2ESession): Promise<void>;
}