@bitwarden/sdk-internal 0.2.0-main.179 → 0.2.0-main.180

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.
@@ -200,6 +200,11 @@ export interface VerifyAsymmetricKeysResponse {
200
200
  validPrivateKey: boolean;
201
201
  }
202
202
 
203
+ /**
204
+ * NewType wrapper for `OrganizationId`
205
+ */
206
+ export type OrganizationId = Tagged<Uuid, "OrganizationId">;
207
+
203
208
  export interface EncryptionSettingsError extends Error {
204
209
  name: "EncryptionSettingsError";
205
210
  variant:
@@ -950,7 +955,14 @@ export interface Attachment {
950
955
  key: EncString | undefined;
951
956
  }
952
957
 
953
- export type Uuid = string;
958
+ import { Tagged } from "type-fest";
959
+
960
+ /**
961
+ * A string that **MUST** be a valid UUID.
962
+ *
963
+ * Never create or cast to this type directly, use the `uuid<T>()` function instead.
964
+ */
965
+ export type Uuid = unknown;
954
966
 
955
967
  /**
956
968
  * RFC3339 compliant date-time string.
@@ -1010,63 +1022,11 @@ export class BitwardenClient {
1010
1022
  export class CiphersClient {
1011
1023
  private constructor();
1012
1024
  free(): void;
1013
- /**
1014
- * Encrypt cipher
1015
- *
1016
- * # Arguments
1017
- * - `cipher_view` - The decrypted cipher to encrypt
1018
- *
1019
- * # Returns
1020
- * - `Ok(Cipher)` containing the encrypted cipher
1021
- * - `Err(EncryptError)` if encryption fails
1022
- */
1023
1025
  encrypt(cipher_view: CipherView): EncryptionContext;
1024
- /**
1025
- * Decrypt cipher
1026
- *
1027
- * # Arguments
1028
- * - `cipher` - The encrypted cipher to decrypt
1029
- *
1030
- * # Returns
1031
- * - `Ok(CipherView)` containing the decrypted cipher
1032
- * - `Err(DecryptError)` if decryption fails
1033
- */
1034
1026
  decrypt(cipher: Cipher): CipherView;
1035
- /**
1036
- * Decrypt list of ciphers
1037
- *
1038
- * # Arguments
1039
- * - `ciphers` - The list of encrypted ciphers to decrypt
1040
- *
1041
- * # Returns
1042
- * - `Ok(Vec<CipherListView>)` containing the decrypted ciphers
1043
- * - `Err(DecryptError)` if decryption fails
1044
- */
1045
1027
  decrypt_list(ciphers: Cipher[]): CipherListView[];
1046
- /**
1047
- * Decrypt FIDO2 credentials
1048
- *
1049
- * # Arguments
1050
- * - `cipher_view` - Cipher to encrypt containing the FIDO2 credential
1051
- *
1052
- * # Returns
1053
- * - `Ok(Vec<Fido2CredentialView>)` containing the decrypted FIDO2 credentials
1054
- * - `Err(DecryptError)` if decryption fails
1055
- */
1056
1028
  decrypt_fido2_credentials(cipher_view: CipherView): Fido2CredentialView[];
1057
- /**
1058
- * Decrypt key
1059
- *
1060
- * This method is a temporary solution to allow typescript client access to decrypted key
1061
- * values, particularly for FIDO2 credentials.
1062
- *
1063
- * # Arguments
1064
- * - `cipher_view` - Decrypted cipher containing the key
1065
- *
1066
- * # Returns
1067
- * - `Ok(String)` containing the decrypted key
1068
- * - `Err(CipherError)`
1069
- */
1029
+ move_to_organization(cipher_view: CipherView, organization_id: OrganizationId): CipherView;
1070
1030
  decrypt_fido2_private_key(cipher_view: CipherView): string;
1071
1031
  }
1072
1032
  export class CryptoClient {
@@ -1125,10 +1085,9 @@ export class ExporterClient {
1125
1085
  export class FoldersClient {
1126
1086
  private constructor();
1127
1087
  free(): void;
1128
- /**
1129
- * Decrypt folder
1130
- */
1088
+ encrypt(folder_view: FolderView): Folder;
1131
1089
  decrypt(folder: Folder): FolderView;
1090
+ decrypt_list(folders: Folder[]): FolderView[];
1132
1091
  }
1133
1092
  export class GeneratorClient {
1134
1093
  private constructor();
@@ -607,7 +607,7 @@ function __wbg_adapter_53(arg0, arg1, arg2) {
607
607
  );
608
608
  }
609
609
 
610
- function __wbg_adapter_253(arg0, arg1, arg2, arg3) {
610
+ function __wbg_adapter_256(arg0, arg1, arg2, arg3) {
611
611
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h08b1d375eb2ae73e(
612
612
  arg0,
613
613
  arg1,
@@ -983,14 +983,6 @@ class CiphersClient {
983
983
  wasm.__wbg_ciphersclient_free(ptr, 0);
984
984
  }
985
985
  /**
986
- * Encrypt cipher
987
- *
988
- * # Arguments
989
- * - `cipher_view` - The decrypted cipher to encrypt
990
- *
991
- * # Returns
992
- * - `Ok(Cipher)` containing the encrypted cipher
993
- * - `Err(EncryptError)` if encryption fails
994
986
  * @param {CipherView} cipher_view
995
987
  * @returns {EncryptionContext}
996
988
  */
@@ -1010,14 +1002,6 @@ class CiphersClient {
1010
1002
  }
1011
1003
  }
1012
1004
  /**
1013
- * Decrypt cipher
1014
- *
1015
- * # Arguments
1016
- * - `cipher` - The encrypted cipher to decrypt
1017
- *
1018
- * # Returns
1019
- * - `Ok(CipherView)` containing the decrypted cipher
1020
- * - `Err(DecryptError)` if decryption fails
1021
1005
  * @param {Cipher} cipher
1022
1006
  * @returns {CipherView}
1023
1007
  */
@@ -1037,14 +1021,6 @@ class CiphersClient {
1037
1021
  }
1038
1022
  }
1039
1023
  /**
1040
- * Decrypt list of ciphers
1041
- *
1042
- * # Arguments
1043
- * - `ciphers` - The list of encrypted ciphers to decrypt
1044
- *
1045
- * # Returns
1046
- * - `Ok(Vec<CipherListView>)` containing the decrypted ciphers
1047
- * - `Err(DecryptError)` if decryption fails
1048
1024
  * @param {Cipher[]} ciphers
1049
1025
  * @returns {CipherListView[]}
1050
1026
  */
@@ -1069,14 +1045,6 @@ class CiphersClient {
1069
1045
  }
1070
1046
  }
1071
1047
  /**
1072
- * Decrypt FIDO2 credentials
1073
- *
1074
- * # Arguments
1075
- * - `cipher_view` - Cipher to encrypt containing the FIDO2 credential
1076
- *
1077
- * # Returns
1078
- * - `Ok(Vec<Fido2CredentialView>)` containing the decrypted FIDO2 credentials
1079
- * - `Err(DecryptError)` if decryption fails
1080
1048
  * @param {CipherView} cipher_view
1081
1049
  * @returns {Fido2CredentialView[]}
1082
1050
  */
@@ -1103,17 +1071,31 @@ class CiphersClient {
1103
1071
  }
1104
1072
  }
1105
1073
  /**
1106
- * Decrypt key
1107
- *
1108
- * This method is a temporary solution to allow typescript client access to decrypted key
1109
- * values, particularly for FIDO2 credentials.
1110
- *
1111
- * # Arguments
1112
- * - `cipher_view` - Decrypted cipher containing the key
1113
- *
1114
- * # Returns
1115
- * - `Ok(String)` containing the decrypted key
1116
- * - `Err(CipherError)`
1074
+ * @param {CipherView} cipher_view
1075
+ * @param {OrganizationId} organization_id
1076
+ * @returns {CipherView}
1077
+ */
1078
+ move_to_organization(cipher_view, organization_id) {
1079
+ try {
1080
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1081
+ wasm.ciphersclient_move_to_organization(
1082
+ retptr,
1083
+ this.__wbg_ptr,
1084
+ addHeapObject(cipher_view),
1085
+ addHeapObject(organization_id),
1086
+ );
1087
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1088
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1089
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1090
+ if (r2) {
1091
+ throw takeObject(r1);
1092
+ }
1093
+ return takeObject(r0);
1094
+ } finally {
1095
+ wasm.__wbindgen_add_to_stack_pointer(16);
1096
+ }
1097
+ }
1098
+ /**
1117
1099
  * @param {CipherView} cipher_view
1118
1100
  * @returns {string}
1119
1101
  */
@@ -1450,7 +1432,25 @@ class FoldersClient {
1450
1432
  wasm.__wbg_foldersclient_free(ptr, 0);
1451
1433
  }
1452
1434
  /**
1453
- * Decrypt folder
1435
+ * @param {FolderView} folder_view
1436
+ * @returns {Folder}
1437
+ */
1438
+ encrypt(folder_view) {
1439
+ try {
1440
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1441
+ wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
1442
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1443
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1444
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1445
+ if (r2) {
1446
+ throw takeObject(r1);
1447
+ }
1448
+ return takeObject(r0);
1449
+ } finally {
1450
+ wasm.__wbindgen_add_to_stack_pointer(16);
1451
+ }
1452
+ }
1453
+ /**
1454
1454
  * @param {Folder} folder
1455
1455
  * @returns {FolderView}
1456
1456
  */
@@ -1469,6 +1469,30 @@ class FoldersClient {
1469
1469
  wasm.__wbindgen_add_to_stack_pointer(16);
1470
1470
  }
1471
1471
  }
1472
+ /**
1473
+ * @param {Folder[]} folders
1474
+ * @returns {FolderView[]}
1475
+ */
1476
+ decrypt_list(folders) {
1477
+ try {
1478
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1479
+ const ptr0 = passArrayJsValueToWasm0(folders, wasm.__wbindgen_malloc);
1480
+ const len0 = WASM_VECTOR_LEN;
1481
+ wasm.foldersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1482
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1483
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1484
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1485
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1486
+ if (r3) {
1487
+ throw takeObject(r2);
1488
+ }
1489
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1490
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1491
+ return v2;
1492
+ } finally {
1493
+ wasm.__wbindgen_add_to_stack_pointer(16);
1494
+ }
1495
+ }
1472
1496
  }
1473
1497
  module.exports.FoldersClient = FoldersClient;
1474
1498
 
@@ -3207,7 +3231,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function (arg0, arg1) {
3207
3231
  const a = state0.a;
3208
3232
  state0.a = 0;
3209
3233
  try {
3210
- return __wbg_adapter_253(a, state0.b, arg0, arg1);
3234
+ return __wbg_adapter_256(a, state0.b, arg0, arg1);
3211
3235
  } finally {
3212
3236
  state0.a = a;
3213
3237
  }
@@ -3574,13 +3598,13 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
3574
3598
  return ret;
3575
3599
  };
3576
3600
 
3577
- module.exports.__wbindgen_closure_wrapper3099 = function (arg0, arg1, arg2) {
3578
- const ret = makeMutClosure(arg0, arg1, 705, __wbg_adapter_50);
3601
+ module.exports.__wbindgen_closure_wrapper3197 = function (arg0, arg1, arg2) {
3602
+ const ret = makeMutClosure(arg0, arg1, 747, __wbg_adapter_50);
3579
3603
  return addHeapObject(ret);
3580
3604
  };
3581
3605
 
3582
- module.exports.__wbindgen_closure_wrapper3494 = function (arg0, arg1, arg2) {
3583
- const ret = makeMutClosure(arg0, arg1, 827, __wbg_adapter_53);
3606
+ module.exports.__wbindgen_closure_wrapper3592 = function (arg0, arg1, arg2) {
3607
+ const ret = makeMutClosure(arg0, arg1, 869, __wbg_adapter_53);
3584
3608
  return addHeapObject(ret);
3585
3609
  };
3586
3610
 
@@ -96,12 +96,28 @@ export const __wbg_set_outgoingmessage_destination: (a: number, b: number) => vo
96
96
  export const isSshKeyExportError: (a: number) => number;
97
97
  export const isSshKeyImportError: (a: number) => number;
98
98
  export const isKeyGenerationError: (a: number) => number;
99
+ export const __wbg_ciphersclient_free: (a: number, b: number) => void;
100
+ export const ciphersclient_encrypt: (a: number, b: number, c: number) => void;
101
+ export const ciphersclient_decrypt: (a: number, b: number, c: number) => void;
102
+ export const ciphersclient_decrypt_list: (a: number, b: number, c: number, d: number) => void;
103
+ export const ciphersclient_decrypt_fido2_credentials: (a: number, b: number, c: number) => void;
104
+ export const ciphersclient_move_to_organization: (
105
+ a: number,
106
+ b: number,
107
+ c: number,
108
+ d: number,
109
+ ) => void;
110
+ export const ciphersclient_decrypt_fido2_private_key: (a: number, b: number, c: number) => void;
111
+ export const foldersclient_encrypt: (a: number, b: number, c: number) => void;
112
+ export const foldersclient_decrypt: (a: number, b: number, c: number) => void;
113
+ export const foldersclient_decrypt_list: (a: number, b: number, c: number, d: number) => void;
99
114
  export const isDecryptError: (a: number) => number;
100
115
  export const isEncryptError: (a: number) => number;
101
116
  export const isTotpError: (a: number) => number;
102
117
  export const isCipherError: (a: number) => number;
103
118
  export const isDecryptFileError: (a: number) => number;
104
119
  export const isEncryptFileError: (a: number) => number;
120
+ export const __wbg_foldersclient_free: (a: number, b: number) => void;
105
121
  export const __wbg_bitwardenclient_free: (a: number, b: number) => void;
106
122
  export const bitwardenclient_new: (a: number) => number;
107
123
  export const bitwardenclient_echo: (a: number, b: number, c: number, d: number) => void;
@@ -247,12 +263,6 @@ export const attachmentsclient_decrypt_buffer: (
247
263
  e: number,
248
264
  f: number,
249
265
  ) => void;
250
- export const ciphersclient_encrypt: (a: number, b: number, c: number) => void;
251
- export const ciphersclient_decrypt: (a: number, b: number, c: number) => void;
252
- export const ciphersclient_decrypt_list: (a: number, b: number, c: number, d: number) => void;
253
- export const ciphersclient_decrypt_fido2_credentials: (a: number, b: number, c: number) => void;
254
- export const ciphersclient_decrypt_fido2_private_key: (a: number, b: number, c: number) => void;
255
- export const foldersclient_decrypt: (a: number, b: number, c: number) => void;
256
266
  export const totpclient_generate_totp: (
257
267
  a: number,
258
268
  b: number,
@@ -283,11 +293,9 @@ export const purecrypto_wrap_encapsulation_key: (
283
293
  d: number,
284
294
  e: number,
285
295
  ) => void;
286
- export const __wbg_totpclient_free: (a: number, b: number) => void;
287
296
  export const __wbg_cryptoclient_free: (a: number, b: number) => void;
288
- export const __wbg_foldersclient_free: (a: number, b: number) => void;
289
297
  export const __wbg_vaultclient_free: (a: number, b: number) => void;
290
- export const __wbg_ciphersclient_free: (a: number, b: number) => void;
298
+ export const __wbg_totpclient_free: (a: number, b: number) => void;
291
299
  export const __wbindgen_malloc: (a: number, b: number) => number;
292
300
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
293
301
  export const __wbindgen_exn_store: (a: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.179",
3
+ "version": "0.2.0-main.180",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",
@@ -22,5 +22,11 @@
22
22
  "scripts": {},
23
23
  "sideEffects": [
24
24
  "./bitwarden_wasm_internal.js"
25
- ]
25
+ ],
26
+ "dependencies": {
27
+ "type-fest": "^4.41.0"
28
+ },
29
+ "devDependencies": {
30
+ "typescript": "5.8.3"
31
+ }
26
32
  }