@ciphera-net/tessera 0.1.3
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/LICENSE +202 -0
- package/README.md +380 -0
- package/dist/blindIndex.d.ts +2 -0
- package/dist/blindIndex.js +10 -0
- package/dist/encoding.d.ts +19 -0
- package/dist/encoding.js +44 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.js +27 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +7 -0
- package/dist/opaque.d.ts +16 -0
- package/dist/opaque.js +69 -0
- package/dist/passkey.d.ts +30 -0
- package/dist/passkey.js +75 -0
- package/dist/recovery.d.ts +7 -0
- package/dist/recovery.js +19 -0
- package/dist/tessera.d.ts +109 -0
- package/dist/tessera.js +228 -0
- package/dist/transport.d.ts +39 -0
- package/dist/transport.js +1 -0
- package/dist/vault.d.ts +9 -0
- package/dist/vault.js +108 -0
- package/dist/vmk.d.ts +29 -0
- package/dist/vmk.js +117 -0
- package/dist/wasm.d.ts +10 -0
- package/dist/wasm.js +52 -0
- package/package.json +39 -0
- package/wasm/node/package.json +12 -0
- package/wasm/node/tessera.d.ts +51 -0
- package/wasm/node/tessera.js +463 -0
- package/wasm/node/tessera_bg.wasm +0 -0
- package/wasm/node/tessera_bg.wasm.d.ts +27 -0
- package/wasm/web/package.json +16 -0
- package/wasm/web/tessera.d.ts +103 -0
- package/wasm/web/tessera.js +552 -0
- package/wasm/web/tessera_bg.wasm +0 -0
- package/wasm/web/tessera_bg.wasm.d.ts +27 -0
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
/* @ts-self-types="./tessera.d.ts" */
|
|
2
|
+
|
|
3
|
+
class LoginFinish {
|
|
4
|
+
static __wrap(ptr) {
|
|
5
|
+
const obj = Object.create(LoginFinish.prototype);
|
|
6
|
+
obj.__wbg_ptr = ptr;
|
|
7
|
+
LoginFinishFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
8
|
+
return obj;
|
|
9
|
+
}
|
|
10
|
+
__destroy_into_raw() {
|
|
11
|
+
const ptr = this.__wbg_ptr;
|
|
12
|
+
this.__wbg_ptr = 0;
|
|
13
|
+
LoginFinishFinalization.unregister(this);
|
|
14
|
+
return ptr;
|
|
15
|
+
}
|
|
16
|
+
free() {
|
|
17
|
+
const ptr = this.__destroy_into_raw();
|
|
18
|
+
wasm.__wbg_loginfinish_free(ptr, 0);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @returns {Uint8Array}
|
|
22
|
+
*/
|
|
23
|
+
get exportKey() {
|
|
24
|
+
const ret = wasm.loginfinish_exportKey(this.__wbg_ptr);
|
|
25
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
26
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
27
|
+
return v1;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @returns {Uint8Array}
|
|
31
|
+
*/
|
|
32
|
+
get finalization() {
|
|
33
|
+
const ret = wasm.loginfinish_finalization(this.__wbg_ptr);
|
|
34
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
35
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
36
|
+
return v1;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @returns {Uint8Array}
|
|
40
|
+
*/
|
|
41
|
+
get sessionKey() {
|
|
42
|
+
const ret = wasm.loginfinish_sessionKey(this.__wbg_ptr);
|
|
43
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
44
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
45
|
+
return v1;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (Symbol.dispose) LoginFinish.prototype[Symbol.dispose] = LoginFinish.prototype.free;
|
|
49
|
+
exports.LoginFinish = LoginFinish;
|
|
50
|
+
|
|
51
|
+
class LoginHandle {
|
|
52
|
+
__destroy_into_raw() {
|
|
53
|
+
const ptr = this.__wbg_ptr;
|
|
54
|
+
this.__wbg_ptr = 0;
|
|
55
|
+
LoginHandleFinalization.unregister(this);
|
|
56
|
+
return ptr;
|
|
57
|
+
}
|
|
58
|
+
free() {
|
|
59
|
+
const ptr = this.__destroy_into_raw();
|
|
60
|
+
wasm.__wbg_loginhandle_free(ptr, 0);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Finish login (single-use). Returns finalization (relay), session_key, export_key (CLIENT-ONLY).
|
|
64
|
+
* @param {Uint8Array} password
|
|
65
|
+
* @param {Uint8Array} response
|
|
66
|
+
* @returns {LoginFinish}
|
|
67
|
+
*/
|
|
68
|
+
finish(password, response) {
|
|
69
|
+
const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
|
|
70
|
+
const len0 = WASM_VECTOR_LEN;
|
|
71
|
+
const ptr1 = passArray8ToWasm0(response, wasm.__wbindgen_malloc);
|
|
72
|
+
const len1 = WASM_VECTOR_LEN;
|
|
73
|
+
const ret = wasm.loginhandle_finish(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
74
|
+
if (ret[2]) {
|
|
75
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
76
|
+
}
|
|
77
|
+
return LoginFinish.__wrap(ret[0]);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @param {Uint8Array} password
|
|
81
|
+
*/
|
|
82
|
+
constructor(password) {
|
|
83
|
+
const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
|
|
84
|
+
const len0 = WASM_VECTOR_LEN;
|
|
85
|
+
const ret = wasm.loginhandle_new(ptr0, len0);
|
|
86
|
+
if (ret[2]) {
|
|
87
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
88
|
+
}
|
|
89
|
+
this.__wbg_ptr = ret[0];
|
|
90
|
+
LoginHandleFinalization.register(this, this.__wbg_ptr, this);
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @returns {Uint8Array}
|
|
95
|
+
*/
|
|
96
|
+
get request() {
|
|
97
|
+
const ret = wasm.loginhandle_request(this.__wbg_ptr);
|
|
98
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
99
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
100
|
+
return v1;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (Symbol.dispose) LoginHandle.prototype[Symbol.dispose] = LoginHandle.prototype.free;
|
|
104
|
+
exports.LoginHandle = LoginHandle;
|
|
105
|
+
|
|
106
|
+
class RegistrationFinish {
|
|
107
|
+
static __wrap(ptr) {
|
|
108
|
+
const obj = Object.create(RegistrationFinish.prototype);
|
|
109
|
+
obj.__wbg_ptr = ptr;
|
|
110
|
+
RegistrationFinishFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
111
|
+
return obj;
|
|
112
|
+
}
|
|
113
|
+
__destroy_into_raw() {
|
|
114
|
+
const ptr = this.__wbg_ptr;
|
|
115
|
+
this.__wbg_ptr = 0;
|
|
116
|
+
RegistrationFinishFinalization.unregister(this);
|
|
117
|
+
return ptr;
|
|
118
|
+
}
|
|
119
|
+
free() {
|
|
120
|
+
const ptr = this.__destroy_into_raw();
|
|
121
|
+
wasm.__wbg_registrationfinish_free(ptr, 0);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* @returns {Uint8Array}
|
|
125
|
+
*/
|
|
126
|
+
get exportKey() {
|
|
127
|
+
const ret = wasm.registrationfinish_exportKey(this.__wbg_ptr);
|
|
128
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
129
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
130
|
+
return v1;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @returns {Uint8Array}
|
|
134
|
+
*/
|
|
135
|
+
get upload() {
|
|
136
|
+
const ret = wasm.registrationfinish_upload(this.__wbg_ptr);
|
|
137
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
138
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
139
|
+
return v1;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (Symbol.dispose) RegistrationFinish.prototype[Symbol.dispose] = RegistrationFinish.prototype.free;
|
|
143
|
+
exports.RegistrationFinish = RegistrationFinish;
|
|
144
|
+
|
|
145
|
+
class RegistrationHandle {
|
|
146
|
+
__destroy_into_raw() {
|
|
147
|
+
const ptr = this.__wbg_ptr;
|
|
148
|
+
this.__wbg_ptr = 0;
|
|
149
|
+
RegistrationHandleFinalization.unregister(this);
|
|
150
|
+
return ptr;
|
|
151
|
+
}
|
|
152
|
+
free() {
|
|
153
|
+
const ptr = this.__destroy_into_raw();
|
|
154
|
+
wasm.__wbg_registrationhandle_free(ptr, 0);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Finish registration. Consumes the handle's state (single-use; a second call errors). Returns
|
|
158
|
+
* the upload to relay and the 64-byte export_key (CLIENT-ONLY — caller must never transmit it).
|
|
159
|
+
* @param {Uint8Array} password
|
|
160
|
+
* @param {Uint8Array} response
|
|
161
|
+
* @returns {RegistrationFinish}
|
|
162
|
+
*/
|
|
163
|
+
finish(password, response) {
|
|
164
|
+
const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
|
|
165
|
+
const len0 = WASM_VECTOR_LEN;
|
|
166
|
+
const ptr1 = passArray8ToWasm0(response, wasm.__wbindgen_malloc);
|
|
167
|
+
const len1 = WASM_VECTOR_LEN;
|
|
168
|
+
const ret = wasm.registrationhandle_finish(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
169
|
+
if (ret[2]) {
|
|
170
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
171
|
+
}
|
|
172
|
+
return RegistrationFinish.__wrap(ret[0]);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Start registration from a password. `request` carries the RegistrationRequest to relay.
|
|
176
|
+
* @param {Uint8Array} password
|
|
177
|
+
*/
|
|
178
|
+
constructor(password) {
|
|
179
|
+
const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
|
|
180
|
+
const len0 = WASM_VECTOR_LEN;
|
|
181
|
+
const ret = wasm.registrationhandle_new(ptr0, len0);
|
|
182
|
+
if (ret[2]) {
|
|
183
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
184
|
+
}
|
|
185
|
+
this.__wbg_ptr = ret[0];
|
|
186
|
+
RegistrationHandleFinalization.register(this, this.__wbg_ptr, this);
|
|
187
|
+
return this;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* @returns {Uint8Array}
|
|
191
|
+
*/
|
|
192
|
+
get request() {
|
|
193
|
+
const ret = wasm.registrationhandle_request(this.__wbg_ptr);
|
|
194
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
195
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
196
|
+
return v1;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (Symbol.dispose) RegistrationHandle.prototype[Symbol.dispose] = RegistrationHandle.prototype.free;
|
|
200
|
+
exports.RegistrationHandle = RegistrationHandle;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Derive the 32-byte blind index from an email. The params/normalization/salt live in the core
|
|
204
|
+
* crate (`tessera::blind_index`) as the single source of truth; this is a thin binding.
|
|
205
|
+
* @param {string} email
|
|
206
|
+
* @returns {Uint8Array}
|
|
207
|
+
*/
|
|
208
|
+
function blindIndex(email) {
|
|
209
|
+
const ptr0 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
210
|
+
const len0 = WASM_VECTOR_LEN;
|
|
211
|
+
const ret = wasm.blindIndex(ptr0, len0);
|
|
212
|
+
if (ret[3]) {
|
|
213
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
214
|
+
}
|
|
215
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
216
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
217
|
+
return v2;
|
|
218
|
+
}
|
|
219
|
+
exports.blindIndex = blindIndex;
|
|
220
|
+
function __wbg_get_imports() {
|
|
221
|
+
const import0 = {
|
|
222
|
+
__proto__: null,
|
|
223
|
+
__wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
|
|
224
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
225
|
+
return ret;
|
|
226
|
+
},
|
|
227
|
+
__wbg___wbindgen_is_function_754e9f305ff6029e: function(arg0) {
|
|
228
|
+
const ret = typeof(arg0) === 'function';
|
|
229
|
+
return ret;
|
|
230
|
+
},
|
|
231
|
+
__wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
|
|
232
|
+
const val = arg0;
|
|
233
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
234
|
+
return ret;
|
|
235
|
+
},
|
|
236
|
+
__wbg___wbindgen_is_string_c236cabd84a4d769: function(arg0) {
|
|
237
|
+
const ret = typeof(arg0) === 'string';
|
|
238
|
+
return ret;
|
|
239
|
+
},
|
|
240
|
+
__wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
|
|
241
|
+
const ret = arg0 === undefined;
|
|
242
|
+
return ret;
|
|
243
|
+
},
|
|
244
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
245
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
246
|
+
},
|
|
247
|
+
__wbg_call_9c758de292015997: function() { return handleError(function (arg0, arg1, arg2) {
|
|
248
|
+
const ret = arg0.call(arg1, arg2);
|
|
249
|
+
return ret;
|
|
250
|
+
}, arguments); },
|
|
251
|
+
__wbg_crypto_38df2bab126b63dc: function(arg0) {
|
|
252
|
+
const ret = arg0.crypto;
|
|
253
|
+
return ret;
|
|
254
|
+
},
|
|
255
|
+
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
256
|
+
arg0.getRandomValues(arg1);
|
|
257
|
+
}, arguments); },
|
|
258
|
+
__wbg_length_4a591ecaa01354d9: function(arg0) {
|
|
259
|
+
const ret = arg0.length;
|
|
260
|
+
return ret;
|
|
261
|
+
},
|
|
262
|
+
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
|
|
263
|
+
const ret = arg0.msCrypto;
|
|
264
|
+
return ret;
|
|
265
|
+
},
|
|
266
|
+
__wbg_new_with_length_36a4998e27b014c5: function(arg0) {
|
|
267
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
268
|
+
return ret;
|
|
269
|
+
},
|
|
270
|
+
__wbg_node_84ea875411254db1: function(arg0) {
|
|
271
|
+
const ret = arg0.node;
|
|
272
|
+
return ret;
|
|
273
|
+
},
|
|
274
|
+
__wbg_process_44c7a14e11e9f69e: function(arg0) {
|
|
275
|
+
const ret = arg0.process;
|
|
276
|
+
return ret;
|
|
277
|
+
},
|
|
278
|
+
__wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
|
|
279
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
280
|
+
},
|
|
281
|
+
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
282
|
+
arg0.randomFillSync(arg1);
|
|
283
|
+
}, arguments); },
|
|
284
|
+
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
|
|
285
|
+
const ret = module.require;
|
|
286
|
+
return ret;
|
|
287
|
+
}, arguments); },
|
|
288
|
+
__wbg_static_accessor_GLOBAL_9d53f2689e622ca1: function() {
|
|
289
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
290
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
291
|
+
},
|
|
292
|
+
__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a: function() {
|
|
293
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
294
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
295
|
+
},
|
|
296
|
+
__wbg_static_accessor_SELF_4c59f6c7ea29a144: function() {
|
|
297
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
298
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
299
|
+
},
|
|
300
|
+
__wbg_static_accessor_WINDOW_e70ae9f2eb052253: function() {
|
|
301
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
302
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
303
|
+
},
|
|
304
|
+
__wbg_subarray_4aa221f6a4f5ab22: function(arg0, arg1, arg2) {
|
|
305
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
306
|
+
return ret;
|
|
307
|
+
},
|
|
308
|
+
__wbg_versions_276b2795b1c6a219: function(arg0) {
|
|
309
|
+
const ret = arg0.versions;
|
|
310
|
+
return ret;
|
|
311
|
+
},
|
|
312
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
313
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
314
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
315
|
+
return ret;
|
|
316
|
+
},
|
|
317
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
318
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
319
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
320
|
+
return ret;
|
|
321
|
+
},
|
|
322
|
+
__wbindgen_init_externref_table: function() {
|
|
323
|
+
const table = wasm.__wbindgen_externrefs;
|
|
324
|
+
const offset = table.grow(4);
|
|
325
|
+
table.set(0, undefined);
|
|
326
|
+
table.set(offset + 0, undefined);
|
|
327
|
+
table.set(offset + 1, null);
|
|
328
|
+
table.set(offset + 2, true);
|
|
329
|
+
table.set(offset + 3, false);
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
return {
|
|
333
|
+
__proto__: null,
|
|
334
|
+
"./tessera_bg.js": import0,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const LoginFinishFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
339
|
+
? { register: () => {}, unregister: () => {} }
|
|
340
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_loginfinish_free(ptr, 1));
|
|
341
|
+
const LoginHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
342
|
+
? { register: () => {}, unregister: () => {} }
|
|
343
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_loginhandle_free(ptr, 1));
|
|
344
|
+
const RegistrationFinishFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
345
|
+
? { register: () => {}, unregister: () => {} }
|
|
346
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_registrationfinish_free(ptr, 1));
|
|
347
|
+
const RegistrationHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
348
|
+
? { register: () => {}, unregister: () => {} }
|
|
349
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_registrationhandle_free(ptr, 1));
|
|
350
|
+
|
|
351
|
+
function addToExternrefTable0(obj) {
|
|
352
|
+
const idx = wasm.__externref_table_alloc();
|
|
353
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
354
|
+
return idx;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
358
|
+
ptr = ptr >>> 0;
|
|
359
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function getStringFromWasm0(ptr, len) {
|
|
363
|
+
return decodeText(ptr >>> 0, len);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
let cachedUint8ArrayMemory0 = null;
|
|
367
|
+
function getUint8ArrayMemory0() {
|
|
368
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
369
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
370
|
+
}
|
|
371
|
+
return cachedUint8ArrayMemory0;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function handleError(f, args) {
|
|
375
|
+
try {
|
|
376
|
+
return f.apply(this, args);
|
|
377
|
+
} catch (e) {
|
|
378
|
+
const idx = addToExternrefTable0(e);
|
|
379
|
+
wasm.__wbindgen_exn_store(idx);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function isLikeNone(x) {
|
|
384
|
+
return x === undefined || x === null;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
388
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
389
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
390
|
+
WASM_VECTOR_LEN = arg.length;
|
|
391
|
+
return ptr;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
395
|
+
if (realloc === undefined) {
|
|
396
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
397
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
398
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
399
|
+
WASM_VECTOR_LEN = buf.length;
|
|
400
|
+
return ptr;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
let len = arg.length;
|
|
404
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
405
|
+
|
|
406
|
+
const mem = getUint8ArrayMemory0();
|
|
407
|
+
|
|
408
|
+
let offset = 0;
|
|
409
|
+
|
|
410
|
+
for (; offset < len; offset++) {
|
|
411
|
+
const code = arg.charCodeAt(offset);
|
|
412
|
+
if (code > 0x7F) break;
|
|
413
|
+
mem[ptr + offset] = code;
|
|
414
|
+
}
|
|
415
|
+
if (offset !== len) {
|
|
416
|
+
if (offset !== 0) {
|
|
417
|
+
arg = arg.slice(offset);
|
|
418
|
+
}
|
|
419
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
420
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
421
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
422
|
+
|
|
423
|
+
offset += ret.written;
|
|
424
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
WASM_VECTOR_LEN = offset;
|
|
428
|
+
return ptr;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
function takeFromExternrefTable0(idx) {
|
|
432
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
433
|
+
wasm.__externref_table_dealloc(idx);
|
|
434
|
+
return value;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
438
|
+
cachedTextDecoder.decode();
|
|
439
|
+
function decodeText(ptr, len) {
|
|
440
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
const cachedTextEncoder = new TextEncoder();
|
|
444
|
+
|
|
445
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
446
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
447
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
448
|
+
view.set(buf);
|
|
449
|
+
return {
|
|
450
|
+
read: arg.length,
|
|
451
|
+
written: buf.length
|
|
452
|
+
};
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
let WASM_VECTOR_LEN = 0;
|
|
457
|
+
|
|
458
|
+
const wasmPath = `${__dirname}/tessera_bg.wasm`;
|
|
459
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
460
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
461
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
462
|
+
let wasm = wasmInstance.exports;
|
|
463
|
+
wasm.__wbindgen_start();
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_loginfinish_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_loginhandle_free: (a: number, b: number) => void;
|
|
6
|
+
export const __wbg_registrationfinish_free: (a: number, b: number) => void;
|
|
7
|
+
export const __wbg_registrationhandle_free: (a: number, b: number) => void;
|
|
8
|
+
export const blindIndex: (a: number, b: number) => [number, number, number, number];
|
|
9
|
+
export const loginfinish_exportKey: (a: number) => [number, number];
|
|
10
|
+
export const loginfinish_finalization: (a: number) => [number, number];
|
|
11
|
+
export const loginfinish_sessionKey: (a: number) => [number, number];
|
|
12
|
+
export const loginhandle_finish: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
13
|
+
export const loginhandle_new: (a: number, b: number) => [number, number, number];
|
|
14
|
+
export const loginhandle_request: (a: number) => [number, number];
|
|
15
|
+
export const registrationfinish_exportKey: (a: number) => [number, number];
|
|
16
|
+
export const registrationfinish_upload: (a: number) => [number, number];
|
|
17
|
+
export const registrationhandle_finish: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
18
|
+
export const registrationhandle_new: (a: number, b: number) => [number, number, number];
|
|
19
|
+
export const registrationhandle_request: (a: number) => [number, number];
|
|
20
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
21
|
+
export const __externref_table_alloc: () => number;
|
|
22
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
23
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
24
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
25
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
26
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
27
|
+
export const __wbindgen_start: () => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tessera-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"files": [
|
|
7
|
+
"tessera_bg.wasm",
|
|
8
|
+
"tessera.js",
|
|
9
|
+
"tessera.d.ts"
|
|
10
|
+
],
|
|
11
|
+
"main": "tessera.js",
|
|
12
|
+
"types": "tessera.d.ts",
|
|
13
|
+
"sideEffects": [
|
|
14
|
+
"./snippets/*"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class LoginFinish {
|
|
5
|
+
private constructor();
|
|
6
|
+
free(): void;
|
|
7
|
+
[Symbol.dispose](): void;
|
|
8
|
+
readonly exportKey: Uint8Array;
|
|
9
|
+
readonly finalization: Uint8Array;
|
|
10
|
+
readonly sessionKey: Uint8Array;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class LoginHandle {
|
|
14
|
+
free(): void;
|
|
15
|
+
[Symbol.dispose](): void;
|
|
16
|
+
/**
|
|
17
|
+
* Finish login (single-use). Returns finalization (relay), session_key, export_key (CLIENT-ONLY).
|
|
18
|
+
*/
|
|
19
|
+
finish(password: Uint8Array, response: Uint8Array): LoginFinish;
|
|
20
|
+
constructor(password: Uint8Array);
|
|
21
|
+
readonly request: Uint8Array;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class RegistrationFinish {
|
|
25
|
+
private constructor();
|
|
26
|
+
free(): void;
|
|
27
|
+
[Symbol.dispose](): void;
|
|
28
|
+
readonly exportKey: Uint8Array;
|
|
29
|
+
readonly upload: Uint8Array;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class RegistrationHandle {
|
|
33
|
+
free(): void;
|
|
34
|
+
[Symbol.dispose](): void;
|
|
35
|
+
/**
|
|
36
|
+
* Finish registration. Consumes the handle's state (single-use; a second call errors). Returns
|
|
37
|
+
* the upload to relay and the 64-byte export_key (CLIENT-ONLY — caller must never transmit it).
|
|
38
|
+
*/
|
|
39
|
+
finish(password: Uint8Array, response: Uint8Array): RegistrationFinish;
|
|
40
|
+
/**
|
|
41
|
+
* Start registration from a password. `request` carries the RegistrationRequest to relay.
|
|
42
|
+
*/
|
|
43
|
+
constructor(password: Uint8Array);
|
|
44
|
+
readonly request: Uint8Array;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Derive the 32-byte blind index from an email. The params/normalization/salt live in the core
|
|
49
|
+
* crate (`tessera::blind_index`) as the single source of truth; this is a thin binding.
|
|
50
|
+
*/
|
|
51
|
+
export function blindIndex(email: string): Uint8Array;
|
|
52
|
+
|
|
53
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
54
|
+
|
|
55
|
+
export interface InitOutput {
|
|
56
|
+
readonly memory: WebAssembly.Memory;
|
|
57
|
+
readonly __wbg_loginfinish_free: (a: number, b: number) => void;
|
|
58
|
+
readonly __wbg_loginhandle_free: (a: number, b: number) => void;
|
|
59
|
+
readonly __wbg_registrationfinish_free: (a: number, b: number) => void;
|
|
60
|
+
readonly __wbg_registrationhandle_free: (a: number, b: number) => void;
|
|
61
|
+
readonly blindIndex: (a: number, b: number) => [number, number, number, number];
|
|
62
|
+
readonly loginfinish_exportKey: (a: number) => [number, number];
|
|
63
|
+
readonly loginfinish_finalization: (a: number) => [number, number];
|
|
64
|
+
readonly loginfinish_sessionKey: (a: number) => [number, number];
|
|
65
|
+
readonly loginhandle_finish: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
66
|
+
readonly loginhandle_new: (a: number, b: number) => [number, number, number];
|
|
67
|
+
readonly loginhandle_request: (a: number) => [number, number];
|
|
68
|
+
readonly registrationfinish_exportKey: (a: number) => [number, number];
|
|
69
|
+
readonly registrationfinish_upload: (a: number) => [number, number];
|
|
70
|
+
readonly registrationhandle_finish: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
71
|
+
readonly registrationhandle_new: (a: number, b: number) => [number, number, number];
|
|
72
|
+
readonly registrationhandle_request: (a: number) => [number, number];
|
|
73
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
74
|
+
readonly __externref_table_alloc: () => number;
|
|
75
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
76
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
77
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
78
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
79
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
80
|
+
readonly __wbindgen_start: () => void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
87
|
+
* a precompiled `WebAssembly.Module`.
|
|
88
|
+
*
|
|
89
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
90
|
+
*
|
|
91
|
+
* @returns {InitOutput}
|
|
92
|
+
*/
|
|
93
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
97
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
98
|
+
*
|
|
99
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
100
|
+
*
|
|
101
|
+
* @returns {Promise<InitOutput>}
|
|
102
|
+
*/
|
|
103
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|