@bitwarden/commercial-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.
@@ -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";
@@ -1702,6 +1774,14 @@ export class BitwardenClient {
1702
1774
  export class CiphersClient {
1703
1775
  private constructor();
1704
1776
  free(): void;
1777
+ /**
1778
+ * Create a new [Cipher] and save it to the server.
1779
+ */
1780
+ create(request: CipherCreateRequest): Promise<CipherView>;
1781
+ /**
1782
+ * Edit an existing [Cipher] and save it to the server.
1783
+ */
1784
+ edit(request: CipherEditRequest): Promise<CipherView>;
1705
1785
  encrypt(cipher_view: CipherView): EncryptionContext;
1706
1786
  /**
1707
1787
  * 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_343(arg0, arg1, arg2, arg3) {
896
+ function __wbg_adapter_348(arg0, arg1, arg2, arg3) {
858
897
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h54a8613170fef18e(
859
898
  arg0,
860
899
  arg1,
@@ -1312,6 +1351,24 @@ export class CiphersClient {
1312
1351
  const ptr = this.__destroy_into_raw();
1313
1352
  wasm.__wbg_ciphersclient_free(ptr, 0);
1314
1353
  }
1354
+ /**
1355
+ * Create a new [Cipher] and save it to the server.
1356
+ * @param {CipherCreateRequest} request
1357
+ * @returns {Promise<CipherView>}
1358
+ */
1359
+ create(request) {
1360
+ const ret = wasm.ciphersclient_create(this.__wbg_ptr, addHeapObject(request));
1361
+ return takeObject(ret);
1362
+ }
1363
+ /**
1364
+ * Edit an existing [Cipher] and save it to the server.
1365
+ * @param {CipherEditRequest} request
1366
+ * @returns {Promise<CipherView>}
1367
+ */
1368
+ edit(request) {
1369
+ const ret = wasm.ciphersclient_edit(this.__wbg_ptr, addHeapObject(request));
1370
+ return takeObject(ret);
1371
+ }
1315
1372
  /**
1316
1373
  * @param {CipherView} cipher_view
1317
1374
  * @returns {EncryptionContext}
@@ -4119,7 +4176,7 @@ export function __wbg_call_7cccdd69e0791ae2() {
4119
4176
  }, arguments);
4120
4177
  }
4121
4178
 
4122
- export function __wbg_cipher_3ef84bb81bec347a(arg0) {
4179
+ export function __wbg_cipher_bfaa6485361c7193(arg0) {
4123
4180
  const ret = getObject(arg0).cipher;
4124
4181
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4125
4182
  }
@@ -4199,7 +4256,7 @@ export function __wbg_fetch_509096533071c657(arg0, arg1) {
4199
4256
  return addHeapObject(ret);
4200
4257
  }
4201
4258
 
4202
- export function __wbg_folder_c58043e46963725e(arg0) {
4259
+ export function __wbg_folder_ec2d6cb62cd394ea(arg0) {
4203
4260
  const ret = getObject(arg0).folder;
4204
4261
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4205
4262
  }
@@ -4221,7 +4278,14 @@ export function __wbg_getTime_46267b1c24877e30(arg0) {
4221
4278
  return ret;
4222
4279
  }
4223
4280
 
4224
- export function __wbg_get_482497ba509c279f() {
4281
+ export function __wbg_get_67b2ba62fc30de12() {
4282
+ return handleError(function (arg0, arg1) {
4283
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
4284
+ return addHeapObject(ret);
4285
+ }, arguments);
4286
+ }
4287
+
4288
+ export function __wbg_get_6dacbdbec3b2a30b() {
4225
4289
  return handleError(function (arg0, arg1, arg2) {
4226
4290
  let deferred0_0;
4227
4291
  let deferred0_1;
@@ -4236,19 +4300,12 @@ export function __wbg_get_482497ba509c279f() {
4236
4300
  }, arguments);
4237
4301
  }
4238
4302
 
4239
- export function __wbg_get_67b2ba62fc30de12() {
4240
- return handleError(function (arg0, arg1) {
4241
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
4242
- return addHeapObject(ret);
4243
- }, arguments);
4244
- }
4245
-
4246
4303
  export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
4247
4304
  const ret = getObject(arg0)[arg1 >>> 0];
4248
4305
  return addHeapObject(ret);
4249
4306
  }
4250
4307
 
4251
- export function __wbg_get_fb2c5abe3ecf4327() {
4308
+ export function __wbg_get_f30d8f791413aaa1() {
4252
4309
  return handleError(function (arg0, arg1, arg2) {
4253
4310
  let deferred0_0;
4254
4311
  let deferred0_1;
@@ -4263,7 +4320,7 @@ export function __wbg_get_fb2c5abe3ecf4327() {
4263
4320
  }, arguments);
4264
4321
  }
4265
4322
 
4266
- export function __wbg_getaccesstoken_9e32a90d6288c168(arg0) {
4323
+ export function __wbg_getaccesstoken_b02a0476dedfb4e3(arg0) {
4267
4324
  const ret = getObject(arg0).get_access_token();
4268
4325
  return addHeapObject(ret);
4269
4326
  }
@@ -4448,14 +4505,14 @@ export function __wbg_length_e2d2a49132c1b256(arg0) {
4448
4505
  return ret;
4449
4506
  }
4450
4507
 
4451
- export function __wbg_list_8e8e87c793258a92() {
4508
+ export function __wbg_list_2c26b179cf05e46b() {
4452
4509
  return handleError(function (arg0) {
4453
4510
  const ret = getObject(arg0).list();
4454
4511
  return addHeapObject(ret);
4455
4512
  }, arguments);
4456
4513
  }
4457
4514
 
4458
- export function __wbg_list_b2e76202b8524498() {
4515
+ export function __wbg_list_314b5bbafea38250() {
4459
4516
  return handleError(function (arg0) {
4460
4517
  const ret = getObject(arg0).list();
4461
4518
  return addHeapObject(ret);
@@ -4498,7 +4555,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
4498
4555
  const a = state0.a;
4499
4556
  state0.a = 0;
4500
4557
  try {
4501
- return __wbg_adapter_343(a, state0.b, arg0, arg1);
4558
+ return __wbg_adapter_348(a, state0.b, arg0, arg1);
4502
4559
  } finally {
4503
4560
  state0.a = a;
4504
4561
  }
@@ -4656,7 +4713,7 @@ export function __wbg_randomFillSync_ac0988aba3254290() {
4656
4713
  }, arguments);
4657
4714
  }
4658
4715
 
4659
- export function __wbg_remove_1d11b7043a9b2631() {
4716
+ export function __wbg_remove_1053ec403a6c0a33() {
4660
4717
  return handleError(function (arg0, arg1, arg2) {
4661
4718
  let deferred0_0;
4662
4719
  let deferred0_1;
@@ -4671,7 +4728,7 @@ export function __wbg_remove_1d11b7043a9b2631() {
4671
4728
  }, arguments);
4672
4729
  }
4673
4730
 
4674
- export function __wbg_remove_4bdd32ee030cdba5() {
4731
+ export function __wbg_remove_8f22cc225864443a() {
4675
4732
  return handleError(function (arg0, arg1, arg2) {
4676
4733
  let deferred0_0;
4677
4734
  let deferred0_1;
@@ -4725,11 +4782,7 @@ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
4725
4782
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
4726
4783
  }
4727
4784
 
4728
- export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
4729
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4730
- }
4731
-
4732
- export function __wbg_set_77e9220d80206e12() {
4785
+ export function __wbg_set_5737fc6e1e0d1ccc() {
4733
4786
  return handleError(function (arg0, arg1, arg2, arg3) {
4734
4787
  let deferred0_0;
4735
4788
  let deferred0_1;
@@ -4744,12 +4797,11 @@ export function __wbg_set_77e9220d80206e12() {
4744
4797
  }, arguments);
4745
4798
  }
4746
4799
 
4747
- export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
4748
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
4749
- return addHeapObject(ret);
4800
+ export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
4801
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4750
4802
  }
4751
4803
 
4752
- export function __wbg_set_b2324c129f5cbef0() {
4804
+ export function __wbg_set_74670a99dc6a4654() {
4753
4805
  return handleError(function (arg0, arg1, arg2, arg3) {
4754
4806
  let deferred0_0;
4755
4807
  let deferred0_1;
@@ -4764,6 +4816,11 @@ export function __wbg_set_b2324c129f5cbef0() {
4764
4816
  }, arguments);
4765
4817
  }
4766
4818
 
4819
+ export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
4820
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
4821
+ return addHeapObject(ret);
4822
+ }
4823
+
4767
4824
  export function __wbg_setbody_5923b78a95eedf29(arg0, arg1) {
4768
4825
  getObject(arg0).body = getObject(arg1);
4769
4826
  }
@@ -4984,18 +5041,18 @@ export function __wbindgen_closure_wrapper195(arg0, arg1, arg2) {
4984
5041
  return addHeapObject(ret);
4985
5042
  }
4986
5043
 
4987
- export function __wbindgen_closure_wrapper3861(arg0, arg1, arg2) {
4988
- const ret = makeMutClosure(arg0, arg1, 293, __wbg_adapter_60);
5044
+ export function __wbindgen_closure_wrapper3942(arg0, arg1, arg2) {
5045
+ const ret = makeMutClosure(arg0, arg1, 298, __wbg_adapter_60);
4989
5046
  return addHeapObject(ret);
4990
5047
  }
4991
5048
 
4992
- export function __wbindgen_closure_wrapper6193(arg0, arg1, arg2) {
4993
- const ret = makeMutClosure(arg0, arg1, 319, __wbg_adapter_60);
5049
+ export function __wbindgen_closure_wrapper6415(arg0, arg1, arg2) {
5050
+ const ret = makeMutClosure(arg0, arg1, 324, __wbg_adapter_60);
4994
5051
  return addHeapObject(ret);
4995
5052
  }
4996
5053
 
4997
- export function __wbindgen_closure_wrapper6573(arg0, arg1, arg2) {
4998
- const ret = makeMutClosure(arg0, arg1, 342, __wbg_adapter_57);
5054
+ export function __wbindgen_closure_wrapper6795(arg0, arg1, arg2) {
5055
+ const ret = makeMutClosure(arg0, arg1, 347, __wbg_adapter_57);
4999
5056
  return addHeapObject(ret);
5000
5057
  }
5001
5058
 
Binary file
@@ -321,6 +321,8 @@ export const attachmentsclient_decrypt_buffer: (
321
321
  e: number,
322
322
  f: number,
323
323
  ) => void;
324
+ export const ciphersclient_create: (a: number, b: number) => number;
325
+ export const ciphersclient_edit: (a: number, b: number) => number;
324
326
  export const ciphersclient_encrypt: (a: number, b: number, c: number) => void;
325
327
  export const ciphersclient_encrypt_cipher_for_rotation: (
326
328
  a: number,
@@ -380,6 +382,9 @@ export const isTotpError: (a: number) => number;
380
382
  export const isGetFolderError: (a: number) => number;
381
383
  export const isEditFolderError: (a: number) => number;
382
384
  export const isCreateFolderError: (a: number) => number;
385
+ export const isGetCipherError: (a: number) => number;
386
+ export const isEditCipherError: (a: number) => number;
387
+ export const isCreateCipherError: (a: number) => number;
383
388
  export const isCipherError: (a: number) => number;
384
389
  export const isDecryptFileError: (a: number) => number;
385
390
  export const isEncryptFileError: (a: number) => number;