@bitwarden/sdk-internal 0.2.0-main.75 → 0.2.0-main.76
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 -0
- package/bitwarden_wasm_internal_bg.js +108 -5
- package/bitwarden_wasm_internal_bg.wasm +0 -0
- package/bitwarden_wasm_internal_bg.wasm.d.ts +11 -0
- package/bitwarden_wasm_internal_bg.wasm.js +1 -1
- package/node/bitwarden_wasm_internal.d.ts +38 -0
- package/node/bitwarden_wasm_internal.js +109 -5
- package/node/bitwarden_wasm_internal_bg.wasm +0 -0
- package/node/bitwarden_wasm_internal_bg.wasm.d.ts +11 -0
- package/package.json +1 -1
package/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
8c730ed41b54096cec0eb94154ee4f316661c9ce
|
@@ -269,6 +269,24 @@ export interface FolderView {
|
|
269
269
|
revisionDate: DateTime<Utc>;
|
270
270
|
}
|
271
271
|
|
272
|
+
export interface TotpResponse {
|
273
|
+
/**
|
274
|
+
* Generated TOTP code
|
275
|
+
*/
|
276
|
+
code: string;
|
277
|
+
/**
|
278
|
+
* Time period
|
279
|
+
*/
|
280
|
+
period: number;
|
281
|
+
}
|
282
|
+
|
283
|
+
export interface TotpError extends Error {
|
284
|
+
name: "TotpError";
|
285
|
+
variant: "InvalidOtpauth" | "MissingSecret" | "CryptoError" | "VaultLocked";
|
286
|
+
}
|
287
|
+
|
288
|
+
export function isTotpError(error: any): error is TotpError;
|
289
|
+
|
272
290
|
export interface TestError extends Error {
|
273
291
|
name: "TestError";
|
274
292
|
}
|
@@ -317,6 +335,25 @@ export class ClientFolders {
|
|
317
335
|
*/
|
318
336
|
decrypt(folder: Folder): FolderView;
|
319
337
|
}
|
338
|
+
export class ClientTotp {
|
339
|
+
private constructor();
|
340
|
+
free(): void;
|
341
|
+
/**
|
342
|
+
* Generates a TOTP code from a provided key
|
343
|
+
*
|
344
|
+
* # Arguments
|
345
|
+
* - `key` - Can be:
|
346
|
+
* - A base32 encoded string
|
347
|
+
* - OTP Auth URI
|
348
|
+
* - Steam URI
|
349
|
+
* - `time_ms` - Optional timestamp in milliseconds
|
350
|
+
*
|
351
|
+
* # Returns
|
352
|
+
* - `Ok(TotpResponse)` containing the generated code and period
|
353
|
+
* - `Err(TotpError)` if code generation fails
|
354
|
+
*/
|
355
|
+
generate_totp(key: string, time_ms?: number | null): TotpResponse;
|
356
|
+
}
|
320
357
|
export class CryptoClient {
|
321
358
|
private constructor();
|
322
359
|
free(): void;
|
@@ -346,4 +383,5 @@ export class VaultClient {
|
|
346
383
|
private constructor();
|
347
384
|
free(): void;
|
348
385
|
folders(): ClientFolders;
|
386
|
+
totp(): ClientTotp;
|
349
387
|
}
|
@@ -311,6 +311,19 @@ export function isKeyGenerationError(error) {
|
|
311
311
|
}
|
312
312
|
}
|
313
313
|
|
314
|
+
/**
|
315
|
+
* @param {any} error
|
316
|
+
* @returns {boolean}
|
317
|
+
*/
|
318
|
+
export function isTotpError(error) {
|
319
|
+
try {
|
320
|
+
const ret = wasm.isTotpError(addBorrowedObject(error));
|
321
|
+
return ret !== 0;
|
322
|
+
} finally {
|
323
|
+
heap[stack_pointer++] = undefined;
|
324
|
+
}
|
325
|
+
}
|
326
|
+
|
314
327
|
/**
|
315
328
|
* @param {any} error
|
316
329
|
* @returns {boolean}
|
@@ -392,7 +405,7 @@ export function import_ssh_key(imported_key, password) {
|
|
392
405
|
}
|
393
406
|
}
|
394
407
|
|
395
|
-
function
|
408
|
+
function __wbg_adapter_40(arg0, arg1, arg2) {
|
396
409
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8fd8a25b4840f267(
|
397
410
|
arg0,
|
398
411
|
arg1,
|
@@ -400,7 +413,7 @@ function __wbg_adapter_38(arg0, arg1, arg2) {
|
|
400
413
|
);
|
401
414
|
}
|
402
415
|
|
403
|
-
function
|
416
|
+
function __wbg_adapter_139(arg0, arg1, arg2, arg3) {
|
404
417
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h2b4228b75de6bd5e(
|
405
418
|
arg0,
|
406
419
|
arg1,
|
@@ -593,6 +606,74 @@ export class ClientFolders {
|
|
593
606
|
}
|
594
607
|
}
|
595
608
|
|
609
|
+
const ClientTotpFinalization =
|
610
|
+
typeof FinalizationRegistry === "undefined"
|
611
|
+
? { register: () => {}, unregister: () => {} }
|
612
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_clienttotp_free(ptr >>> 0, 1));
|
613
|
+
|
614
|
+
export class ClientTotp {
|
615
|
+
static __wrap(ptr) {
|
616
|
+
ptr = ptr >>> 0;
|
617
|
+
const obj = Object.create(ClientTotp.prototype);
|
618
|
+
obj.__wbg_ptr = ptr;
|
619
|
+
ClientTotpFinalization.register(obj, obj.__wbg_ptr, obj);
|
620
|
+
return obj;
|
621
|
+
}
|
622
|
+
|
623
|
+
__destroy_into_raw() {
|
624
|
+
const ptr = this.__wbg_ptr;
|
625
|
+
this.__wbg_ptr = 0;
|
626
|
+
ClientTotpFinalization.unregister(this);
|
627
|
+
return ptr;
|
628
|
+
}
|
629
|
+
|
630
|
+
free() {
|
631
|
+
const ptr = this.__destroy_into_raw();
|
632
|
+
wasm.__wbg_clienttotp_free(ptr, 0);
|
633
|
+
}
|
634
|
+
/**
|
635
|
+
* Generates a TOTP code from a provided key
|
636
|
+
*
|
637
|
+
* # Arguments
|
638
|
+
* - `key` - Can be:
|
639
|
+
* - A base32 encoded string
|
640
|
+
* - OTP Auth URI
|
641
|
+
* - Steam URI
|
642
|
+
* - `time_ms` - Optional timestamp in milliseconds
|
643
|
+
*
|
644
|
+
* # Returns
|
645
|
+
* - `Ok(TotpResponse)` containing the generated code and period
|
646
|
+
* - `Err(TotpError)` if code generation fails
|
647
|
+
* @param {string} key
|
648
|
+
* @param {number | null} [time_ms]
|
649
|
+
* @returns {TotpResponse}
|
650
|
+
*/
|
651
|
+
generate_totp(key, time_ms) {
|
652
|
+
try {
|
653
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
654
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
655
|
+
const len0 = WASM_VECTOR_LEN;
|
656
|
+
wasm.clienttotp_generate_totp(
|
657
|
+
retptr,
|
658
|
+
this.__wbg_ptr,
|
659
|
+
ptr0,
|
660
|
+
len0,
|
661
|
+
!isLikeNone(time_ms),
|
662
|
+
isLikeNone(time_ms) ? 0 : time_ms,
|
663
|
+
);
|
664
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
665
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
666
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
667
|
+
if (r2) {
|
668
|
+
throw takeObject(r1);
|
669
|
+
}
|
670
|
+
return takeObject(r0);
|
671
|
+
} finally {
|
672
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
673
|
+
}
|
674
|
+
}
|
675
|
+
}
|
676
|
+
|
596
677
|
const CryptoClientFinalization =
|
597
678
|
typeof FinalizationRegistry === "undefined"
|
598
679
|
? { register: () => {}, unregister: () => {} }
|
@@ -717,6 +798,13 @@ export class VaultClient {
|
|
717
798
|
const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
|
718
799
|
return ClientFolders.__wrap(ret);
|
719
800
|
}
|
801
|
+
/**
|
802
|
+
* @returns {ClientTotp}
|
803
|
+
*/
|
804
|
+
totp() {
|
805
|
+
const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
|
806
|
+
return ClientTotp.__wrap(ret);
|
807
|
+
}
|
720
808
|
}
|
721
809
|
|
722
810
|
export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
|
@@ -829,6 +917,11 @@ export function __wbg_getRandomValues_bcb4912f16000dc4() {
|
|
829
917
|
}, arguments);
|
830
918
|
}
|
831
919
|
|
920
|
+
export function __wbg_getTime_46267b1c24877e30(arg0) {
|
921
|
+
const ret = getObject(arg0).getTime();
|
922
|
+
return ret;
|
923
|
+
}
|
924
|
+
|
832
925
|
export function __wbg_get_67b2ba62fc30de12() {
|
833
926
|
return handleError(function (arg0, arg1) {
|
834
927
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
@@ -924,6 +1017,11 @@ export function __wbg_msCrypto_0a36e2ec3a343d26(arg0) {
|
|
924
1017
|
return addHeapObject(ret);
|
925
1018
|
}
|
926
1019
|
|
1020
|
+
export function __wbg_new0_f788a2397c7ca929() {
|
1021
|
+
const ret = new Date();
|
1022
|
+
return addHeapObject(ret);
|
1023
|
+
}
|
1024
|
+
|
927
1025
|
export function __wbg_new_018dcc2d6c8c2f6a() {
|
928
1026
|
return handleError(function () {
|
929
1027
|
const ret = new Headers();
|
@@ -938,7 +1036,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
|
|
938
1036
|
const a = state0.a;
|
939
1037
|
state0.a = 0;
|
940
1038
|
try {
|
941
|
-
return
|
1039
|
+
return __wbg_adapter_139(a, state0.b, arg0, arg1);
|
942
1040
|
} finally {
|
943
1041
|
state0.a = a;
|
944
1042
|
}
|
@@ -1255,8 +1353,8 @@ export function __wbindgen_cb_drop(arg0) {
|
|
1255
1353
|
return ret;
|
1256
1354
|
}
|
1257
1355
|
|
1258
|
-
export function
|
1259
|
-
const ret = makeMutClosure(arg0, arg1,
|
1356
|
+
export function __wbindgen_closure_wrapper2089(arg0, arg1, arg2) {
|
1357
|
+
const ret = makeMutClosure(arg0, arg1, 564, __wbg_adapter_40);
|
1260
1358
|
return addHeapObject(ret);
|
1261
1359
|
}
|
1262
1360
|
|
@@ -1316,6 +1414,11 @@ export function __wbindgen_number_get(arg0, arg1) {
|
|
1316
1414
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
1317
1415
|
}
|
1318
1416
|
|
1417
|
+
export function __wbindgen_number_new(arg0) {
|
1418
|
+
const ret = arg0;
|
1419
|
+
return addHeapObject(ret);
|
1420
|
+
}
|
1421
|
+
|
1319
1422
|
export function __wbindgen_object_clone_ref(arg0) {
|
1320
1423
|
const ret = getObject(arg0);
|
1321
1424
|
return addHeapObject(ret);
|
Binary file
|
@@ -6,6 +6,7 @@ export const isEncryptionSettingsError: (a: number) => number;
|
|
6
6
|
export const isSshKeyExportError: (a: number) => number;
|
7
7
|
export const isSshKeyImportError: (a: number) => number;
|
8
8
|
export const isKeyGenerationError: (a: number) => number;
|
9
|
+
export const isTotpError: (a: number) => number;
|
9
10
|
export const __wbg_bitwardenclient_free: (a: number, b: number) => void;
|
10
11
|
export const bitwardenclient_new: (a: number, b: number) => number;
|
11
12
|
export const bitwardenclient_echo: (a: number, b: number, c: number, d: number) => void;
|
@@ -21,11 +22,21 @@ export const cryptoclient_verify_asymmetric_keys: (a: number, b: number, c: numb
|
|
21
22
|
export const generate_ssh_key: (a: number, b: number) => void;
|
22
23
|
export const import_ssh_key: (a: number, b: number, c: number, d: number, e: number) => void;
|
23
24
|
export const clientfolders_decrypt: (a: number, b: number, c: number) => void;
|
25
|
+
export const clienttotp_generate_totp: (
|
26
|
+
a: number,
|
27
|
+
b: number,
|
28
|
+
c: number,
|
29
|
+
d: number,
|
30
|
+
e: number,
|
31
|
+
f: number,
|
32
|
+
) => void;
|
24
33
|
export const __wbg_cryptoclient_free: (a: number, b: number) => void;
|
25
34
|
export const __wbg_clientfolders_free: (a: number, b: number) => void;
|
35
|
+
export const __wbg_clienttotp_free: (a: number, b: number) => void;
|
26
36
|
export const __wbg_vaultclient_free: (a: number, b: number) => void;
|
27
37
|
export const bitwardenclient_vault: (a: number) => number;
|
28
38
|
export const vaultclient_folders: (a: number) => number;
|
39
|
+
export const vaultclient_totp: (a: number) => number;
|
29
40
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
30
41
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
31
42
|
export const __wbindgen_exn_store: (a: number) => void;
|