@bitwarden/sdk-internal 0.2.0-main.7 → 0.2.0-main.9
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/bitwarden_wasm_internal.d.ts +40 -1
- package/bitwarden_wasm_internal_bg.js +159 -97
- package/bitwarden_wasm_internal_bg.wasm +0 -0
- package/bitwarden_wasm_internal_bg.wasm.d.ts +7 -4
- package/bitwarden_wasm_internal_bg.wasm.js +1 -1
- package/node/bitwarden_wasm_internal.d.ts +40 -1
- package/node/bitwarden_wasm_internal.js +158 -96
- package/node/bitwarden_wasm_internal_bg.wasm +0 -0
- package/node/bitwarden_wasm_internal_bg.wasm.d.ts +7 -4
- package/package.json +1 -1
@@ -51,6 +51,38 @@ export interface InitOrgCryptoRequest {
|
|
51
51
|
organizationKeys: Map<Uuid, AsymmetricEncString>;
|
52
52
|
}
|
53
53
|
|
54
|
+
export interface CoreError extends Error {
|
55
|
+
name: "CoreError";
|
56
|
+
variant:
|
57
|
+
| "MissingFieldError"
|
58
|
+
| "VaultLocked"
|
59
|
+
| "NotAuthenticated"
|
60
|
+
| "AccessTokenInvalid"
|
61
|
+
| "InvalidResponse"
|
62
|
+
| "Crypto"
|
63
|
+
| "IdentityFail"
|
64
|
+
| "Reqwest"
|
65
|
+
| "Serde"
|
66
|
+
| "Io"
|
67
|
+
| "InvalidBase64"
|
68
|
+
| "Chrono"
|
69
|
+
| "ResponseContent"
|
70
|
+
| "ValidationError"
|
71
|
+
| "InvalidStateFileVersion"
|
72
|
+
| "InvalidStateFile"
|
73
|
+
| "Internal"
|
74
|
+
| "EncryptionSettings";
|
75
|
+
}
|
76
|
+
|
77
|
+
export function isCoreError(error: any): error is CoreError;
|
78
|
+
|
79
|
+
export interface EncryptionSettingsError extends Error {
|
80
|
+
name: "EncryptionSettingsError";
|
81
|
+
variant: "Crypto" | "InvalidBase64" | "VaultLocked" | "InvalidPrivateKey" | "MissingPrivateKey";
|
82
|
+
}
|
83
|
+
|
84
|
+
export function isEncryptionSettingsError(error: any): error is EncryptionSettingsError;
|
85
|
+
|
54
86
|
export type DeviceType =
|
55
87
|
| "Android"
|
56
88
|
| "iOS"
|
@@ -141,6 +173,12 @@ export interface FolderView {
|
|
141
173
|
revisionDate: DateTime<Utc>;
|
142
174
|
}
|
143
175
|
|
176
|
+
export interface TestError extends Error {
|
177
|
+
name: "TestError";
|
178
|
+
}
|
179
|
+
|
180
|
+
export function isTestError(error: any): error is TestError;
|
181
|
+
|
144
182
|
export type Uuid = string;
|
145
183
|
|
146
184
|
/**
|
@@ -178,8 +216,9 @@ export class BitwardenClient {
|
|
178
216
|
version(): string;
|
179
217
|
/**
|
180
218
|
* @param {string} msg
|
219
|
+
* @returns {Promise<void>}
|
181
220
|
*/
|
182
|
-
throw(msg: string): void
|
221
|
+
throw(msg: string): Promise<void>;
|
183
222
|
/**
|
184
223
|
* Test method, calls http endpoint
|
185
224
|
* @param {string} url
|
@@ -1,17 +1,11 @@
|
|
1
1
|
let imports = {};
|
2
2
|
imports["__wbindgen_placeholder__"] = module.exports;
|
3
3
|
let wasm;
|
4
|
-
const {
|
4
|
+
const { TextDecoder, TextEncoder } = require(`util`);
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
heap.push(undefined, null, true, false);
|
9
|
-
|
10
|
-
function getObject(idx) {
|
11
|
-
return heap[idx];
|
12
|
-
}
|
6
|
+
let cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
13
7
|
|
14
|
-
|
8
|
+
cachedTextDecoder.decode();
|
15
9
|
|
16
10
|
let cachedUint8ArrayMemory0 = null;
|
17
11
|
|
@@ -22,6 +16,44 @@ function getUint8ArrayMemory0() {
|
|
22
16
|
return cachedUint8ArrayMemory0;
|
23
17
|
}
|
24
18
|
|
19
|
+
function getStringFromWasm0(ptr, len) {
|
20
|
+
ptr = ptr >>> 0;
|
21
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
22
|
+
}
|
23
|
+
|
24
|
+
const heap = new Array(128).fill(undefined);
|
25
|
+
|
26
|
+
heap.push(undefined, null, true, false);
|
27
|
+
|
28
|
+
let heap_next = heap.length;
|
29
|
+
|
30
|
+
function addHeapObject(obj) {
|
31
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
32
|
+
const idx = heap_next;
|
33
|
+
heap_next = heap[idx];
|
34
|
+
|
35
|
+
heap[idx] = obj;
|
36
|
+
return idx;
|
37
|
+
}
|
38
|
+
|
39
|
+
function getObject(idx) {
|
40
|
+
return heap[idx];
|
41
|
+
}
|
42
|
+
|
43
|
+
function dropObject(idx) {
|
44
|
+
if (idx < 132) return;
|
45
|
+
heap[idx] = heap_next;
|
46
|
+
heap_next = idx;
|
47
|
+
}
|
48
|
+
|
49
|
+
function takeObject(idx) {
|
50
|
+
const ret = getObject(idx);
|
51
|
+
dropObject(idx);
|
52
|
+
return ret;
|
53
|
+
}
|
54
|
+
|
55
|
+
let WASM_VECTOR_LEN = 0;
|
56
|
+
|
25
57
|
let cachedTextEncoder = new TextEncoder("utf-8");
|
26
58
|
|
27
59
|
const encodeString =
|
@@ -96,38 +128,6 @@ function getDataViewMemory0() {
|
|
96
128
|
return cachedDataViewMemory0;
|
97
129
|
}
|
98
130
|
|
99
|
-
let heap_next = heap.length;
|
100
|
-
|
101
|
-
function dropObject(idx) {
|
102
|
-
if (idx < 132) return;
|
103
|
-
heap[idx] = heap_next;
|
104
|
-
heap_next = idx;
|
105
|
-
}
|
106
|
-
|
107
|
-
function takeObject(idx) {
|
108
|
-
const ret = getObject(idx);
|
109
|
-
dropObject(idx);
|
110
|
-
return ret;
|
111
|
-
}
|
112
|
-
|
113
|
-
function addHeapObject(obj) {
|
114
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
115
|
-
const idx = heap_next;
|
116
|
-
heap_next = heap[idx];
|
117
|
-
|
118
|
-
heap[idx] = obj;
|
119
|
-
return idx;
|
120
|
-
}
|
121
|
-
|
122
|
-
let cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
123
|
-
|
124
|
-
cachedTextDecoder.decode();
|
125
|
-
|
126
|
-
function getStringFromWasm0(ptr, len) {
|
127
|
-
ptr = ptr >>> 0;
|
128
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
129
|
-
}
|
130
|
-
|
131
131
|
function debugString(val) {
|
132
132
|
// primitive types
|
133
133
|
const type = typeof val;
|
@@ -225,13 +225,59 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
225
225
|
return real;
|
226
226
|
}
|
227
227
|
function __wbg_adapter_38(arg0, arg1, arg2) {
|
228
|
-
wasm.
|
228
|
+
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hcab43b83560065d8(
|
229
229
|
arg0,
|
230
230
|
arg1,
|
231
231
|
addHeapObject(arg2),
|
232
232
|
);
|
233
233
|
}
|
234
234
|
|
235
|
+
let stack_pointer = 128;
|
236
|
+
|
237
|
+
function addBorrowedObject(obj) {
|
238
|
+
if (stack_pointer == 1) throw new Error("out of js stack");
|
239
|
+
heap[--stack_pointer] = obj;
|
240
|
+
return stack_pointer;
|
241
|
+
}
|
242
|
+
/**
|
243
|
+
* @param {any} error
|
244
|
+
* @returns {boolean}
|
245
|
+
*/
|
246
|
+
module.exports.isCoreError = function (error) {
|
247
|
+
try {
|
248
|
+
const ret = wasm.isCoreError(addBorrowedObject(error));
|
249
|
+
return ret !== 0;
|
250
|
+
} finally {
|
251
|
+
heap[stack_pointer++] = undefined;
|
252
|
+
}
|
253
|
+
};
|
254
|
+
|
255
|
+
/**
|
256
|
+
* @param {any} error
|
257
|
+
* @returns {boolean}
|
258
|
+
*/
|
259
|
+
module.exports.isEncryptionSettingsError = function (error) {
|
260
|
+
try {
|
261
|
+
const ret = wasm.isEncryptionSettingsError(addBorrowedObject(error));
|
262
|
+
return ret !== 0;
|
263
|
+
} finally {
|
264
|
+
heap[stack_pointer++] = undefined;
|
265
|
+
}
|
266
|
+
};
|
267
|
+
|
268
|
+
/**
|
269
|
+
* @param {any} error
|
270
|
+
* @returns {boolean}
|
271
|
+
*/
|
272
|
+
module.exports.isTestError = function (error) {
|
273
|
+
try {
|
274
|
+
const ret = wasm.isTestError(addBorrowedObject(error));
|
275
|
+
return ret !== 0;
|
276
|
+
} finally {
|
277
|
+
heap[stack_pointer++] = undefined;
|
278
|
+
}
|
279
|
+
};
|
280
|
+
|
235
281
|
function handleError(f, args) {
|
236
282
|
try {
|
237
283
|
return f.apply(this, args);
|
@@ -239,8 +285,8 @@ function handleError(f, args) {
|
|
239
285
|
wasm.__wbindgen_exn_store(addHeapObject(e));
|
240
286
|
}
|
241
287
|
}
|
242
|
-
function
|
243
|
-
wasm.
|
288
|
+
function __wbg_adapter_107(arg0, arg1, arg2, arg3) {
|
289
|
+
wasm.wasm_bindgen__convert__closures__invoke2_mut__h7363c1bfa226a55d(
|
244
290
|
arg0,
|
245
291
|
arg1,
|
246
292
|
addHeapObject(arg2),
|
@@ -339,21 +385,13 @@ class BitwardenClient {
|
|
339
385
|
}
|
340
386
|
/**
|
341
387
|
* @param {string} msg
|
388
|
+
* @returns {Promise<void>}
|
342
389
|
*/
|
343
390
|
throw(msg) {
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
wasm.bitwardenclient_throw(retptr, this.__wbg_ptr, ptr0, len0);
|
349
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
350
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
351
|
-
if (r1) {
|
352
|
-
throw takeObject(r0);
|
353
|
-
}
|
354
|
-
} finally {
|
355
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
356
|
-
}
|
391
|
+
const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
392
|
+
const len0 = WASM_VECTOR_LEN;
|
393
|
+
const ret = wasm.bitwardenclient_throw(this.__wbg_ptr, ptr0, len0);
|
394
|
+
return takeObject(ret);
|
357
395
|
}
|
358
396
|
/**
|
359
397
|
* Test method, calls http endpoint
|
@@ -514,6 +552,59 @@ class ClientVault {
|
|
514
552
|
}
|
515
553
|
module.exports.ClientVault = ClientVault;
|
516
554
|
|
555
|
+
module.exports.__wbg_new_fe19e4f3db5c3999 = function (arg0, arg1) {
|
556
|
+
let deferred0_0;
|
557
|
+
let deferred0_1;
|
558
|
+
try {
|
559
|
+
deferred0_0 = arg0;
|
560
|
+
deferred0_1 = arg1;
|
561
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
562
|
+
return addHeapObject(ret);
|
563
|
+
} finally {
|
564
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
565
|
+
}
|
566
|
+
};
|
567
|
+
|
568
|
+
module.exports.__wbg_setname_46d623c31ae39910 = function (arg0, arg1, arg2) {
|
569
|
+
let deferred0_0;
|
570
|
+
let deferred0_1;
|
571
|
+
try {
|
572
|
+
deferred0_0 = arg1;
|
573
|
+
deferred0_1 = arg2;
|
574
|
+
getObject(arg0).name = getStringFromWasm0(arg1, arg2);
|
575
|
+
} finally {
|
576
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
577
|
+
}
|
578
|
+
};
|
579
|
+
|
580
|
+
module.exports.__wbg_setvariant_262a12673324f71b = function (arg0, arg1, arg2) {
|
581
|
+
let deferred0_0;
|
582
|
+
let deferred0_1;
|
583
|
+
try {
|
584
|
+
deferred0_0 = arg1;
|
585
|
+
deferred0_1 = arg2;
|
586
|
+
getObject(arg0).variant = getStringFromWasm0(arg1, arg2);
|
587
|
+
} finally {
|
588
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
589
|
+
}
|
590
|
+
};
|
591
|
+
|
592
|
+
module.exports.__wbindgen_string_new = function (arg0, arg1) {
|
593
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
594
|
+
return addHeapObject(ret);
|
595
|
+
};
|
596
|
+
|
597
|
+
module.exports.__wbg_get_ef828680c64da212 = function () {
|
598
|
+
return handleError(function (arg0, arg1) {
|
599
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
600
|
+
return addHeapObject(ret);
|
601
|
+
}, arguments);
|
602
|
+
};
|
603
|
+
|
604
|
+
module.exports.__wbindgen_object_drop_ref = function (arg0) {
|
605
|
+
takeObject(arg0);
|
606
|
+
};
|
607
|
+
|
517
608
|
module.exports.__wbindgen_string_get = function (arg0, arg1) {
|
518
609
|
const obj = getObject(arg1);
|
519
610
|
const ret = typeof obj === "string" ? obj : undefined;
|
@@ -525,10 +616,6 @@ module.exports.__wbindgen_string_get = function (arg0, arg1) {
|
|
525
616
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
526
617
|
};
|
527
618
|
|
528
|
-
module.exports.__wbindgen_object_drop_ref = function (arg0) {
|
529
|
-
takeObject(arg0);
|
530
|
-
};
|
531
|
-
|
532
619
|
module.exports.__wbindgen_is_object = function (arg0) {
|
533
620
|
const val = getObject(arg0);
|
534
621
|
const ret = typeof val === "object" && val !== null;
|
@@ -580,6 +667,13 @@ module.exports.__wbg_get_5419cf6b954aa11d = function (arg0, arg1) {
|
|
580
667
|
return addHeapObject(ret);
|
581
668
|
};
|
582
669
|
|
670
|
+
module.exports.__wbg_call_3bfa248576352471 = function () {
|
671
|
+
return handleError(function (arg0, arg1, arg2) {
|
672
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
673
|
+
return addHeapObject(ret);
|
674
|
+
}, arguments);
|
675
|
+
};
|
676
|
+
|
583
677
|
module.exports.__wbindgen_object_clone_ref = function (arg0) {
|
584
678
|
const ret = getObject(arg0);
|
585
679
|
return addHeapObject(ret);
|
@@ -602,26 +696,6 @@ module.exports.__wbg_value_2ab8a198c834c26a = function (arg0) {
|
|
602
696
|
return addHeapObject(ret);
|
603
697
|
};
|
604
698
|
|
605
|
-
module.exports.__wbg_new_dd011eb1c3a5a053 = function (arg0, arg1) {
|
606
|
-
let deferred0_0;
|
607
|
-
let deferred0_1;
|
608
|
-
try {
|
609
|
-
deferred0_0 = arg0;
|
610
|
-
deferred0_1 = arg1;
|
611
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
612
|
-
return addHeapObject(ret);
|
613
|
-
} finally {
|
614
|
-
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
615
|
-
}
|
616
|
-
};
|
617
|
-
|
618
|
-
module.exports.__wbg_call_3bfa248576352471 = function () {
|
619
|
-
return handleError(function (arg0, arg1, arg2) {
|
620
|
-
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
621
|
-
return addHeapObject(ret);
|
622
|
-
}, arguments);
|
623
|
-
};
|
624
|
-
|
625
699
|
module.exports.__wbg_new_e69b5f66fda8f13c = function () {
|
626
700
|
const ret = new Object();
|
627
701
|
return addHeapObject(ret);
|
@@ -716,11 +790,6 @@ module.exports.__wbg_text_ebeee8b31af4c919 = function () {
|
|
716
790
|
}, arguments);
|
717
791
|
};
|
718
792
|
|
719
|
-
module.exports.__wbindgen_string_new = function (arg0, arg1) {
|
720
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
721
|
-
return addHeapObject(ret);
|
722
|
-
};
|
723
|
-
|
724
793
|
module.exports.__wbindgen_jsval_loose_eq = function (arg0, arg1) {
|
725
794
|
const ret = getObject(arg0) == getObject(arg1);
|
726
795
|
return ret;
|
@@ -748,7 +817,7 @@ module.exports.__wbg_new_1073970097e5a420 = function (arg0, arg1) {
|
|
748
817
|
const a = state0.a;
|
749
818
|
state0.a = 0;
|
750
819
|
try {
|
751
|
-
return
|
820
|
+
return __wbg_adapter_107(a, state0.b, arg0, arg1);
|
752
821
|
} finally {
|
753
822
|
state0.a = a;
|
754
823
|
}
|
@@ -834,13 +903,6 @@ module.exports.__wbg_iterator_695d699a44d6234c = function () {
|
|
834
903
|
return addHeapObject(ret);
|
835
904
|
};
|
836
905
|
|
837
|
-
module.exports.__wbg_get_ef828680c64da212 = function () {
|
838
|
-
return handleError(function (arg0, arg1) {
|
839
|
-
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
840
|
-
return addHeapObject(ret);
|
841
|
-
}, arguments);
|
842
|
-
};
|
843
|
-
|
844
906
|
module.exports.__wbindgen_is_function = function (arg0) {
|
845
907
|
const ret = typeof getObject(arg0) === "function";
|
846
908
|
return ret;
|
@@ -1065,8 +1127,8 @@ module.exports.__wbg_warn_2e2787d40aad9a81 = function (arg0, arg1, arg2, arg3) {
|
|
1065
1127
|
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
1066
1128
|
};
|
1067
1129
|
|
1068
|
-
module.exports.
|
1069
|
-
const ret = makeMutClosure(arg0, arg1,
|
1130
|
+
module.exports.__wbindgen_closure_wrapper1630 = function (arg0, arg1, arg2) {
|
1131
|
+
const ret = makeMutClosure(arg0, arg1, 434, __wbg_adapter_38);
|
1070
1132
|
return addHeapObject(ret);
|
1071
1133
|
};
|
1072
1134
|
|
Binary file
|
@@ -1,13 +1,16 @@
|
|
1
1
|
/* tslint:disable */
|
2
2
|
/* eslint-disable */
|
3
3
|
export const memory: WebAssembly.Memory;
|
4
|
+
export function isCoreError(a: number): number;
|
5
|
+
export function isEncryptionSettingsError(a: number): number;
|
4
6
|
export function __wbg_bitwardenclient_free(a: number, b: number): void;
|
5
7
|
export function bitwardenclient_new(a: number, b: number): number;
|
6
8
|
export function bitwardenclient_echo(a: number, b: number, c: number, d: number): void;
|
7
9
|
export function bitwardenclient_version(a: number, b: number): void;
|
8
|
-
export function bitwardenclient_throw(a: number, b: number, c: number
|
10
|
+
export function bitwardenclient_throw(a: number, b: number, c: number): number;
|
9
11
|
export function bitwardenclient_http_get(a: number, b: number, c: number): number;
|
10
12
|
export function bitwardenclient_crypto(a: number): number;
|
13
|
+
export function isTestError(a: number): number;
|
11
14
|
export function clientcrypto_initialize_user_crypto(a: number, b: number): number;
|
12
15
|
export function clientcrypto_initialize_org_crypto(a: number, b: number): number;
|
13
16
|
export function clientfolders_decrypt(a: number, b: number, c: number): void;
|
@@ -19,15 +22,15 @@ export function clientvault_folders(a: number): number;
|
|
19
22
|
export function __wbindgen_malloc(a: number, b: number): number;
|
20
23
|
export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
|
21
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
22
|
-
export function
|
25
|
+
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hcab43b83560065d8(
|
23
26
|
a: number,
|
24
27
|
b: number,
|
25
28
|
c: number,
|
26
29
|
): void;
|
27
|
-
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
28
30
|
export function __wbindgen_free(a: number, b: number, c: number): void;
|
31
|
+
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
29
32
|
export function __wbindgen_exn_store(a: number): void;
|
30
|
-
export function
|
33
|
+
export function wasm_bindgen__convert__closures__invoke2_mut__h7363c1bfa226a55d(
|
31
34
|
a: number,
|
32
35
|
b: number,
|
33
36
|
c: number,
|