Improve Typescript typing

This commit is contained in:
Michael Telatynski 2022-12-01 18:35:42 +00:00
parent dbd8a44fa2
commit b5d68376b5

16
javascript/index.d.ts vendored
View file

@ -51,7 +51,10 @@ declare class Session {
has_received_message(): boolean;
matches_inbound(one_time_key_message: string): boolean;
matches_inbound_from(identity_key: string, one_time_key_message: string): boolean;
encrypt(plaintext: string): object;
encrypt(plaintext: string): {
type: 0 | 1; // 0: PreKey, 1: Message
body: string;
};
decrypt(message_type: number, message: string): string;
describe(): string;
}
@ -70,7 +73,10 @@ declare class InboundGroupSession {
unpickle(key: string | Uint8Array, pickle: string): void;
create(session_key: string): string;
import_session(session_key: string): string;
decrypt(message: string): object;
decrypt(message: string): {
message_index: string;
plaintext: string;
};
session_id(): string;
first_known_index(): number;
export_session(message_index: number): string;
@ -92,7 +98,11 @@ declare class PkEncryption {
constructor();
free(): void;
set_recipient_key(key: string): void;
encrypt(plaintext: string): object;
encrypt(plaintext: string): {
ciphertext: string;
mac: string;
ephemeral: string;
};
}
declare class PkDecryption {