@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
@@ -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();
|
@@ -803,7 +803,7 @@ function __wbg_adapter_59(arg0, arg1, arg2) {
|
|
803
803
|
);
|
804
804
|
}
|
805
805
|
|
806
|
-
function
|
806
|
+
function __wbg_adapter_326(arg0, arg1, arg2, arg3) {
|
807
807
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h54a8613170fef18e(
|
808
808
|
arg0,
|
809
809
|
arg1,
|
@@ -1825,6 +1825,91 @@ class CryptoClient {
|
|
1825
1825
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
1826
1826
|
}
|
1827
1827
|
}
|
1828
|
+
/**
|
1829
|
+
* Protects the current user key with the provided PIN. The result can be stored and later
|
1830
|
+
* used to initialize another client instance by using the PIN and the PIN key with
|
1831
|
+
* `initialize_user_crypto`.
|
1832
|
+
* @param {string} pin
|
1833
|
+
* @returns {EnrollPinResponse}
|
1834
|
+
*/
|
1835
|
+
enroll_pin(pin) {
|
1836
|
+
try {
|
1837
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
1838
|
+
const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
1839
|
+
const len0 = WASM_VECTOR_LEN;
|
1840
|
+
wasm.cryptoclient_enroll_pin(retptr, this.__wbg_ptr, ptr0, len0);
|
1841
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
1842
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
1843
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
1844
|
+
if (r2) {
|
1845
|
+
throw takeObject(r1);
|
1846
|
+
}
|
1847
|
+
return takeObject(r0);
|
1848
|
+
} finally {
|
1849
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
1850
|
+
}
|
1851
|
+
}
|
1852
|
+
/**
|
1853
|
+
* Protects the current user key with the provided PIN. The result can be stored and later
|
1854
|
+
* used to initialize another client instance by using the PIN and the PIN key with
|
1855
|
+
* `initialize_user_crypto`. The provided pin is encrypted with the user key.
|
1856
|
+
* @param {string} encrypted_pin
|
1857
|
+
* @returns {EnrollPinResponse}
|
1858
|
+
*/
|
1859
|
+
enroll_pin_with_encrypted_pin(encrypted_pin) {
|
1860
|
+
try {
|
1861
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
1862
|
+
const ptr0 = passStringToWasm0(
|
1863
|
+
encrypted_pin,
|
1864
|
+
wasm.__wbindgen_malloc,
|
1865
|
+
wasm.__wbindgen_realloc,
|
1866
|
+
);
|
1867
|
+
const len0 = WASM_VECTOR_LEN;
|
1868
|
+
wasm.cryptoclient_enroll_pin_with_encrypted_pin(retptr, this.__wbg_ptr, ptr0, len0);
|
1869
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
1870
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
1871
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
1872
|
+
if (r2) {
|
1873
|
+
throw takeObject(r1);
|
1874
|
+
}
|
1875
|
+
return takeObject(r0);
|
1876
|
+
} finally {
|
1877
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
1878
|
+
}
|
1879
|
+
}
|
1880
|
+
/**
|
1881
|
+
* Decrypts a `PasswordProtectedKeyEnvelope`, returning the user key, if successful.
|
1882
|
+
* This is a stop-gap solution, until initialization of the SDK is used.
|
1883
|
+
* @param {string} pin
|
1884
|
+
* @param {PasswordProtectedKeyEnvelope} envelope
|
1885
|
+
* @returns {Uint8Array}
|
1886
|
+
*/
|
1887
|
+
unseal_password_protected_key_envelope(pin, envelope) {
|
1888
|
+
try {
|
1889
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
1890
|
+
const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
1891
|
+
const len0 = WASM_VECTOR_LEN;
|
1892
|
+
wasm.cryptoclient_unseal_password_protected_key_envelope(
|
1893
|
+
retptr,
|
1894
|
+
this.__wbg_ptr,
|
1895
|
+
ptr0,
|
1896
|
+
len0,
|
1897
|
+
addHeapObject(envelope),
|
1898
|
+
);
|
1899
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
1900
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
1901
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
1902
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
1903
|
+
if (r3) {
|
1904
|
+
throw takeObject(r2);
|
1905
|
+
}
|
1906
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
1907
|
+
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
1908
|
+
return v2;
|
1909
|
+
} finally {
|
1910
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
1911
|
+
}
|
1912
|
+
}
|
1828
1913
|
}
|
1829
1914
|
module.exports.CryptoClient = CryptoClient;
|
1830
1915
|
|
@@ -3905,7 +3990,7 @@ module.exports.__wbg_getTime_46267b1c24877e30 = function (arg0) {
|
|
3905
3990
|
return ret;
|
3906
3991
|
};
|
3907
3992
|
|
3908
|
-
module.exports.
|
3993
|
+
module.exports.__wbg_get_115b852a26d2e64d = function () {
|
3909
3994
|
return handleError(function (arg0, arg1, arg2) {
|
3910
3995
|
let deferred0_0;
|
3911
3996
|
let deferred0_1;
|
@@ -3920,7 +4005,7 @@ module.exports.__wbg_get_31aa32a26748ec8a = function () {
|
|
3920
4005
|
}, arguments);
|
3921
4006
|
};
|
3922
4007
|
|
3923
|
-
module.exports.
|
4008
|
+
module.exports.__wbg_get_2ee0fd323259abbb = function () {
|
3924
4009
|
return handleError(function (arg0, arg1, arg2) {
|
3925
4010
|
let deferred0_0;
|
3926
4011
|
let deferred0_1;
|
@@ -3947,7 +4032,7 @@ module.exports.__wbg_get_b9b93047fe3cf45b = function (arg0, arg1) {
|
|
3947
4032
|
return addHeapObject(ret);
|
3948
4033
|
};
|
3949
4034
|
|
3950
|
-
module.exports.
|
4035
|
+
module.exports.__wbg_getaccesstoken_f392c183f29e9890 = function (arg0) {
|
3951
4036
|
const ret = getObject(arg0).get_access_token();
|
3952
4037
|
return addHeapObject(ret);
|
3953
4038
|
};
|
@@ -4052,14 +4137,14 @@ module.exports.__wbg_length_e2d2a49132c1b256 = function (arg0) {
|
|
4052
4137
|
return ret;
|
4053
4138
|
};
|
4054
4139
|
|
4055
|
-
module.exports.
|
4140
|
+
module.exports.__wbg_list_89cca7d490a44d70 = function () {
|
4056
4141
|
return handleError(function (arg0) {
|
4057
4142
|
const ret = getObject(arg0).list();
|
4058
4143
|
return addHeapObject(ret);
|
4059
4144
|
}, arguments);
|
4060
4145
|
};
|
4061
4146
|
|
4062
|
-
module.exports.
|
4147
|
+
module.exports.__wbg_list_8b4750ec86e7901c = function () {
|
4063
4148
|
return handleError(function (arg0) {
|
4064
4149
|
const ret = getObject(arg0).list();
|
4065
4150
|
return addHeapObject(ret);
|
@@ -4094,7 +4179,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function (arg0, arg1) {
|
|
4094
4179
|
const a = state0.a;
|
4095
4180
|
state0.a = 0;
|
4096
4181
|
try {
|
4097
|
-
return
|
4182
|
+
return __wbg_adapter_326(a, state0.b, arg0, arg1);
|
4098
4183
|
} finally {
|
4099
4184
|
state0.a = a;
|
4100
4185
|
}
|
@@ -4241,7 +4326,7 @@ module.exports.__wbg_randomFillSync_ac0988aba3254290 = function () {
|
|
4241
4326
|
}, arguments);
|
4242
4327
|
};
|
4243
4328
|
|
4244
|
-
module.exports.
|
4329
|
+
module.exports.__wbg_remove_5d18d5e69e5b9e97 = function () {
|
4245
4330
|
return handleError(function (arg0, arg1, arg2) {
|
4246
4331
|
let deferred0_0;
|
4247
4332
|
let deferred0_1;
|
@@ -4256,7 +4341,7 @@ module.exports.__wbg_remove_3129bda82100f0a2 = function () {
|
|
4256
4341
|
}, arguments);
|
4257
4342
|
};
|
4258
4343
|
|
4259
|
-
module.exports.
|
4344
|
+
module.exports.__wbg_remove_ae7f64be8e4b3d4b = function () {
|
4260
4345
|
return handleError(function (arg0, arg1, arg2) {
|
4261
4346
|
let deferred0_0;
|
4262
4347
|
let deferred0_1;
|
@@ -4295,19 +4380,7 @@ module.exports.__wbg_setTimeout_ca12ead8b48245e2 = function (arg0, arg1) {
|
|
4295
4380
|
return addHeapObject(ret);
|
4296
4381
|
};
|
4297
4382
|
|
4298
|
-
module.exports.
|
4299
|
-
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
4300
|
-
};
|
4301
|
-
|
4302
|
-
module.exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
|
4303
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
4304
|
-
};
|
4305
|
-
|
4306
|
-
module.exports.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
|
4307
|
-
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
4308
|
-
};
|
4309
|
-
|
4310
|
-
module.exports.__wbg_set_8394acfd3cac67a4 = function () {
|
4383
|
+
module.exports.__wbg_set_1428084fdb396fcc = function () {
|
4311
4384
|
return handleError(function (arg0, arg1, arg2, arg3) {
|
4312
4385
|
let deferred0_0;
|
4313
4386
|
let deferred0_1;
|
@@ -4322,12 +4395,24 @@ module.exports.__wbg_set_8394acfd3cac67a4 = function () {
|
|
4322
4395
|
}, arguments);
|
4323
4396
|
};
|
4324
4397
|
|
4398
|
+
module.exports.__wbg_set_37837023f3d740e8 = function (arg0, arg1, arg2) {
|
4399
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
4400
|
+
};
|
4401
|
+
|
4402
|
+
module.exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
|
4403
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
4404
|
+
};
|
4405
|
+
|
4406
|
+
module.exports.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
|
4407
|
+
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
4408
|
+
};
|
4409
|
+
|
4325
4410
|
module.exports.__wbg_set_8fc6bf8a5b1071d1 = function (arg0, arg1, arg2) {
|
4326
4411
|
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
4327
4412
|
return addHeapObject(ret);
|
4328
4413
|
};
|
4329
4414
|
|
4330
|
-
module.exports.
|
4415
|
+
module.exports.__wbg_set_ecd2eed98800a72b = function () {
|
4331
4416
|
return handleError(function (arg0, arg1, arg2, arg3) {
|
4332
4417
|
let deferred0_0;
|
4333
4418
|
let deferred0_1;
|
@@ -4530,18 +4615,18 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
|
|
4530
4615
|
return ret;
|
4531
4616
|
};
|
4532
4617
|
|
4533
|
-
module.exports.
|
4534
|
-
const ret = makeMutClosure(arg0, arg1,
|
4618
|
+
module.exports.__wbindgen_closure_wrapper3386 = function (arg0, arg1, arg2) {
|
4619
|
+
const ret = makeMutClosure(arg0, arg1, 278, __wbg_adapter_54);
|
4535
4620
|
return addHeapObject(ret);
|
4536
4621
|
};
|
4537
4622
|
|
4538
|
-
module.exports.
|
4539
|
-
const ret = makeMutClosure(arg0, arg1,
|
4623
|
+
module.exports.__wbindgen_closure_wrapper5756 = function (arg0, arg1, arg2) {
|
4624
|
+
const ret = makeMutClosure(arg0, arg1, 303, __wbg_adapter_54);
|
4540
4625
|
return addHeapObject(ret);
|
4541
4626
|
};
|
4542
4627
|
|
4543
|
-
module.exports.
|
4544
|
-
const ret = makeMutClosure(arg0, arg1,
|
4628
|
+
module.exports.__wbindgen_closure_wrapper6111 = function (arg0, arg1, arg2) {
|
4629
|
+
const ret = makeMutClosure(arg0, arg1, 328, __wbg_adapter_59);
|
4545
4630
|
return addHeapObject(ret);
|
4546
4631
|
};
|
4547
4632
|
|
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;
|