-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
84 lines (68 loc) · 1.8 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
declare interface IKeyBundle {
box: string;
sign: string;
pqkem?: string;
pqsign_ml?: string;
pqsign_slh?: string;
}
declare interface IKey {
type: string;
hash: string,
private?: IKeyBundle;
public: IKeyBundle;
}
declare interface IIdentityProps {
id: string;
key: IKey;
}
declare interface ISignature {
timestamp: number;
sender: IIdentityMiniProps;
value: string;
//type: string; //! type of key used for signing (nacl vs pq_dsa65)
}
declare interface IIdentityMiniProps extends IKey {
hash: string;
type: string;
public: IKeyBundle
}
declare interface IIdentity extends IIdentityProps {
seed?: Buffer;
assertHasPostQuatumKEM(): void;
hasPostQuatumKEM(): boolean;
createStream(to: IIdentity, requirePostQuantum: boolean, info?: Uint8Array | string, salt?: Uint8Array | string): Promise<IAESStreamOffer>;
recoverStream(offer: IAESStreamOffer,requirePostQuantum: boolean, info?: Uint8Array | string, salt?: Uint8Array | string): Promise<IAESStream>
toJSON(extract?: boolean): IIdentityProps;
toMini(): IIdentityMiniProps;
}
declare interface IEncryptedData {
enc?: string;
sig?: string | ISignature;
msg?: any;
from?: IIdentityProps;
}
declare interface IMessage extends IEncryptedData {
verify(verifier: IIdentity): Promise<boolean>;
sign(signer: IIdentity): Promise<boolean>;
}
declare interface IDecryptedData {
data: any;
from: IIdentityProps;
}
declare interface IPQSharedSecret {
cipherText: string;
sharedSecret: string;
}
declare interface INaclSharedSecret {
sharedSecret: string;
}
declare interface IAESStream {
encrypt(plaintext: Uint8Array): Uint8Array;
decrypt(ciphertext: Uint8Array): Uint8Array;
}
declare interface IAESStreamOffer {
sender: IIdentity;
pqCipherText: string;
streamNonce: string;
stream?: IAESStream;
}