pqc-binary-format 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +661 -0
- package/package.json +34 -0
- package/pqc_binary_format.d.ts +236 -0
- package/pqc_binary_format.js +5 -0
- package/pqc_binary_format_bg.js +827 -0
- package/pqc_binary_format_bg.wasm +0 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class WasmAlgorithm {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
/**
|
|
8
|
+
* Get all supported algorithm names
|
|
9
|
+
*/
|
|
10
|
+
static supportedAlgorithms(): any[];
|
|
11
|
+
/**
|
|
12
|
+
* Create a new algorithm from name
|
|
13
|
+
*/
|
|
14
|
+
constructor(name: string);
|
|
15
|
+
/**
|
|
16
|
+
* Get algorithm ID
|
|
17
|
+
*/
|
|
18
|
+
readonly id: number;
|
|
19
|
+
/**
|
|
20
|
+
* Get algorithm name
|
|
21
|
+
*/
|
|
22
|
+
readonly name: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class WasmCompressionParameters {
|
|
26
|
+
free(): void;
|
|
27
|
+
[Symbol.dispose](): void;
|
|
28
|
+
/**
|
|
29
|
+
* Create new compression parameters
|
|
30
|
+
*/
|
|
31
|
+
constructor(algorithm: string, level: number, original_size: bigint);
|
|
32
|
+
/**
|
|
33
|
+
* Get original size
|
|
34
|
+
*/
|
|
35
|
+
readonly original_size: bigint;
|
|
36
|
+
/**
|
|
37
|
+
* Get compression level
|
|
38
|
+
*/
|
|
39
|
+
readonly level: number;
|
|
40
|
+
/**
|
|
41
|
+
* Get compression algorithm
|
|
42
|
+
*/
|
|
43
|
+
readonly algorithm: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export class WasmEncParameters {
|
|
47
|
+
free(): void;
|
|
48
|
+
[Symbol.dispose](): void;
|
|
49
|
+
/**
|
|
50
|
+
* Create new encryption parameters
|
|
51
|
+
*/
|
|
52
|
+
constructor(iv: Uint8Array, tag: Uint8Array);
|
|
53
|
+
/**
|
|
54
|
+
* Get IV/nonce
|
|
55
|
+
*/
|
|
56
|
+
iv: Uint8Array;
|
|
57
|
+
/**
|
|
58
|
+
* Get authentication tag
|
|
59
|
+
*/
|
|
60
|
+
tag: Uint8Array;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export class WasmFormatFlags {
|
|
64
|
+
free(): void;
|
|
65
|
+
[Symbol.dispose](): void;
|
|
66
|
+
/**
|
|
67
|
+
* Check if streaming is enabled
|
|
68
|
+
*/
|
|
69
|
+
hasStreaming(): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Enable streaming flag
|
|
72
|
+
*/
|
|
73
|
+
withStreaming(): WasmFormatFlags;
|
|
74
|
+
/**
|
|
75
|
+
* Check if compression is enabled
|
|
76
|
+
*/
|
|
77
|
+
hasCompression(): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Check if experimental features are enabled
|
|
80
|
+
*/
|
|
81
|
+
hasExperimental(): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Enable compression flag
|
|
84
|
+
*/
|
|
85
|
+
withCompression(): WasmFormatFlags;
|
|
86
|
+
/**
|
|
87
|
+
* Enable experimental features flag
|
|
88
|
+
*/
|
|
89
|
+
withExperimental(): WasmFormatFlags;
|
|
90
|
+
/**
|
|
91
|
+
* Check if additional auth is enabled
|
|
92
|
+
*/
|
|
93
|
+
hasAdditionalAuth(): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Enable additional auth flag
|
|
96
|
+
*/
|
|
97
|
+
withAdditionalAuth(): WasmFormatFlags;
|
|
98
|
+
/**
|
|
99
|
+
* Create new empty flags
|
|
100
|
+
*/
|
|
101
|
+
constructor();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export class WasmKemParameters {
|
|
105
|
+
free(): void;
|
|
106
|
+
[Symbol.dispose](): void;
|
|
107
|
+
/**
|
|
108
|
+
* Create new KEM parameters
|
|
109
|
+
*/
|
|
110
|
+
constructor(public_key: Uint8Array, ciphertext: Uint8Array);
|
|
111
|
+
/**
|
|
112
|
+
* Get ciphertext
|
|
113
|
+
*/
|
|
114
|
+
readonly ciphertext: Uint8Array;
|
|
115
|
+
/**
|
|
116
|
+
* Get public key
|
|
117
|
+
*/
|
|
118
|
+
readonly public_key: Uint8Array;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export class WasmPqcBinaryFormat {
|
|
122
|
+
free(): void;
|
|
123
|
+
[Symbol.dispose](): void;
|
|
124
|
+
/**
|
|
125
|
+
* Deserialize from bytes
|
|
126
|
+
*
|
|
127
|
+
* @param {Uint8Array} data - Bytes to deserialize
|
|
128
|
+
* @returns {WasmPqcBinaryFormat} Deserialized instance
|
|
129
|
+
* @throws {Error} If deserialization fails
|
|
130
|
+
*/
|
|
131
|
+
static fromBytes(data: Uint8Array): WasmPqcBinaryFormat;
|
|
132
|
+
/**
|
|
133
|
+
* Get total serialized size
|
|
134
|
+
*
|
|
135
|
+
* @returns {number} Size in bytes
|
|
136
|
+
*/
|
|
137
|
+
totalSize(): number;
|
|
138
|
+
/**
|
|
139
|
+
* Create with specific flags
|
|
140
|
+
*
|
|
141
|
+
* @param {WasmAlgorithm} algorithm - Algorithm to use
|
|
142
|
+
* @param {WasmFormatFlags} flags - Format flags
|
|
143
|
+
* @param {WasmPqcMetadata} metadata - Metadata container
|
|
144
|
+
* @param {Uint8Array} data - Encrypted data bytes
|
|
145
|
+
* @returns {WasmPqcBinaryFormat} New instance
|
|
146
|
+
*/
|
|
147
|
+
static withFlags(algorithm: WasmAlgorithm, flags: WasmFormatFlags, metadata: WasmPqcMetadata, data: Uint8Array): WasmPqcBinaryFormat;
|
|
148
|
+
/**
|
|
149
|
+
* Create a new PQC Binary Format structure
|
|
150
|
+
*
|
|
151
|
+
* @param {WasmAlgorithm} algorithm - Algorithm to use
|
|
152
|
+
* @param {WasmPqcMetadata} metadata - Metadata container
|
|
153
|
+
* @param {Uint8Array} data - Encrypted data bytes
|
|
154
|
+
* @returns {WasmPqcBinaryFormat} New instance
|
|
155
|
+
*/
|
|
156
|
+
constructor(algorithm: WasmAlgorithm, metadata: WasmPqcMetadata, data: Uint8Array);
|
|
157
|
+
/**
|
|
158
|
+
* Serialize to bytes
|
|
159
|
+
*
|
|
160
|
+
* @returns {Uint8Array} Serialized bytes
|
|
161
|
+
* @throws {Error} If serialization fails
|
|
162
|
+
*/
|
|
163
|
+
toBytes(): Uint8Array;
|
|
164
|
+
/**
|
|
165
|
+
* Validate the format structure
|
|
166
|
+
*
|
|
167
|
+
* @throws {Error} If validation fails
|
|
168
|
+
*/
|
|
169
|
+
validate(): void;
|
|
170
|
+
/**
|
|
171
|
+
* Get encrypted data
|
|
172
|
+
*
|
|
173
|
+
* @returns {Uint8Array} Encrypted data
|
|
174
|
+
*/
|
|
175
|
+
readonly data: Uint8Array;
|
|
176
|
+
/**
|
|
177
|
+
* Get format flags
|
|
178
|
+
*
|
|
179
|
+
* @returns {WasmFormatFlags} Format flags
|
|
180
|
+
*/
|
|
181
|
+
readonly flags: WasmFormatFlags;
|
|
182
|
+
/**
|
|
183
|
+
* Get algorithm
|
|
184
|
+
*
|
|
185
|
+
* @returns {WasmAlgorithm} Algorithm used
|
|
186
|
+
*/
|
|
187
|
+
readonly algorithm: WasmAlgorithm;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export class WasmPqcMetadata {
|
|
191
|
+
free(): void;
|
|
192
|
+
[Symbol.dispose](): void;
|
|
193
|
+
/**
|
|
194
|
+
* Set KEM parameters
|
|
195
|
+
*/
|
|
196
|
+
setKemParams(kem_params: WasmKemParameters): void;
|
|
197
|
+
/**
|
|
198
|
+
* Set signature parameters
|
|
199
|
+
*/
|
|
200
|
+
setSigParams(sig_params: WasmSigParameters): void;
|
|
201
|
+
/**
|
|
202
|
+
* Set compression parameters
|
|
203
|
+
*/
|
|
204
|
+
setCompressionParams(compression_params: WasmCompressionParameters): void;
|
|
205
|
+
/**
|
|
206
|
+
* Create new metadata
|
|
207
|
+
*/
|
|
208
|
+
constructor(enc_params: WasmEncParameters);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export class WasmSigParameters {
|
|
212
|
+
free(): void;
|
|
213
|
+
[Symbol.dispose](): void;
|
|
214
|
+
/**
|
|
215
|
+
* Create new signature parameters
|
|
216
|
+
*/
|
|
217
|
+
constructor(public_key: Uint8Array, signature: Uint8Array);
|
|
218
|
+
/**
|
|
219
|
+
* Get public key
|
|
220
|
+
*/
|
|
221
|
+
readonly public_key: Uint8Array;
|
|
222
|
+
/**
|
|
223
|
+
* Get signature
|
|
224
|
+
*/
|
|
225
|
+
readonly signature: Uint8Array;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Get the PQC Binary Format spec version
|
|
230
|
+
*/
|
|
231
|
+
export function getBinaryVersion(): number;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Get the PQC Binary Format version
|
|
235
|
+
*/
|
|
236
|
+
export function getVersion(): string;
|