-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
99 lines (81 loc) · 2.29 KB
/
index.d.ts
File metadata and controls
99 lines (81 loc) · 2.29 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
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
95
96
97
98
99
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: Uint8Array;
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?: Uint8Array;
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>
toString(extract?: boolean): string;
toBSON(extract?: boolean): Uint8Array;
toJSON(extract?: boolean): IIdentityProps;
toMini(includePostQuantum?: boolean): IIdentityMiniProps;
}
declare interface IEncryptedData {
enc?: Uint8Array;
sig?: Uint8Array | ISignature;
msg?: any;
from?: IIdentityProps;
}
declare interface IMessage extends IEncryptedData {
verify(verifier: IIdentity, requirePostQuantum: boolean): Promise<boolean>;
assertVerified(from: IIdentity, requirePostQuantum: boolean): Promise<void>;
sign(signer: IIdentity, requirePostQuantum: boolean, pqType: string): Promise<boolean>;
}
declare interface IDecryptedData {
data: any;
from: IIdentityProps;
}
declare interface IPQSharedSecret {
cipherText: string;
sharedSecret: string;
}
declare interface INaclSharedSecret {
sharedSecret: string;
}
declare interface IAESSharedSecret {
cipherText: string;
sharedSecret: string;
}
declare interface IAESStream {
key: Uint8Array;
identity: IIdentity;
rxNonce: Uint8Array;
txNonce: Uint8Array;
key: Uint8Array;
offer: IAESStreamOffer;
encrypt(plaintext: Uint8Array): Promise<Uint8Array>;
decrypt(ciphertext: Uint8Array): Promise<Uint8Array>;
}
declare interface IAESStreamOffer {
sender: IIdentity;
pqCipherText: string;
streamNonce: string;
mode: string;
}