forked from cyph/supersphincs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupersphincs.d.ts
executable file
·168 lines (148 loc) · 3.89 KB
/
supersphincs.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
declare module 'supersphincs' {
interface ISuperSphincs {
/** Signature length. */
bytes: Promise<number>;
/** Hash length. */
hashBytes: Promise<number>;
/** Private key length. */
privateKeyBytes: Promise<number>;
/** Public key length. */
publicKeyBytes: Promise<number>;
/** Serializes key pair. */
exportKeys (keyPair: {publicKey: Uint8Array}) : Promise<{
private: {
rsa: null;
sphincs: null;
superSphincs: null;
};
public: {
rsa: string;
sphincs: string;
superSphincs: string;
};
}>;
/**
* Serializes key pair with optional encryption.
* Using encryption (a password) requires native crypto support.
*/
exportKeys (
keyPair: {
privateKey: Uint8Array;
publicKey: Uint8Array;
},
password?: string
) : Promise<{
private: {
rsa: string;
sphincs: string;
superSphincs: string;
};
public: {
rsa: string;
sphincs: string;
superSphincs: string;
};
}>;
/** SHA-512 hash. */
hash (message: Uint8Array|string, onlyBinary: true) : Promise<Uint8Array>;
/** SHA-512 hash. */
hash (message: Uint8Array|string, onlyBinary?: false) : Promise<{
binary: Uint8Array;
hex: string;
}>;
/** Imports exported keys and creates key pair object. */
importKeys (keyData: {public: {superSphincs: string}}) : Promise<{
privateKey: null;
publicKey: Uint8Array;
}>;
/** Imports exported keys and creates key pair object. */
importKeys (keyData: {public: {rsa: string; sphincs: string}}) : Promise<{
privateKey: null;
publicKey: Uint8Array;
}>;
/**
* Imports exported keys and creates key pair object.
* Using a password requires native crypto support.
*/
importKeys (
keyData: {
private: {
superSphincs: string;
};
public?: any;
},
password?: string
) : Promise<{
privateKey: Uint8Array;
publicKey: Uint8Array;
}>;
/**
* Imports exported keys and creates key pair object.
* Using a password requires native crypto support.
*/
importKeys (
keyData: {
private: {
rsa: string;
sphincs: string;
};
public?: any;
},
password?: string|{
rsa: string;
sphincs: string;
}
) : Promise<{
privateKey: Uint8Array;
publicKey: Uint8Array;
}>;
/** Generates key pair. */
keyPair () : Promise<{privateKey: Uint8Array; publicKey: Uint8Array}>;
/** Verifies signed message against publicKey and returns it. */
open (
signed: Uint8Array|string,
publicKey: Uint8Array,
additionalData?: Uint8Array|string
) : Promise<Uint8Array>;
/** Verifies signed message against publicKey and returns it decoded to a string. */
openString (
signed: Uint8Array|string,
publicKey: Uint8Array,
additionalData?: Uint8Array|string
) : Promise<string>;
/** Signs message with privateKey and returns combined message. */
sign (
message: Uint8Array|string,
privateKey: Uint8Array,
additionalData?: Uint8Array|string
) : Promise<Uint8Array>;
/** Signs message with privateKey and returns combined message encoded as base64. */
signBase64 (
message: Uint8Array|string,
privateKey: Uint8Array,
additionalData?: Uint8Array|string
) : Promise<string>;
/** Signs message with privateKey and returns signature. */
signDetached (
message: Uint8Array|string,
privateKey: Uint8Array,
additionalData?: Uint8Array|string,
preHashed?: boolean
) : Promise<Uint8Array>;
/** Signs message with privateKey and returns signature encoded as base64. */
signDetachedBase64 (
message: Uint8Array|string,
privateKey: Uint8Array,
additionalData?: Uint8Array|string,
preHashed?: boolean
) : Promise<string>;
/** Verifies detached signature against publicKey. */
verifyDetached (
signature: Uint8Array|string,
message: Uint8Array|string,
publicKey: Uint8Array,
additionalData?: Uint8Array|string
) : Promise<boolean>;
}
const superSphincs: ISuperSphincs;
}