@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.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 82595fe4d95a4e709c45ad308b186f0cae6434a9
1
+ 7269f31fb78b07411cec503f2e7f062acfa666a8
@@ -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();
@@ -613,7 +613,7 @@ function __wbg_adapter_53(arg0, arg1, arg2) {
613
613
  );
614
614
  }
615
615
 
616
- function __wbg_adapter_253(arg0, arg1, arg2, arg3) {
616
+ function __wbg_adapter_256(arg0, arg1, arg2, arg3) {
617
617
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h08b1d375eb2ae73e(
618
618
  arg0,
619
619
  arg1,
@@ -987,14 +987,6 @@ export class CiphersClient {
987
987
  wasm.__wbg_ciphersclient_free(ptr, 0);
988
988
  }
989
989
  /**
990
- * Encrypt cipher
991
- *
992
- * # Arguments
993
- * - `cipher_view` - The decrypted cipher to encrypt
994
- *
995
- * # Returns
996
- * - `Ok(Cipher)` containing the encrypted cipher
997
- * - `Err(EncryptError)` if encryption fails
998
990
  * @param {CipherView} cipher_view
999
991
  * @returns {EncryptionContext}
1000
992
  */
@@ -1014,14 +1006,6 @@ export class CiphersClient {
1014
1006
  }
1015
1007
  }
1016
1008
  /**
1017
- * Decrypt cipher
1018
- *
1019
- * # Arguments
1020
- * - `cipher` - The encrypted cipher to decrypt
1021
- *
1022
- * # Returns
1023
- * - `Ok(CipherView)` containing the decrypted cipher
1024
- * - `Err(DecryptError)` if decryption fails
1025
1009
  * @param {Cipher} cipher
1026
1010
  * @returns {CipherView}
1027
1011
  */
@@ -1041,14 +1025,6 @@ export class CiphersClient {
1041
1025
  }
1042
1026
  }
1043
1027
  /**
1044
- * Decrypt list of ciphers
1045
- *
1046
- * # Arguments
1047
- * - `ciphers` - The list of encrypted ciphers to decrypt
1048
- *
1049
- * # Returns
1050
- * - `Ok(Vec<CipherListView>)` containing the decrypted ciphers
1051
- * - `Err(DecryptError)` if decryption fails
1052
1028
  * @param {Cipher[]} ciphers
1053
1029
  * @returns {CipherListView[]}
1054
1030
  */
@@ -1073,14 +1049,6 @@ export class CiphersClient {
1073
1049
  }
1074
1050
  }
1075
1051
  /**
1076
- * Decrypt FIDO2 credentials
1077
- *
1078
- * # Arguments
1079
- * - `cipher_view` - Cipher to encrypt containing the FIDO2 credential
1080
- *
1081
- * # Returns
1082
- * - `Ok(Vec<Fido2CredentialView>)` containing the decrypted FIDO2 credentials
1083
- * - `Err(DecryptError)` if decryption fails
1084
1052
  * @param {CipherView} cipher_view
1085
1053
  * @returns {Fido2CredentialView[]}
1086
1054
  */
@@ -1107,17 +1075,31 @@ export class CiphersClient {
1107
1075
  }
1108
1076
  }
1109
1077
  /**
1110
- * Decrypt key
1111
- *
1112
- * This method is a temporary solution to allow typescript client access to decrypted key
1113
- * values, particularly for FIDO2 credentials.
1114
- *
1115
- * # Arguments
1116
- * - `cipher_view` - Decrypted cipher containing the key
1117
- *
1118
- * # Returns
1119
- * - `Ok(String)` containing the decrypted key
1120
- * - `Err(CipherError)`
1078
+ * @param {CipherView} cipher_view
1079
+ * @param {OrganizationId} organization_id
1080
+ * @returns {CipherView}
1081
+ */
1082
+ move_to_organization(cipher_view, organization_id) {
1083
+ try {
1084
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1085
+ wasm.ciphersclient_move_to_organization(
1086
+ retptr,
1087
+ this.__wbg_ptr,
1088
+ addHeapObject(cipher_view),
1089
+ addHeapObject(organization_id),
1090
+ );
1091
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1092
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1093
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1094
+ if (r2) {
1095
+ throw takeObject(r1);
1096
+ }
1097
+ return takeObject(r0);
1098
+ } finally {
1099
+ wasm.__wbindgen_add_to_stack_pointer(16);
1100
+ }
1101
+ }
1102
+ /**
1121
1103
  * @param {CipherView} cipher_view
1122
1104
  * @returns {string}
1123
1105
  */
@@ -1451,7 +1433,25 @@ export class FoldersClient {
1451
1433
  wasm.__wbg_foldersclient_free(ptr, 0);
1452
1434
  }
1453
1435
  /**
1454
- * Decrypt folder
1436
+ * @param {FolderView} folder_view
1437
+ * @returns {Folder}
1438
+ */
1439
+ encrypt(folder_view) {
1440
+ try {
1441
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1442
+ wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
1443
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1444
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1445
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1446
+ if (r2) {
1447
+ throw takeObject(r1);
1448
+ }
1449
+ return takeObject(r0);
1450
+ } finally {
1451
+ wasm.__wbindgen_add_to_stack_pointer(16);
1452
+ }
1453
+ }
1454
+ /**
1455
1455
  * @param {Folder} folder
1456
1456
  * @returns {FolderView}
1457
1457
  */
@@ -1470,6 +1470,30 @@ export class FoldersClient {
1470
1470
  wasm.__wbindgen_add_to_stack_pointer(16);
1471
1471
  }
1472
1472
  }
1473
+ /**
1474
+ * @param {Folder[]} folders
1475
+ * @returns {FolderView[]}
1476
+ */
1477
+ decrypt_list(folders) {
1478
+ try {
1479
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1480
+ const ptr0 = passArrayJsValueToWasm0(folders, wasm.__wbindgen_malloc);
1481
+ const len0 = WASM_VECTOR_LEN;
1482
+ wasm.foldersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1483
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1484
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1485
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1486
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1487
+ if (r3) {
1488
+ throw takeObject(r2);
1489
+ }
1490
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1491
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1492
+ return v2;
1493
+ } finally {
1494
+ wasm.__wbindgen_add_to_stack_pointer(16);
1495
+ }
1496
+ }
1473
1497
  }
1474
1498
 
1475
1499
  const GeneratorClientFinalization =
@@ -3196,7 +3220,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
3196
3220
  const a = state0.a;
3197
3221
  state0.a = 0;
3198
3222
  try {
3199
- return __wbg_adapter_253(a, state0.b, arg0, arg1);
3223
+ return __wbg_adapter_256(a, state0.b, arg0, arg1);
3200
3224
  } finally {
3201
3225
  state0.a = a;
3202
3226
  }
@@ -3563,13 +3587,13 @@ export function __wbindgen_cb_drop(arg0) {
3563
3587
  return ret;
3564
3588
  }
3565
3589
 
3566
- export function __wbindgen_closure_wrapper3099(arg0, arg1, arg2) {
3567
- const ret = makeMutClosure(arg0, arg1, 705, __wbg_adapter_50);
3590
+ export function __wbindgen_closure_wrapper3197(arg0, arg1, arg2) {
3591
+ const ret = makeMutClosure(arg0, arg1, 747, __wbg_adapter_50);
3568
3592
  return addHeapObject(ret);
3569
3593
  }
3570
3594
 
3571
- export function __wbindgen_closure_wrapper3494(arg0, arg1, arg2) {
3572
- const ret = makeMutClosure(arg0, arg1, 827, __wbg_adapter_53);
3595
+ export function __wbindgen_closure_wrapper3592(arg0, arg1, arg2) {
3596
+ const ret = makeMutClosure(arg0, arg1, 869, __wbg_adapter_53);
3573
3597
  return addHeapObject(ret);
3574
3598
  }
3575
3599
 
Binary file
@@ -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;