@bitwarden/sdk-internal 0.2.0-main.269 → 0.2.0-main.270
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/VERSION +1 -1
- package/bitwarden_wasm_internal.d.ts +38 -2
- package/bitwarden_wasm_internal_bg.js +114 -29
- package/bitwarden_wasm_internal_bg.wasm +0 -0
- package/bitwarden_wasm_internal_bg.wasm.d.ts +14 -0
- package/bitwarden_wasm_internal_bg.wasm.js +1 -1
- package/node/bitwarden_wasm_internal.d.ts +38 -2
- package/node/bitwarden_wasm_internal.js +114 -29
- package/node/bitwarden_wasm_internal_bg.wasm +0 -0
- package/node/bitwarden_wasm_internal_bg.wasm.d.ts +14 -0
- package/package.json +1 -1
package/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
ae9b9f170976b674af2973c94ccbe772d37d3c0e
|
@@ -256,6 +256,7 @@ export type InitUserCryptoMethod =
|
|
256
256
|
| { password: { password: string; user_key: EncString } }
|
257
257
|
| { decryptedKey: { decrypted_user_key: string } }
|
258
258
|
| { pin: { pin: string; pin_protected_user_key: EncString } }
|
259
|
+
| { pinEnvelope: { pin: string; pin_protected_user_key_envelope: PasswordProtectedKeyEnvelope } }
|
259
260
|
| { authRequest: { request_private_key: B64; method: AuthRequestMethod } }
|
260
261
|
| {
|
261
262
|
deviceKey: {
|
@@ -297,6 +298,20 @@ export interface UpdatePasswordResponse {
|
|
297
298
|
newKey: EncString;
|
298
299
|
}
|
299
300
|
|
301
|
+
/**
|
302
|
+
* Request for deriving a pin protected user key
|
303
|
+
*/
|
304
|
+
export interface EnrollPinResponse {
|
305
|
+
/**
|
306
|
+
* [UserKey] protected by PIN
|
307
|
+
*/
|
308
|
+
pinProtectedUserKeyEnvelope: PasswordProtectedKeyEnvelope;
|
309
|
+
/**
|
310
|
+
* PIN protected by [UserKey]
|
311
|
+
*/
|
312
|
+
userKeyEncryptedPin: EncString;
|
313
|
+
}
|
314
|
+
|
300
315
|
/**
|
301
316
|
* Request for deriving a pin protected user key
|
302
317
|
*/
|
@@ -450,7 +465,7 @@ export function isEnrollAdminPasswordResetError(error: any): error is EnrollAdmi
|
|
450
465
|
|
451
466
|
export interface CryptoClientError extends Error {
|
452
467
|
name: "CryptoClientError";
|
453
|
-
variant: "NotAuthenticated" | "VaultLocked" | "Crypto";
|
468
|
+
variant: "NotAuthenticated" | "VaultLocked" | "Crypto" | "PasswordProtectedKeyEnvelope";
|
454
469
|
}
|
455
470
|
|
456
471
|
export function isCryptoClientError(error: any): error is CryptoClientError;
|
@@ -471,7 +486,8 @@ export interface EncryptionSettingsError extends Error {
|
|
471
486
|
| "InvalidSigningKey"
|
472
487
|
| "InvalidSecurityState"
|
473
488
|
| "MissingPrivateKey"
|
474
|
-
| "UserIdAlreadySetError"
|
489
|
+
| "UserIdAlreadySetError"
|
490
|
+
| "WrongPin";
|
475
491
|
}
|
476
492
|
|
477
493
|
export function isEncryptionSettingsError(error: any): error is EncryptionSettingsError;
|
@@ -1544,6 +1560,26 @@ export class CryptoClient {
|
|
1544
1560
|
* Creates a rotated set of account keys for the current state
|
1545
1561
|
*/
|
1546
1562
|
get_v2_rotated_account_keys(): UserCryptoV2KeysResponse;
|
1563
|
+
/**
|
1564
|
+
* Protects the current user key with the provided PIN. The result can be stored and later
|
1565
|
+
* used to initialize another client instance by using the PIN and the PIN key with
|
1566
|
+
* `initialize_user_crypto`.
|
1567
|
+
*/
|
1568
|
+
enroll_pin(pin: string): EnrollPinResponse;
|
1569
|
+
/**
|
1570
|
+
* Protects the current user key with the provided PIN. The result can be stored and later
|
1571
|
+
* used to initialize another client instance by using the PIN and the PIN key with
|
1572
|
+
* `initialize_user_crypto`. The provided pin is encrypted with the user key.
|
1573
|
+
*/
|
1574
|
+
enroll_pin_with_encrypted_pin(encrypted_pin: string): EnrollPinResponse;
|
1575
|
+
/**
|
1576
|
+
* Decrypts a `PasswordProtectedKeyEnvelope`, returning the user key, if successful.
|
1577
|
+
* This is a stop-gap solution, until initialization of the SDK is used.
|
1578
|
+
*/
|
1579
|
+
unseal_password_protected_key_envelope(
|
1580
|
+
pin: string,
|
1581
|
+
envelope: PasswordProtectedKeyEnvelope,
|
1582
|
+
): Uint8Array;
|
1547
1583
|
}
|
1548
1584
|
export class ExporterClient {
|
1549
1585
|
private constructor();
|
@@ -809,7 +809,7 @@ function __wbg_adapter_59(arg0, arg1, arg2) {
|
|
809
809
|
);
|
810
810
|
}
|
811
811
|
|
812
|
-
function
|
812
|
+
function __wbg_adapter_326(arg0, arg1, arg2, arg3) {
|
813
813
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h54a8613170fef18e(
|
814
814
|
arg0,
|
815
815
|
arg1,
|
@@ -1824,6 +1824,91 @@ export class CryptoClient {
|
|
1824
1824
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
1825
1825
|
}
|
1826
1826
|
}
|
1827
|
+
/**
|
1828
|
+
* Protects the current user key with the provided PIN. The result can be stored and later
|
1829
|
+
* used to initialize another client instance by using the PIN and the PIN key with
|
1830
|
+
* `initialize_user_crypto`.
|
1831
|
+
* @param {string} pin
|
1832
|
+
* @returns {EnrollPinResponse}
|
1833
|
+
*/
|
1834
|
+
enroll_pin(pin) {
|
1835
|
+
try {
|
1836
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
1837
|
+
const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
1838
|
+
const len0 = WASM_VECTOR_LEN;
|
1839
|
+
wasm.cryptoclient_enroll_pin(retptr, this.__wbg_ptr, ptr0, len0);
|
1840
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
1841
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
1842
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
1843
|
+
if (r2) {
|
1844
|
+
throw takeObject(r1);
|
1845
|
+
}
|
1846
|
+
return takeObject(r0);
|
1847
|
+
} finally {
|
1848
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
1849
|
+
}
|
1850
|
+
}
|
1851
|
+
/**
|
1852
|
+
* Protects the current user key with the provided PIN. The result can be stored and later
|
1853
|
+
* used to initialize another client instance by using the PIN and the PIN key with
|
1854
|
+
* `initialize_user_crypto`. The provided pin is encrypted with the user key.
|
1855
|
+
* @param {string} encrypted_pin
|
1856
|
+
* @returns {EnrollPinResponse}
|
1857
|
+
*/
|
1858
|
+
enroll_pin_with_encrypted_pin(encrypted_pin) {
|
1859
|
+
try {
|
1860
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
1861
|
+
const ptr0 = passStringToWasm0(
|
1862
|
+
encrypted_pin,
|
1863
|
+
wasm.__wbindgen_malloc,
|
1864
|
+
wasm.__wbindgen_realloc,
|
1865
|
+
);
|
1866
|
+
const len0 = WASM_VECTOR_LEN;
|
1867
|
+
wasm.cryptoclient_enroll_pin_with_encrypted_pin(retptr, this.__wbg_ptr, ptr0, len0);
|
1868
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
1869
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
1870
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
1871
|
+
if (r2) {
|
1872
|
+
throw takeObject(r1);
|
1873
|
+
}
|
1874
|
+
return takeObject(r0);
|
1875
|
+
} finally {
|
1876
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
1877
|
+
}
|
1878
|
+
}
|
1879
|
+
/**
|
1880
|
+
* Decrypts a `PasswordProtectedKeyEnvelope`, returning the user key, if successful.
|
1881
|
+
* This is a stop-gap solution, until initialization of the SDK is used.
|
1882
|
+
* @param {string} pin
|
1883
|
+
* @param {PasswordProtectedKeyEnvelope} envelope
|
1884
|
+
* @returns {Uint8Array}
|
1885
|
+
*/
|
1886
|
+
unseal_password_protected_key_envelope(pin, envelope) {
|
1887
|
+
try {
|
1888
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
1889
|
+
const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
1890
|
+
const len0 = WASM_VECTOR_LEN;
|
1891
|
+
wasm.cryptoclient_unseal_password_protected_key_envelope(
|
1892
|
+
retptr,
|
1893
|
+
this.__wbg_ptr,
|
1894
|
+
ptr0,
|
1895
|
+
len0,
|
1896
|
+
addHeapObject(envelope),
|
1897
|
+
);
|
1898
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
1899
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
1900
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
1901
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
1902
|
+
if (r3) {
|
1903
|
+
throw takeObject(r2);
|
1904
|
+
}
|
1905
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
1906
|
+
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
1907
|
+
return v2;
|
1908
|
+
} finally {
|
1909
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
1910
|
+
}
|
1911
|
+
}
|
1827
1912
|
}
|
1828
1913
|
|
1829
1914
|
const ExporterClientFinalization =
|
@@ -3889,7 +3974,7 @@ export function __wbg_getTime_46267b1c24877e30(arg0) {
|
|
3889
3974
|
return ret;
|
3890
3975
|
}
|
3891
3976
|
|
3892
|
-
export function
|
3977
|
+
export function __wbg_get_115b852a26d2e64d() {
|
3893
3978
|
return handleError(function (arg0, arg1, arg2) {
|
3894
3979
|
let deferred0_0;
|
3895
3980
|
let deferred0_1;
|
@@ -3904,7 +3989,7 @@ export function __wbg_get_31aa32a26748ec8a() {
|
|
3904
3989
|
}, arguments);
|
3905
3990
|
}
|
3906
3991
|
|
3907
|
-
export function
|
3992
|
+
export function __wbg_get_2ee0fd323259abbb() {
|
3908
3993
|
return handleError(function (arg0, arg1, arg2) {
|
3909
3994
|
let deferred0_0;
|
3910
3995
|
let deferred0_1;
|
@@ -3931,7 +4016,7 @@ export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
|
|
3931
4016
|
return addHeapObject(ret);
|
3932
4017
|
}
|
3933
4018
|
|
3934
|
-
export function
|
4019
|
+
export function __wbg_getaccesstoken_f392c183f29e9890(arg0) {
|
3935
4020
|
const ret = getObject(arg0).get_access_token();
|
3936
4021
|
return addHeapObject(ret);
|
3937
4022
|
}
|
@@ -4036,14 +4121,14 @@ export function __wbg_length_e2d2a49132c1b256(arg0) {
|
|
4036
4121
|
return ret;
|
4037
4122
|
}
|
4038
4123
|
|
4039
|
-
export function
|
4124
|
+
export function __wbg_list_89cca7d490a44d70() {
|
4040
4125
|
return handleError(function (arg0) {
|
4041
4126
|
const ret = getObject(arg0).list();
|
4042
4127
|
return addHeapObject(ret);
|
4043
4128
|
}, arguments);
|
4044
4129
|
}
|
4045
4130
|
|
4046
|
-
export function
|
4131
|
+
export function __wbg_list_8b4750ec86e7901c() {
|
4047
4132
|
return handleError(function (arg0) {
|
4048
4133
|
const ret = getObject(arg0).list();
|
4049
4134
|
return addHeapObject(ret);
|
@@ -4078,7 +4163,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
|
|
4078
4163
|
const a = state0.a;
|
4079
4164
|
state0.a = 0;
|
4080
4165
|
try {
|
4081
|
-
return
|
4166
|
+
return __wbg_adapter_326(a, state0.b, arg0, arg1);
|
4082
4167
|
} finally {
|
4083
4168
|
state0.a = a;
|
4084
4169
|
}
|
@@ -4225,7 +4310,7 @@ export function __wbg_randomFillSync_ac0988aba3254290() {
|
|
4225
4310
|
}, arguments);
|
4226
4311
|
}
|
4227
4312
|
|
4228
|
-
export function
|
4313
|
+
export function __wbg_remove_5d18d5e69e5b9e97() {
|
4229
4314
|
return handleError(function (arg0, arg1, arg2) {
|
4230
4315
|
let deferred0_0;
|
4231
4316
|
let deferred0_1;
|
@@ -4240,7 +4325,7 @@ export function __wbg_remove_3129bda82100f0a2() {
|
|
4240
4325
|
}, arguments);
|
4241
4326
|
}
|
4242
4327
|
|
4243
|
-
export function
|
4328
|
+
export function __wbg_remove_ae7f64be8e4b3d4b() {
|
4244
4329
|
return handleError(function (arg0, arg1, arg2) {
|
4245
4330
|
let deferred0_0;
|
4246
4331
|
let deferred0_1;
|
@@ -4279,19 +4364,7 @@ export function __wbg_setTimeout_ca12ead8b48245e2(arg0, arg1) {
|
|
4279
4364
|
return addHeapObject(ret);
|
4280
4365
|
}
|
4281
4366
|
|
4282
|
-
export function
|
4283
|
-
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
4284
|
-
}
|
4285
|
-
|
4286
|
-
export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
|
4287
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
4288
|
-
}
|
4289
|
-
|
4290
|
-
export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
|
4291
|
-
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
4292
|
-
}
|
4293
|
-
|
4294
|
-
export function __wbg_set_8394acfd3cac67a4() {
|
4367
|
+
export function __wbg_set_1428084fdb396fcc() {
|
4295
4368
|
return handleError(function (arg0, arg1, arg2, arg3) {
|
4296
4369
|
let deferred0_0;
|
4297
4370
|
let deferred0_1;
|
@@ -4306,12 +4379,24 @@ export function __wbg_set_8394acfd3cac67a4() {
|
|
4306
4379
|
}, arguments);
|
4307
4380
|
}
|
4308
4381
|
|
4382
|
+
export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
|
4383
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
4384
|
+
}
|
4385
|
+
|
4386
|
+
export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
|
4387
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
4388
|
+
}
|
4389
|
+
|
4390
|
+
export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
|
4391
|
+
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
4392
|
+
}
|
4393
|
+
|
4309
4394
|
export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
|
4310
4395
|
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
4311
4396
|
return addHeapObject(ret);
|
4312
4397
|
}
|
4313
4398
|
|
4314
|
-
export function
|
4399
|
+
export function __wbg_set_ecd2eed98800a72b() {
|
4315
4400
|
return handleError(function (arg0, arg1, arg2, arg3) {
|
4316
4401
|
let deferred0_0;
|
4317
4402
|
let deferred0_1;
|
@@ -4514,18 +4599,18 @@ export function __wbindgen_cb_drop(arg0) {
|
|
4514
4599
|
return ret;
|
4515
4600
|
}
|
4516
4601
|
|
4517
|
-
export function
|
4518
|
-
const ret = makeMutClosure(arg0, arg1,
|
4602
|
+
export function __wbindgen_closure_wrapper3386(arg0, arg1, arg2) {
|
4603
|
+
const ret = makeMutClosure(arg0, arg1, 278, __wbg_adapter_54);
|
4519
4604
|
return addHeapObject(ret);
|
4520
4605
|
}
|
4521
4606
|
|
4522
|
-
export function
|
4523
|
-
const ret = makeMutClosure(arg0, arg1,
|
4607
|
+
export function __wbindgen_closure_wrapper5756(arg0, arg1, arg2) {
|
4608
|
+
const ret = makeMutClosure(arg0, arg1, 303, __wbg_adapter_54);
|
4524
4609
|
return addHeapObject(ret);
|
4525
4610
|
}
|
4526
4611
|
|
4527
|
-
export function
|
4528
|
-
const ret = makeMutClosure(arg0, arg1,
|
4612
|
+
export function __wbindgen_closure_wrapper6111(arg0, arg1, arg2) {
|
4613
|
+
const ret = makeMutClosure(arg0, arg1, 328, __wbg_adapter_59);
|
4529
4614
|
return addHeapObject(ret);
|
4530
4615
|
}
|
4531
4616
|
|
Binary file
|
@@ -186,6 +186,20 @@ export const cryptoclient_make_key_pair: (a: number, b: number, c: number) => vo
|
|
186
186
|
export const cryptoclient_verify_asymmetric_keys: (a: number, b: number, c: number) => void;
|
187
187
|
export const cryptoclient_make_keys_for_user_crypto_v2: (a: number, b: number) => void;
|
188
188
|
export const cryptoclient_get_v2_rotated_account_keys: (a: number, b: number) => void;
|
189
|
+
export const cryptoclient_enroll_pin: (a: number, b: number, c: number, d: number) => void;
|
190
|
+
export const cryptoclient_enroll_pin_with_encrypted_pin: (
|
191
|
+
a: number,
|
192
|
+
b: number,
|
193
|
+
c: number,
|
194
|
+
d: number,
|
195
|
+
) => void;
|
196
|
+
export const cryptoclient_unseal_password_protected_key_envelope: (
|
197
|
+
a: number,
|
198
|
+
b: number,
|
199
|
+
c: number,
|
200
|
+
d: number,
|
201
|
+
e: number,
|
202
|
+
) => void;
|
189
203
|
export const isDeriveKeyConnectorError: (a: number) => number;
|
190
204
|
export const isEnrollAdminPasswordResetError: (a: number) => number;
|
191
205
|
export const isCryptoClientError: (a: number) => number;
|