-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
94 lines (92 loc) · 3.21 KB
/
index.d.ts
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export interface IdentityKeys {
ed25519: string
curve25519: string
}
export declare class Account {
constructor()
identityKeys(): IdentityKeys
static fromPickle(pickle: string, pickleKey: string): Account
static fromLibolmPickle(pickle: string, pickleKey: string): Account
pickle(pickleKey: string): string
get ed25519Key(): string
get curve25519Key(): string
sign(message: string): string
get maxNumberOfOneTimeKeys(): number
get oneTimeKeys(): Record<string, string>
generateOneTimeKeys(count: number): void
get fallbackKey(): object
generateFallbackKey(): void
markKeysAsPublished(): void
createOutboundSession(identityKey: string, oneTimeKey: string, config: SessionConfig): Session
createInboundSession(identityKey: string, message: OlmMessage): { session: Session, plaintext: string }
}
export declare class Session {
pickle(pickleKey: string): string
static fromPickle(pickle: string, pickleKey: string): Session
static fromLibolmPickle(pickle: string, pickleKey: string): Session
get sessionId(): string
sessionMatches(message: OlmMessage): boolean
encrypt(plaintext: string): OlmMessage
decrypt(message: OlmMessage): string
}
export declare class Sas {
constructor()
get publicKey(): string
}
export declare class EstablishedSas {
calculateMac(input: string, info: string): string
calculateMacInvalidBase64(input: string, info: string): string
verifyMac(input: string, info: string, tag: string): void
}
export declare class SasBytes {
get emojiIndices(): Array<number>
get decimals(): Array<number>
}
export declare class GroupSession {
constructor(config: SessionConfig)
get sessionId(): string
get sessionKey(): string
get messageIndex(): number
encrypt(plaintext: string): string
pickle(pickleKey: string): string
static fromPickle(pickle: string, pickleKey: string): GroupSession
}
export declare class DecryptedMessage {
plaintext: string
messageIndex: number
}
export declare class InboundGroupSession {
constructor(sessionKey: string, sessionConfig: SessionConfig)
static import(sessionKey: string, sessionConfig: SessionConfig): InboundGroupSession
get sessionId(): string
get firstKnownIndex(): number
exportAt(index: number): string | null
decrypt(ciphertext: string): DecryptedMessage
pickle(pickleKey: Uint8Array): string
static fromPickle(pickle: string, pickleKey: string): InboundGroupSession
static fromLibolmPickle(pickle: string, pickleKey: string): InboundGroupSession
}
export declare class SessionConfig {
/** Get the numeric version of this `SessionConfig`. */
version(): number
/**
* Create a `SessionConfig` for the Olm version 1. This version of Olm will
* use AES-256 and HMAC with a truncated MAC to encrypt individual
* messages. The MAC will be truncated to 8 bytes.
*/
static version1(): SessionConfig
/**
* Create a `SessionConfig` for the Olm version 2. This version of Olm will
* use AES-256 and HMAC to encrypt individual messages. The MAC won't be
* truncated.
*/
static version2(): SessionConfig
}
export declare class OlmMessage {
ciphertext: string
messageType: number
constructor(messageType: number, ciphertext: string)
}