@bitwarden/sdk-internal 0.2.0-main.231 → 0.2.0-main.232

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 CHANGED
@@ -1 +1 @@
1
- 812865fe73b742f82360060430cb1003a9e0e3e5
1
+ bdcb5f5480053b181dab1e6c80c5df0ab93e440f
@@ -998,6 +998,16 @@ export interface SecureNoteView {
998
998
  type: SecureNoteType;
999
999
  }
1000
1000
 
1001
+ /**
1002
+ * Request to add or edit a folder.
1003
+ */
1004
+ export interface FolderAddEditRequest {
1005
+ /**
1006
+ * The new name of the folder.
1007
+ */
1008
+ name: string;
1009
+ }
1010
+
1001
1011
  export interface Folder {
1002
1012
  id: Uuid | undefined;
1003
1013
  name: EncString;
@@ -1052,6 +1062,34 @@ export interface PasswordHistory {
1052
1062
  lastUsedDate: DateTime<Utc>;
1053
1063
  }
1054
1064
 
1065
+ export interface GetFolderError extends Error {
1066
+ name: "GetFolderError";
1067
+ variant: "ItemNotFound" | "Crypto" | "RepositoryError";
1068
+ }
1069
+
1070
+ export function isGetFolderError(error: any): error is GetFolderError;
1071
+
1072
+ export interface EditFolderError extends Error {
1073
+ name: "EditFolderError";
1074
+ variant:
1075
+ | "ItemNotFound"
1076
+ | "Crypto"
1077
+ | "Api"
1078
+ | "VaultParse"
1079
+ | "MissingField"
1080
+ | "RepositoryError"
1081
+ | "Uuid";
1082
+ }
1083
+
1084
+ export function isEditFolderError(error: any): error is EditFolderError;
1085
+
1086
+ export interface CreateFolderError extends Error {
1087
+ name: "CreateFolderError";
1088
+ variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "RepositoryError";
1089
+ }
1090
+
1091
+ export function isCreateFolderError(error: any): error is CreateFolderError;
1092
+
1055
1093
  export interface Collection {
1056
1094
  id: Uuid | undefined;
1057
1095
  organizationId: Uuid;
@@ -1401,12 +1439,40 @@ export class ExporterClient {
1401
1439
  */
1402
1440
  import_cxf(payload: string): Cipher[];
1403
1441
  }
1442
+ /**
1443
+ * Wrapper for folder specific functionality.
1444
+ */
1404
1445
  export class FoldersClient {
1405
1446
  private constructor();
1406
1447
  free(): void;
1448
+ /**
1449
+ * Encrypt a [FolderView] to a [Folder].
1450
+ */
1407
1451
  encrypt(folder_view: FolderView): Folder;
1452
+ /**
1453
+ * Encrypt a [Folder] to [FolderView].
1454
+ */
1408
1455
  decrypt(folder: Folder): FolderView;
1456
+ /**
1457
+ * Decrypt a list of [Folder]s to a list of [FolderView]s.
1458
+ */
1409
1459
  decrypt_list(folders: Folder[]): FolderView[];
1460
+ /**
1461
+ * Get all folders from state and decrypt them to a list of [FolderView].
1462
+ */
1463
+ list(): Promise<FolderView[]>;
1464
+ /**
1465
+ * Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
1466
+ */
1467
+ get(folder_id: string): Promise<FolderView>;
1468
+ /**
1469
+ * Create a new [Folder] and save it to the server.
1470
+ */
1471
+ create(request: FolderAddEditRequest): Promise<FolderView>;
1472
+ /**
1473
+ * Edit the [Folder] and save it to the server.
1474
+ */
1475
+ edit(folder_id: string, request: FolderAddEditRequest): Promise<FolderView>;
1410
1476
  }
1411
1477
  export class GeneratorClient {
1412
1478
  private constructor();
@@ -1652,6 +1718,7 @@ export class StateClient {
1652
1718
  private constructor();
1653
1719
  free(): void;
1654
1720
  register_cipher_repository(store: Repository<Cipher>): void;
1721
+ register_folder_repository(store: Repository<Folder>): void;
1655
1722
  }
1656
1723
  export class TotpClient {
1657
1724
  private constructor();
@@ -610,6 +610,45 @@ export function isTotpError(error) {
610
610
  }
611
611
  }
612
612
 
613
+ /**
614
+ * @param {any} error
615
+ * @returns {boolean}
616
+ */
617
+ export function isGetFolderError(error) {
618
+ try {
619
+ const ret = wasm.isGetFolderError(addBorrowedObject(error));
620
+ return ret !== 0;
621
+ } finally {
622
+ heap[stack_pointer++] = undefined;
623
+ }
624
+ }
625
+
626
+ /**
627
+ * @param {any} error
628
+ * @returns {boolean}
629
+ */
630
+ export function isEditFolderError(error) {
631
+ try {
632
+ const ret = wasm.isEditFolderError(addBorrowedObject(error));
633
+ return ret !== 0;
634
+ } finally {
635
+ heap[stack_pointer++] = undefined;
636
+ }
637
+ }
638
+
639
+ /**
640
+ * @param {any} error
641
+ * @returns {boolean}
642
+ */
643
+ export function isCreateFolderError(error) {
644
+ try {
645
+ const ret = wasm.isCreateFolderError(addBorrowedObject(error));
646
+ return ret !== 0;
647
+ } finally {
648
+ heap[stack_pointer++] = undefined;
649
+ }
650
+ }
651
+
613
652
  /**
614
653
  * @param {any} error
615
654
  * @returns {boolean}
@@ -744,21 +783,21 @@ export function isTestError(error) {
744
783
  }
745
784
  }
746
785
 
747
- function __wbg_adapter_50(arg0, arg1) {
786
+ function __wbg_adapter_54(arg0, arg1) {
748
787
  wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h31333524c3115e44(
749
788
  arg0,
750
789
  arg1,
751
790
  );
752
791
  }
753
792
 
754
- function __wbg_adapter_53(arg0, arg1) {
793
+ function __wbg_adapter_57(arg0, arg1) {
755
794
  wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2b093e5f83b42fbd(
756
795
  arg0,
757
796
  arg1,
758
797
  );
759
798
  }
760
799
 
761
- function __wbg_adapter_56(arg0, arg1, arg2) {
800
+ function __wbg_adapter_60(arg0, arg1, arg2) {
762
801
  wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb01d8be1001e4f40(
763
802
  arg0,
764
803
  arg1,
@@ -766,7 +805,7 @@ function __wbg_adapter_56(arg0, arg1, arg2) {
766
805
  );
767
806
  }
768
807
 
769
- function __wbg_adapter_281(arg0, arg1, arg2, arg3) {
808
+ function __wbg_adapter_301(arg0, arg1, arg2, arg3) {
770
809
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h8776500d04a3e634(
771
810
  arg0,
772
811
  arg1,
@@ -1660,7 +1699,9 @@ const FoldersClientFinalization =
1660
1699
  typeof FinalizationRegistry === "undefined"
1661
1700
  ? { register: () => {}, unregister: () => {} }
1662
1701
  : new FinalizationRegistry((ptr) => wasm.__wbg_foldersclient_free(ptr >>> 0, 1));
1663
-
1702
+ /**
1703
+ * Wrapper for folder specific functionality.
1704
+ */
1664
1705
  export class FoldersClient {
1665
1706
  static __wrap(ptr) {
1666
1707
  ptr = ptr >>> 0;
@@ -1682,6 +1723,7 @@ export class FoldersClient {
1682
1723
  wasm.__wbg_foldersclient_free(ptr, 0);
1683
1724
  }
1684
1725
  /**
1726
+ * Encrypt a [FolderView] to a [Folder].
1685
1727
  * @param {FolderView} folder_view
1686
1728
  * @returns {Folder}
1687
1729
  */
@@ -1701,6 +1743,7 @@ export class FoldersClient {
1701
1743
  }
1702
1744
  }
1703
1745
  /**
1746
+ * Encrypt a [Folder] to [FolderView].
1704
1747
  * @param {Folder} folder
1705
1748
  * @returns {FolderView}
1706
1749
  */
@@ -1720,6 +1763,7 @@ export class FoldersClient {
1720
1763
  }
1721
1764
  }
1722
1765
  /**
1766
+ * Decrypt a list of [Folder]s to a list of [FolderView]s.
1723
1767
  * @param {Folder[]} folders
1724
1768
  * @returns {FolderView[]}
1725
1769
  */
@@ -1743,6 +1787,46 @@ export class FoldersClient {
1743
1787
  wasm.__wbindgen_add_to_stack_pointer(16);
1744
1788
  }
1745
1789
  }
1790
+ /**
1791
+ * Get all folders from state and decrypt them to a list of [FolderView].
1792
+ * @returns {Promise<FolderView[]>}
1793
+ */
1794
+ list() {
1795
+ const ret = wasm.foldersclient_list(this.__wbg_ptr);
1796
+ return takeObject(ret);
1797
+ }
1798
+ /**
1799
+ * Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
1800
+ * @param {string} folder_id
1801
+ * @returns {Promise<FolderView>}
1802
+ */
1803
+ get(folder_id) {
1804
+ const ptr0 = passStringToWasm0(folder_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1805
+ const len0 = WASM_VECTOR_LEN;
1806
+ const ret = wasm.foldersclient_get(this.__wbg_ptr, ptr0, len0);
1807
+ return takeObject(ret);
1808
+ }
1809
+ /**
1810
+ * Create a new [Folder] and save it to the server.
1811
+ * @param {FolderAddEditRequest} request
1812
+ * @returns {Promise<FolderView>}
1813
+ */
1814
+ create(request) {
1815
+ const ret = wasm.foldersclient_create(this.__wbg_ptr, addHeapObject(request));
1816
+ return takeObject(ret);
1817
+ }
1818
+ /**
1819
+ * Edit the [Folder] and save it to the server.
1820
+ * @param {string} folder_id
1821
+ * @param {FolderAddEditRequest} request
1822
+ * @returns {Promise<FolderView>}
1823
+ */
1824
+ edit(folder_id, request) {
1825
+ const ptr0 = passStringToWasm0(folder_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1826
+ const len0 = WASM_VECTOR_LEN;
1827
+ const ret = wasm.foldersclient_edit(this.__wbg_ptr, ptr0, len0, addHeapObject(request));
1828
+ return takeObject(ret);
1829
+ }
1746
1830
  }
1747
1831
 
1748
1832
  const GeneratorClientFinalization =
@@ -3160,6 +3244,12 @@ export class StateClient {
3160
3244
  register_cipher_repository(store) {
3161
3245
  wasm.stateclient_register_cipher_repository(this.__wbg_ptr, addHeapObject(store));
3162
3246
  }
3247
+ /**
3248
+ * @param {Repository<Folder>} store
3249
+ */
3250
+ register_folder_repository(store) {
3251
+ wasm.stateclient_register_folder_repository(this.__wbg_ptr, addHeapObject(store));
3252
+ }
3163
3253
  }
3164
3254
 
3165
3255
  const TotpClientFinalization =
@@ -3419,7 +3509,7 @@ export function __wbg_getTime_46267b1c24877e30(arg0) {
3419
3509
  return ret;
3420
3510
  }
3421
3511
 
3422
- export function __wbg_get_29fa07573edd0414() {
3512
+ export function __wbg_get_1620f903ed9a676f() {
3423
3513
  return handleError(function (arg0, arg1, arg2) {
3424
3514
  let deferred0_0;
3425
3515
  let deferred0_1;
@@ -3446,7 +3536,22 @@ export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
3446
3536
  return addHeapObject(ret);
3447
3537
  }
3448
3538
 
3449
- export function __wbg_getaccesstoken_c1ea3be055452912(arg0) {
3539
+ export function __wbg_get_e94e796a5527c131() {
3540
+ return handleError(function (arg0, arg1, arg2) {
3541
+ let deferred0_0;
3542
+ let deferred0_1;
3543
+ try {
3544
+ deferred0_0 = arg1;
3545
+ deferred0_1 = arg2;
3546
+ const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2));
3547
+ return addHeapObject(ret);
3548
+ } finally {
3549
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3550
+ }
3551
+ }, arguments);
3552
+ }
3553
+
3554
+ export function __wbg_getaccesstoken_115c028df526c10b(arg0) {
3450
3555
  const ret = getObject(arg0).get_access_token();
3451
3556
  return addHeapObject(ret);
3452
3557
  }
@@ -3551,7 +3656,14 @@ export function __wbg_length_e2d2a49132c1b256(arg0) {
3551
3656
  return ret;
3552
3657
  }
3553
3658
 
3554
- export function __wbg_list_b393427351b308b4() {
3659
+ export function __wbg_list_2a92e7addacc7a2d() {
3660
+ return handleError(function (arg0) {
3661
+ const ret = getObject(arg0).list();
3662
+ return addHeapObject(ret);
3663
+ }, arguments);
3664
+ }
3665
+
3666
+ export function __wbg_list_6d9131c88a8d0a17() {
3555
3667
  return handleError(function (arg0) {
3556
3668
  const ret = getObject(arg0).list();
3557
3669
  return addHeapObject(ret);
@@ -3586,7 +3698,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
3586
3698
  const a = state0.a;
3587
3699
  state0.a = 0;
3588
3700
  try {
3589
- return __wbg_adapter_281(a, state0.b, arg0, arg1);
3701
+ return __wbg_adapter_301(a, state0.b, arg0, arg1);
3590
3702
  } finally {
3591
3703
  state0.a = a;
3592
3704
  }
@@ -3728,7 +3840,22 @@ export function __wbg_randomFillSync_ac0988aba3254290() {
3728
3840
  }, arguments);
3729
3841
  }
3730
3842
 
3731
- export function __wbg_remove_39bec51fb6464483() {
3843
+ export function __wbg_remove_050f4c22aba9e8c7() {
3844
+ return handleError(function (arg0, arg1, arg2) {
3845
+ let deferred0_0;
3846
+ let deferred0_1;
3847
+ try {
3848
+ deferred0_0 = arg1;
3849
+ deferred0_1 = arg2;
3850
+ const ret = getObject(arg0).remove(getStringFromWasm0(arg1, arg2));
3851
+ return addHeapObject(ret);
3852
+ } finally {
3853
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3854
+ }
3855
+ }, arguments);
3856
+ }
3857
+
3858
+ export function __wbg_remove_c9b8a1e5e4b15f5f() {
3732
3859
  return handleError(function (arg0, arg1, arg2) {
3733
3860
  let deferred0_0;
3734
3861
  let deferred0_1;
@@ -3779,7 +3906,22 @@ export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
3779
3906
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
3780
3907
  }
3781
3908
 
3782
- export function __wbg_set_dac2905b348768e9() {
3909
+ export function __wbg_set_c0f7f01bcd881751() {
3910
+ return handleError(function (arg0, arg1, arg2, arg3) {
3911
+ let deferred0_0;
3912
+ let deferred0_1;
3913
+ try {
3914
+ deferred0_0 = arg1;
3915
+ deferred0_1 = arg2;
3916
+ const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
3917
+ return addHeapObject(ret);
3918
+ } finally {
3919
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3920
+ }
3921
+ }, arguments);
3922
+ }
3923
+
3924
+ export function __wbg_set_f85eb67e00c0abef() {
3783
3925
  return handleError(function (arg0, arg1, arg2, arg3) {
3784
3926
  let deferred0_0;
3785
3927
  let deferred0_1;
@@ -3935,6 +4077,15 @@ export function __wbg_warn_aaf1f4664a035bd6(arg0, arg1, arg2, arg3) {
3935
4077
  console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
3936
4078
  }
3937
4079
 
4080
+ export function __wbindgen_array_new() {
4081
+ const ret = [];
4082
+ return addHeapObject(ret);
4083
+ }
4084
+
4085
+ export function __wbindgen_array_push(arg0, arg1) {
4086
+ getObject(arg0).push(takeObject(arg1));
4087
+ }
4088
+
3938
4089
  export function __wbindgen_as_number(arg0) {
3939
4090
  const ret = +getObject(arg0);
3940
4091
  return ret;
@@ -3973,18 +4124,18 @@ export function __wbindgen_cb_drop(arg0) {
3973
4124
  return ret;
3974
4125
  }
3975
4126
 
3976
- export function __wbindgen_closure_wrapper2952(arg0, arg1, arg2) {
3977
- const ret = makeMutClosure(arg0, arg1, 928, __wbg_adapter_50);
4127
+ export function __wbindgen_closure_wrapper3245(arg0, arg1, arg2) {
4128
+ const ret = makeMutClosure(arg0, arg1, 1034, __wbg_adapter_54);
3978
4129
  return addHeapObject(ret);
3979
4130
  }
3980
4131
 
3981
- export function __wbindgen_closure_wrapper3792(arg0, arg1, arg2) {
3982
- const ret = makeMutClosure(arg0, arg1, 1012, __wbg_adapter_53);
4132
+ export function __wbindgen_closure_wrapper4086(arg0, arg1, arg2) {
4133
+ const ret = makeMutClosure(arg0, arg1, 1118, __wbg_adapter_57);
3983
4134
  return addHeapObject(ret);
3984
4135
  }
3985
4136
 
3986
- export function __wbindgen_closure_wrapper4211(arg0, arg1, arg2) {
3987
- const ret = makeMutClosure(arg0, arg1, 1134, __wbg_adapter_56);
4137
+ export function __wbindgen_closure_wrapper4522(arg0, arg1, arg2) {
4138
+ const ret = makeMutClosure(arg0, arg1, 1251, __wbg_adapter_60);
3988
4139
  return addHeapObject(ret);
3989
4140
  }
3990
4141
 
Binary file
@@ -135,6 +135,10 @@ export const ciphersclient_decrypt_fido2_private_key: (a: number, b: number, c:
135
135
  export const foldersclient_encrypt: (a: number, b: number, c: number) => void;
136
136
  export const foldersclient_decrypt: (a: number, b: number, c: number) => void;
137
137
  export const foldersclient_decrypt_list: (a: number, b: number, c: number, d: number) => void;
138
+ export const foldersclient_list: (a: number) => number;
139
+ export const foldersclient_get: (a: number, b: number, c: number) => number;
140
+ export const foldersclient_create: (a: number, b: number) => number;
141
+ export const foldersclient_edit: (a: number, b: number, c: number, d: number) => number;
138
142
  export const vaultclient_attachments: (a: number) => number;
139
143
  export const totpclient_generate_totp: (
140
144
  a: number,
@@ -147,6 +151,9 @@ export const totpclient_generate_totp: (
147
151
  export const isDecryptError: (a: number) => number;
148
152
  export const isEncryptError: (a: number) => number;
149
153
  export const isTotpError: (a: number) => number;
154
+ export const isGetFolderError: (a: number) => number;
155
+ export const isEditFolderError: (a: number) => number;
156
+ export const isCreateFolderError: (a: number) => number;
150
157
  export const isCipherError: (a: number) => number;
151
158
  export const isDecryptFileError: (a: number) => number;
152
159
  export const isEncryptFileError: (a: number) => number;
@@ -168,6 +175,7 @@ export const bitwardenclient_platform: (a: number) => number;
168
175
  export const set_log_level: (a: number) => void;
169
176
  export const init_sdk: (a: number) => void;
170
177
  export const stateclient_register_cipher_repository: (a: number, b: number) => void;
178
+ export const stateclient_register_folder_repository: (a: number, b: number) => void;
171
179
  export const __wbg_purecrypto_free: (a: number, b: number) => void;
172
180
  export const purecrypto_symmetric_decrypt: (
173
181
  a: number,