@bitwarden/sdk-internal 0.2.0-main.354 → 0.2.0-main.356

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
- 2a00b727c1d0dcd7cd1a80f4652bbe739eac7909
1
+ d553d3791b9e3afd931a863e61ff92938b504c8c
@@ -1216,6 +1216,39 @@ export interface DecryptCipherListResult {
1216
1216
  failures: Cipher[];
1217
1217
  }
1218
1218
 
1219
+ /**
1220
+ * Request to add a cipher.
1221
+ */
1222
+ export interface CipherCreateRequest {
1223
+ organizationId: OrganizationId | undefined;
1224
+ folderId: FolderId | undefined;
1225
+ name: string;
1226
+ notes: string | undefined;
1227
+ favorite: boolean;
1228
+ reprompt: CipherRepromptType;
1229
+ type: CipherViewType;
1230
+ fields: FieldView[];
1231
+ }
1232
+
1233
+ /**
1234
+ * Request to edit a cipher.
1235
+ */
1236
+ export interface CipherEditRequest {
1237
+ id: CipherId;
1238
+ organizationId: OrganizationId | undefined;
1239
+ folderId: FolderId | undefined;
1240
+ favorite: boolean;
1241
+ reprompt: CipherRepromptType;
1242
+ name: string;
1243
+ notes: string | undefined;
1244
+ fields: FieldView[];
1245
+ type: CipherViewType;
1246
+ revisionDate: DateTime<Utc>;
1247
+ archivedDate: DateTime<Utc> | undefined;
1248
+ attachments: AttachmentView[];
1249
+ key: EncString | undefined;
1250
+ }
1251
+
1219
1252
  export interface Field {
1220
1253
  name: EncString | undefined;
1221
1254
  value: EncString | undefined;
@@ -1537,11 +1570,50 @@ export interface Identity {
1537
1570
  licenseNumber: EncString | undefined;
1538
1571
  }
1539
1572
 
1573
+ /**
1574
+ * Represents the inner data of a cipher view.
1575
+ */
1576
+ export type CipherViewType =
1577
+ | { login: LoginView }
1578
+ | { card: CardView }
1579
+ | { identity: IdentityView }
1580
+ | { secureNote: SecureNoteView }
1581
+ | { sshKey: SshKeyView };
1582
+
1540
1583
  export interface CipherPermissions {
1541
1584
  delete: boolean;
1542
1585
  restore: boolean;
1543
1586
  }
1544
1587
 
1588
+ export interface GetCipherError extends Error {
1589
+ name: "GetCipherError";
1590
+ variant: "ItemNotFound" | "Crypto" | "RepositoryError";
1591
+ }
1592
+
1593
+ export function isGetCipherError(error: any): error is GetCipherError;
1594
+
1595
+ export interface EditCipherError extends Error {
1596
+ name: "EditCipherError";
1597
+ variant:
1598
+ | "ItemNotFound"
1599
+ | "Crypto"
1600
+ | "Api"
1601
+ | "VaultParse"
1602
+ | "MissingField"
1603
+ | "NotAuthenticated"
1604
+ | "Repository"
1605
+ | "Uuid";
1606
+ }
1607
+
1608
+ export function isEditCipherError(error: any): error is EditCipherError;
1609
+
1610
+ export interface CreateCipherError extends Error {
1611
+ name: "CreateCipherError";
1612
+ variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "NotAuthenticated" | "Repository";
1613
+ }
1614
+
1615
+ export function isCreateCipherError(error: any): error is CreateCipherError;
1616
+
1545
1617
  export interface CipherError extends Error {
1546
1618
  name: "CipherError";
1547
1619
  variant: "MissingField" | "Crypto" | "Encrypt" | "AttachmentsWithoutKeys";
@@ -1698,6 +1770,14 @@ export class BitwardenClient {
1698
1770
  export class CiphersClient {
1699
1771
  private constructor();
1700
1772
  free(): void;
1773
+ /**
1774
+ * Create a new [Cipher] and save it to the server.
1775
+ */
1776
+ create(request: CipherCreateRequest): Promise<CipherView>;
1777
+ /**
1778
+ * Edit an existing [Cipher] and save it to the server.
1779
+ */
1780
+ edit(request: CipherEditRequest): Promise<CipherView>;
1701
1781
  encrypt(cipher_view: CipherView): EncryptionContext;
1702
1782
  /**
1703
1783
  * Encrypt a cipher with the provided key. This should only be used when rotating encryption
@@ -781,6 +781,45 @@ export function isCreateFolderError(error) {
781
781
  }
782
782
  }
783
783
 
784
+ /**
785
+ * @param {any} error
786
+ * @returns {boolean}
787
+ */
788
+ export function isGetCipherError(error) {
789
+ try {
790
+ const ret = wasm.isGetCipherError(addBorrowedObject(error));
791
+ return ret !== 0;
792
+ } finally {
793
+ heap[stack_pointer++] = undefined;
794
+ }
795
+ }
796
+
797
+ /**
798
+ * @param {any} error
799
+ * @returns {boolean}
800
+ */
801
+ export function isEditCipherError(error) {
802
+ try {
803
+ const ret = wasm.isEditCipherError(addBorrowedObject(error));
804
+ return ret !== 0;
805
+ } finally {
806
+ heap[stack_pointer++] = undefined;
807
+ }
808
+ }
809
+
810
+ /**
811
+ * @param {any} error
812
+ * @returns {boolean}
813
+ */
814
+ export function isCreateCipherError(error) {
815
+ try {
816
+ const ret = wasm.isCreateCipherError(addBorrowedObject(error));
817
+ return ret !== 0;
818
+ } finally {
819
+ heap[stack_pointer++] = undefined;
820
+ }
821
+ }
822
+
784
823
  /**
785
824
  * @param {any} error
786
825
  * @returns {boolean}
@@ -854,7 +893,7 @@ function __wbg_adapter_60(arg0, arg1) {
854
893
  );
855
894
  }
856
895
 
857
- function __wbg_adapter_341(arg0, arg1, arg2, arg3) {
896
+ function __wbg_adapter_346(arg0, arg1, arg2, arg3) {
858
897
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h54a8613170fef18e(
859
898
  arg0,
860
899
  arg1,
@@ -1304,6 +1343,24 @@ export class CiphersClient {
1304
1343
  const ptr = this.__destroy_into_raw();
1305
1344
  wasm.__wbg_ciphersclient_free(ptr, 0);
1306
1345
  }
1346
+ /**
1347
+ * Create a new [Cipher] and save it to the server.
1348
+ * @param {CipherCreateRequest} request
1349
+ * @returns {Promise<CipherView>}
1350
+ */
1351
+ create(request) {
1352
+ const ret = wasm.ciphersclient_create(this.__wbg_ptr, addHeapObject(request));
1353
+ return takeObject(ret);
1354
+ }
1355
+ /**
1356
+ * Edit an existing [Cipher] and save it to the server.
1357
+ * @param {CipherEditRequest} request
1358
+ * @returns {Promise<CipherView>}
1359
+ */
1360
+ edit(request) {
1361
+ const ret = wasm.ciphersclient_edit(this.__wbg_ptr, addHeapObject(request));
1362
+ return takeObject(ret);
1363
+ }
1307
1364
  /**
1308
1365
  * @param {CipherView} cipher_view
1309
1366
  * @returns {EncryptionContext}
@@ -4045,7 +4102,7 @@ export function __wbg_call_7cccdd69e0791ae2() {
4045
4102
  }, arguments);
4046
4103
  }
4047
4104
 
4048
- export function __wbg_cipher_3ef84bb81bec347a(arg0) {
4105
+ export function __wbg_cipher_bfaa6485361c7193(arg0) {
4049
4106
  const ret = getObject(arg0).cipher;
4050
4107
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4051
4108
  }
@@ -4125,7 +4182,7 @@ export function __wbg_fetch_509096533071c657(arg0, arg1) {
4125
4182
  return addHeapObject(ret);
4126
4183
  }
4127
4184
 
4128
- export function __wbg_folder_c58043e46963725e(arg0) {
4185
+ export function __wbg_folder_ec2d6cb62cd394ea(arg0) {
4129
4186
  const ret = getObject(arg0).folder;
4130
4187
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4131
4188
  }
@@ -4147,7 +4204,14 @@ export function __wbg_getTime_46267b1c24877e30(arg0) {
4147
4204
  return ret;
4148
4205
  }
4149
4206
 
4150
- export function __wbg_get_482497ba509c279f() {
4207
+ export function __wbg_get_67b2ba62fc30de12() {
4208
+ return handleError(function (arg0, arg1) {
4209
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
4210
+ return addHeapObject(ret);
4211
+ }, arguments);
4212
+ }
4213
+
4214
+ export function __wbg_get_6dacbdbec3b2a30b() {
4151
4215
  return handleError(function (arg0, arg1, arg2) {
4152
4216
  let deferred0_0;
4153
4217
  let deferred0_1;
@@ -4162,19 +4226,12 @@ export function __wbg_get_482497ba509c279f() {
4162
4226
  }, arguments);
4163
4227
  }
4164
4228
 
4165
- export function __wbg_get_67b2ba62fc30de12() {
4166
- return handleError(function (arg0, arg1) {
4167
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
4168
- return addHeapObject(ret);
4169
- }, arguments);
4170
- }
4171
-
4172
4229
  export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
4173
4230
  const ret = getObject(arg0)[arg1 >>> 0];
4174
4231
  return addHeapObject(ret);
4175
4232
  }
4176
4233
 
4177
- export function __wbg_get_fb2c5abe3ecf4327() {
4234
+ export function __wbg_get_f30d8f791413aaa1() {
4178
4235
  return handleError(function (arg0, arg1, arg2) {
4179
4236
  let deferred0_0;
4180
4237
  let deferred0_1;
@@ -4189,7 +4246,7 @@ export function __wbg_get_fb2c5abe3ecf4327() {
4189
4246
  }, arguments);
4190
4247
  }
4191
4248
 
4192
- export function __wbg_getaccesstoken_9e32a90d6288c168(arg0) {
4249
+ export function __wbg_getaccesstoken_b02a0476dedfb4e3(arg0) {
4193
4250
  const ret = getObject(arg0).get_access_token();
4194
4251
  return addHeapObject(ret);
4195
4252
  }
@@ -4374,14 +4431,14 @@ export function __wbg_length_e2d2a49132c1b256(arg0) {
4374
4431
  return ret;
4375
4432
  }
4376
4433
 
4377
- export function __wbg_list_8e8e87c793258a92() {
4434
+ export function __wbg_list_2c26b179cf05e46b() {
4378
4435
  return handleError(function (arg0) {
4379
4436
  const ret = getObject(arg0).list();
4380
4437
  return addHeapObject(ret);
4381
4438
  }, arguments);
4382
4439
  }
4383
4440
 
4384
- export function __wbg_list_b2e76202b8524498() {
4441
+ export function __wbg_list_314b5bbafea38250() {
4385
4442
  return handleError(function (arg0) {
4386
4443
  const ret = getObject(arg0).list();
4387
4444
  return addHeapObject(ret);
@@ -4424,7 +4481,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
4424
4481
  const a = state0.a;
4425
4482
  state0.a = 0;
4426
4483
  try {
4427
- return __wbg_adapter_341(a, state0.b, arg0, arg1);
4484
+ return __wbg_adapter_346(a, state0.b, arg0, arg1);
4428
4485
  } finally {
4429
4486
  state0.a = a;
4430
4487
  }
@@ -4582,7 +4639,7 @@ export function __wbg_randomFillSync_ac0988aba3254290() {
4582
4639
  }, arguments);
4583
4640
  }
4584
4641
 
4585
- export function __wbg_remove_1d11b7043a9b2631() {
4642
+ export function __wbg_remove_1053ec403a6c0a33() {
4586
4643
  return handleError(function (arg0, arg1, arg2) {
4587
4644
  let deferred0_0;
4588
4645
  let deferred0_1;
@@ -4597,7 +4654,7 @@ export function __wbg_remove_1d11b7043a9b2631() {
4597
4654
  }, arguments);
4598
4655
  }
4599
4656
 
4600
- export function __wbg_remove_4bdd32ee030cdba5() {
4657
+ export function __wbg_remove_8f22cc225864443a() {
4601
4658
  return handleError(function (arg0, arg1, arg2) {
4602
4659
  let deferred0_0;
4603
4660
  let deferred0_1;
@@ -4651,11 +4708,7 @@ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
4651
4708
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
4652
4709
  }
4653
4710
 
4654
- export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
4655
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4656
- }
4657
-
4658
- export function __wbg_set_77e9220d80206e12() {
4711
+ export function __wbg_set_5737fc6e1e0d1ccc() {
4659
4712
  return handleError(function (arg0, arg1, arg2, arg3) {
4660
4713
  let deferred0_0;
4661
4714
  let deferred0_1;
@@ -4670,12 +4723,11 @@ export function __wbg_set_77e9220d80206e12() {
4670
4723
  }, arguments);
4671
4724
  }
4672
4725
 
4673
- export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
4674
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
4675
- return addHeapObject(ret);
4726
+ export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
4727
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4676
4728
  }
4677
4729
 
4678
- export function __wbg_set_b2324c129f5cbef0() {
4730
+ export function __wbg_set_74670a99dc6a4654() {
4679
4731
  return handleError(function (arg0, arg1, arg2, arg3) {
4680
4732
  let deferred0_0;
4681
4733
  let deferred0_1;
@@ -4690,6 +4742,11 @@ export function __wbg_set_b2324c129f5cbef0() {
4690
4742
  }, arguments);
4691
4743
  }
4692
4744
 
4745
+ export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
4746
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
4747
+ return addHeapObject(ret);
4748
+ }
4749
+
4693
4750
  export function __wbg_setbody_5923b78a95eedf29(arg0, arg1) {
4694
4751
  getObject(arg0).body = getObject(arg1);
4695
4752
  }
@@ -4910,18 +4967,18 @@ export function __wbindgen_closure_wrapper195(arg0, arg1, arg2) {
4910
4967
  return addHeapObject(ret);
4911
4968
  }
4912
4969
 
4913
- export function __wbindgen_closure_wrapper3849(arg0, arg1, arg2) {
4914
- const ret = makeMutClosure(arg0, arg1, 293, __wbg_adapter_60);
4970
+ export function __wbindgen_closure_wrapper3930(arg0, arg1, arg2) {
4971
+ const ret = makeMutClosure(arg0, arg1, 298, __wbg_adapter_60);
4915
4972
  return addHeapObject(ret);
4916
4973
  }
4917
4974
 
4918
- export function __wbindgen_closure_wrapper6181(arg0, arg1, arg2) {
4919
- const ret = makeMutClosure(arg0, arg1, 319, __wbg_adapter_60);
4975
+ export function __wbindgen_closure_wrapper6403(arg0, arg1, arg2) {
4976
+ const ret = makeMutClosure(arg0, arg1, 324, __wbg_adapter_60);
4920
4977
  return addHeapObject(ret);
4921
4978
  }
4922
4979
 
4923
- export function __wbindgen_closure_wrapper6561(arg0, arg1, arg2) {
4924
- const ret = makeMutClosure(arg0, arg1, 342, __wbg_adapter_54);
4980
+ export function __wbindgen_closure_wrapper6783(arg0, arg1, arg2) {
4981
+ const ret = makeMutClosure(arg0, arg1, 347, __wbg_adapter_54);
4925
4982
  return addHeapObject(ret);
4926
4983
  }
4927
4984
 
Binary file
@@ -317,6 +317,8 @@ export const attachmentsclient_decrypt_buffer: (
317
317
  e: number,
318
318
  f: number,
319
319
  ) => void;
320
+ export const ciphersclient_create: (a: number, b: number) => number;
321
+ export const ciphersclient_edit: (a: number, b: number) => number;
320
322
  export const ciphersclient_encrypt: (a: number, b: number, c: number) => void;
321
323
  export const ciphersclient_encrypt_cipher_for_rotation: (
322
324
  a: number,
@@ -376,6 +378,9 @@ export const isTotpError: (a: number) => number;
376
378
  export const isGetFolderError: (a: number) => number;
377
379
  export const isEditFolderError: (a: number) => number;
378
380
  export const isCreateFolderError: (a: number) => number;
381
+ export const isGetCipherError: (a: number) => number;
382
+ export const isEditCipherError: (a: number) => number;
383
+ export const isCreateCipherError: (a: number) => number;
379
384
  export const isCipherError: (a: number) => number;
380
385
  export const isDecryptFileError: (a: number) => number;
381
386
  export const isEncryptFileError: (a: number) => number;