@bitwarden/sdk-internal 0.2.0-main.296 → 0.2.0-main.298

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
- 9ac1d3eaa60e719368d4758c025e55208ce639f8
1
+ 9b1253afd38f7d1df151631d28a96931a3654647
@@ -179,6 +179,138 @@ export interface TestError extends Error {
179
179
 
180
180
  export function isTestError(error: any): error is TestError;
181
181
 
182
+ /**
183
+ * Represents the possible, expected errors that can occur when requesting a send access token.
184
+ */
185
+ export type SendAccessTokenApiErrorResponse =
186
+ | {
187
+ error: "invalid_request";
188
+ error_description?: string;
189
+ send_access_error_type?: SendAccessTokenInvalidRequestError;
190
+ }
191
+ | {
192
+ error: "invalid_grant";
193
+ error_description?: string;
194
+ send_access_error_type?: SendAccessTokenInvalidGrantError;
195
+ }
196
+ | { error: "invalid_client"; error_description?: string }
197
+ | { error: "unauthorized_client"; error_description?: string }
198
+ | { error: "unsupported_grant_type"; error_description?: string }
199
+ | { error: "invalid_scope"; error_description?: string }
200
+ | { error: "invalid_target"; error_description?: string };
201
+
202
+ /**
203
+ * Invalid grant errors - typically due to invalid credentials.
204
+ */
205
+ export type SendAccessTokenInvalidGrantError =
206
+ | "send_id_invalid"
207
+ | "password_hash_b64_invalid"
208
+ | "email_invalid"
209
+ | "otp_invalid"
210
+ | "otp_generation_failed"
211
+ | "unknown";
212
+
213
+ /**
214
+ * Invalid request errors - typically due to missing parameters.
215
+ */
216
+ export type SendAccessTokenInvalidRequestError =
217
+ | "send_id_required"
218
+ | "password_hash_b64_required"
219
+ | "email_required"
220
+ | "email_and_otp_required_otp_sent"
221
+ | "unknown";
222
+
223
+ /**
224
+ * Any unexpected error that occurs when making requests to identity. This could be
225
+ * local/transport/decoding failure from the HTTP client (DNS/TLS/connect/read timeout,
226
+ * connection reset, or JSON decode failure on a success response) or non-2xx response with an
227
+ * unexpected body or status. Used when decoding the server\'s error payload into
228
+ * `SendAccessTokenApiErrorResponse` fails, or for 5xx responses where no structured error is
229
+ * available.
230
+ */
231
+ export type UnexpectedIdentityError = string;
232
+
233
+ /**
234
+ * Represents errors that can occur when requesting a send access token.
235
+ * It includes expected and unexpected API errors.
236
+ */
237
+ export type SendAccessTokenError =
238
+ | { kind: "unexpected"; data: UnexpectedIdentityError }
239
+ | { kind: "expected"; data: SendAccessTokenApiErrorResponse };
240
+
241
+ /**
242
+ * A send access token which can be used to access a send.
243
+ */
244
+ export interface SendAccessTokenResponse {
245
+ /**
246
+ * The actual token string.
247
+ */
248
+ token: string;
249
+ /**
250
+ * The timestamp in milliseconds when the token expires.
251
+ */
252
+ expiresAt: number;
253
+ }
254
+
255
+ /**
256
+ * A request structure for requesting a send access token from the API.
257
+ */
258
+ export interface SendAccessTokenRequest {
259
+ /**
260
+ * The id of the send for which the access token is requested.
261
+ */
262
+ sendId: string;
263
+ /**
264
+ * The optional send access credentials.
265
+ */
266
+ sendAccessCredentials?: SendAccessCredentials;
267
+ }
268
+
269
+ /**
270
+ * The credentials used for send access requests.
271
+ */
272
+ export type SendAccessCredentials =
273
+ | SendPasswordCredentials
274
+ | SendEmailCredentials
275
+ | SendEmailOtpCredentials;
276
+
277
+ /**
278
+ * Credentials for getting a send access token using an email and OTP.
279
+ */
280
+ export interface SendEmailOtpCredentials {
281
+ /**
282
+ * The email address to which the OTP will be sent.
283
+ */
284
+ email: string;
285
+ /**
286
+ * The one-time password (OTP) that the user has received via email.
287
+ */
288
+ otp: string;
289
+ }
290
+
291
+ /**
292
+ * Credentials for sending an OTP to the user\'s email address.
293
+ * This is used when the send requires email verification with an OTP.
294
+ */
295
+ export interface SendEmailCredentials {
296
+ /**
297
+ * The email address to which the OTP will be sent.
298
+ */
299
+ email: string;
300
+ }
301
+
302
+ /**
303
+ * Credentials for sending password secured access requests.
304
+ * Clone auto implements the standard lib\'s Clone trait, allowing us to create copies of this
305
+ * struct.
306
+ */
307
+ export interface SendPasswordCredentials {
308
+ /**
309
+ * A Base64-encoded hash of the password protecting the send.
310
+ */
311
+ passwordHashB64: string;
312
+ }
313
+
182
314
  /**
183
315
  * NewType wrapper for `CollectionId`
184
316
  */
@@ -483,7 +615,7 @@ export function isCryptoClientError(error: any): error is CryptoClientError;
483
615
 
484
616
  export interface StatefulCryptoError extends Error {
485
617
  name: "StatefulCryptoError";
486
- variant: "MissingSecurityState" | "WrongAccountCryptoVersion" | "CryptoError";
618
+ variant: "MissingSecurityState" | "WrongAccountCryptoVersion" | "Crypto";
487
619
  }
488
620
 
489
621
  export function isStatefulCryptoError(error: any): error is StatefulCryptoError;
@@ -496,7 +628,7 @@ export interface EncryptionSettingsError extends Error {
496
628
  | "InvalidSigningKey"
497
629
  | "InvalidSecurityState"
498
630
  | "MissingPrivateKey"
499
- | "UserIdAlreadySetError"
631
+ | "UserIdAlreadySet"
500
632
  | "WrongPin";
501
633
  }
502
634
 
@@ -602,8 +734,8 @@ export interface CryptoError extends Error {
602
734
  | "ReadOnlyKeyStore"
603
735
  | "InsufficientKdfParameters"
604
736
  | "EncString"
605
- | "RsaError"
606
- | "FingerprintError"
737
+ | "Rsa"
738
+ | "Fingerprint"
607
739
  | "ArgonError"
608
740
  | "ZeroNumber"
609
741
  | "OperationNotSupported"
@@ -611,8 +743,8 @@ export interface CryptoError extends Error {
611
743
  | "WrongCoseKeyId"
612
744
  | "InvalidNonceLength"
613
745
  | "InvalidPadding"
614
- | "SignatureError"
615
- | "EncodingError";
746
+ | "Signature"
747
+ | "Encoding";
616
748
  }
617
749
 
618
750
  export function isCryptoError(error: any): error is CryptoError;
@@ -643,11 +775,11 @@ export interface ExportError extends Error {
643
775
  | "MissingField"
644
776
  | "NotAuthenticated"
645
777
  | "Csv"
646
- | "CxfError"
778
+ | "Cxf"
647
779
  | "Json"
648
- | "EncryptedJsonError"
649
- | "BitwardenCryptoError"
650
- | "CipherError";
780
+ | "EncryptedJson"
781
+ | "BitwardenCrypto"
782
+ | "Cipher";
651
783
  }
652
784
 
653
785
  export function isExportError(error: any): error is ExportError;
@@ -799,7 +931,7 @@ export function isDeserializeError(error: any): error is DeserializeError;
799
931
 
800
932
  export interface RequestError extends Error {
801
933
  name: "RequestError";
802
- variant: "Subscribe" | "Receive" | "Timeout" | "Send" | "RpcError";
934
+ variant: "Subscribe" | "Receive" | "Timeout" | "Send" | "Rpc";
803
935
  }
804
936
 
805
937
  export function isRequestError(error: any): error is RequestError;
@@ -829,21 +961,21 @@ export type KeyAlgorithm = "Ed25519" | "Rsa3072" | "Rsa4096";
829
961
 
830
962
  export interface SshKeyExportError extends Error {
831
963
  name: "SshKeyExportError";
832
- variant: "KeyConversionError";
964
+ variant: "KeyConversion";
833
965
  }
834
966
 
835
967
  export function isSshKeyExportError(error: any): error is SshKeyExportError;
836
968
 
837
969
  export interface SshKeyImportError extends Error {
838
970
  name: "SshKeyImportError";
839
- variant: "ParsingError" | "PasswordRequired" | "WrongPassword" | "UnsupportedKeyType";
971
+ variant: "Parsing" | "PasswordRequired" | "WrongPassword" | "UnsupportedKeyType";
840
972
  }
841
973
 
842
974
  export function isSshKeyImportError(error: any): error is SshKeyImportError;
843
975
 
844
976
  export interface KeyGenerationError extends Error {
845
977
  name: "KeyGenerationError";
846
- variant: "KeyGenerationError" | "KeyConversionError";
978
+ variant: "KeyGeneration" | "KeyConversion";
847
979
  }
848
980
 
849
981
  export function isKeyGenerationError(error: any): error is KeyGenerationError;
@@ -1224,7 +1356,7 @@ export interface TotpResponse {
1224
1356
 
1225
1357
  export interface TotpError extends Error {
1226
1358
  name: "TotpError";
1227
- variant: "InvalidOtpauth" | "MissingSecret" | "CryptoError";
1359
+ variant: "InvalidOtpauth" | "MissingSecret" | "Crypto";
1228
1360
  }
1229
1361
 
1230
1362
  export function isTotpError(error: any): error is TotpError;
@@ -1356,7 +1488,7 @@ export interface CipherPermissions {
1356
1488
 
1357
1489
  export interface CipherError extends Error {
1358
1490
  name: "CipherError";
1359
- variant: "MissingFieldError" | "CryptoError" | "EncryptError" | "AttachmentsWithoutKeys";
1491
+ variant: "MissingField" | "Crypto" | "Encrypt" | "AttachmentsWithoutKeys";
1360
1492
  }
1361
1493
 
1362
1494
  export function isCipherError(error: any): error is CipherError;
@@ -1915,13 +2047,16 @@ export class PureCrypto {
1915
2047
  */
1916
2048
  static derive_kdf_material(password: Uint8Array, salt: Uint8Array, kdf: Kdf): Uint8Array;
1917
2049
  }
2050
+ /**
2051
+ * The `SendAccessClient` is used to interact with the Bitwarden API to get send access tokens.
2052
+ */
1918
2053
  export class SendAccessClient {
1919
2054
  private constructor();
1920
2055
  free(): void;
1921
2056
  /**
1922
- * Request an access token for the provided send
2057
+ * Requests a new send access token.
1923
2058
  */
1924
- request_send_access_token(request: string): Promise<string>;
2059
+ request_send_access_token(request: SendAccessTokenRequest): Promise<SendAccessTokenResponse>;
1925
2060
  }
1926
2061
  export class StateClient {
1927
2062
  private constructor();
@@ -834,7 +834,7 @@ export function isEncryptFileError(error) {
834
834
  }
835
835
 
836
836
  function __wbg_adapter_54(arg0, arg1, arg2) {
837
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6a23de37c0a4c025(
837
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb3d7232059e1cc02(
838
838
  arg0,
839
839
  arg1,
840
840
  addHeapObject(arg2),
@@ -844,7 +844,7 @@ function __wbg_adapter_54(arg0, arg1, arg2) {
844
844
  function __wbg_adapter_57(arg0, arg1, arg2) {
845
845
  try {
846
846
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
847
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3dbaf14f9a6d0ccb(
847
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0165cee9349ff8be(
848
848
  retptr,
849
849
  arg0,
850
850
  arg1,
@@ -3689,7 +3689,9 @@ const SendAccessClientFinalization =
3689
3689
  typeof FinalizationRegistry === "undefined"
3690
3690
  ? { register: () => {}, unregister: () => {} }
3691
3691
  : new FinalizationRegistry((ptr) => wasm.__wbg_sendaccessclient_free(ptr >>> 0, 1));
3692
-
3692
+ /**
3693
+ * The `SendAccessClient` is used to interact with the Bitwarden API to get send access tokens.
3694
+ */
3693
3695
  export class SendAccessClient {
3694
3696
  static __wrap(ptr) {
3695
3697
  ptr = ptr >>> 0;
@@ -3711,14 +3713,15 @@ export class SendAccessClient {
3711
3713
  wasm.__wbg_sendaccessclient_free(ptr, 0);
3712
3714
  }
3713
3715
  /**
3714
- * Request an access token for the provided send
3715
- * @param {string} request
3716
- * @returns {Promise<string>}
3716
+ * Requests a new send access token.
3717
+ * @param {SendAccessTokenRequest} request
3718
+ * @returns {Promise<SendAccessTokenResponse>}
3717
3719
  */
3718
3720
  request_send_access_token(request) {
3719
- const ptr0 = passStringToWasm0(request, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3720
- const len0 = WASM_VECTOR_LEN;
3721
- const ret = wasm.sendaccessclient_request_send_access_token(this.__wbg_ptr, ptr0, len0);
3721
+ const ret = wasm.sendaccessclient_request_send_access_token(
3722
+ this.__wbg_ptr,
3723
+ addHeapObject(request),
3724
+ );
3722
3725
  return takeObject(ret);
3723
3726
  }
3724
3727
  }
@@ -3955,6 +3958,13 @@ export function __wbg_append_b44785ebeb668479() {
3955
3958
  }, arguments);
3956
3959
  }
3957
3960
 
3961
+ export function __wbg_arrayBuffer_d1b44c4390db422f() {
3962
+ return handleError(function (arg0) {
3963
+ const ret = getObject(arg0).arrayBuffer();
3964
+ return addHeapObject(ret);
3965
+ }, arguments);
3966
+ }
3967
+
3958
3968
  export function __wbg_buffer_609cc3eee51ed158(arg0) {
3959
3969
  const ret = getObject(arg0).buffer;
3960
3970
  return addHeapObject(ret);
@@ -4060,7 +4070,7 @@ export function __wbg_getTime_46267b1c24877e30(arg0) {
4060
4070
  return ret;
4061
4071
  }
4062
4072
 
4063
- export function __wbg_get_5fa4ede81d7776e8() {
4073
+ export function __wbg_get_5954c491716c2aba() {
4064
4074
  return handleError(function (arg0, arg1, arg2) {
4065
4075
  let deferred0_0;
4066
4076
  let deferred0_1;
@@ -4082,7 +4092,12 @@ export function __wbg_get_67b2ba62fc30de12() {
4082
4092
  }, arguments);
4083
4093
  }
4084
4094
 
4085
- export function __wbg_get_a1b35b65570b6bdc() {
4095
+ export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
4096
+ const ret = getObject(arg0)[arg1 >>> 0];
4097
+ return addHeapObject(ret);
4098
+ }
4099
+
4100
+ export function __wbg_get_f292da1aaf91a9f6() {
4086
4101
  return handleError(function (arg0, arg1, arg2) {
4087
4102
  let deferred0_0;
4088
4103
  let deferred0_1;
@@ -4097,12 +4112,7 @@ export function __wbg_get_a1b35b65570b6bdc() {
4097
4112
  }, arguments);
4098
4113
  }
4099
4114
 
4100
- export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
4101
- const ret = getObject(arg0)[arg1 >>> 0];
4102
- return addHeapObject(ret);
4103
- }
4104
-
4105
- export function __wbg_getaccesstoken_1f8e838d1d6f1b7a(arg0) {
4115
+ export function __wbg_getaccesstoken_83d6cb0a610d80fb(arg0) {
4106
4116
  const ret = getObject(arg0).get_access_token();
4107
4117
  return addHeapObject(ret);
4108
4118
  }
@@ -4287,14 +4297,14 @@ export function __wbg_length_e2d2a49132c1b256(arg0) {
4287
4297
  return ret;
4288
4298
  }
4289
4299
 
4290
- export function __wbg_list_250c5241956a9ab1() {
4300
+ export function __wbg_list_c75c44aded6fb0ed() {
4291
4301
  return handleError(function (arg0) {
4292
4302
  const ret = getObject(arg0).list();
4293
4303
  return addHeapObject(ret);
4294
4304
  }, arguments);
4295
4305
  }
4296
4306
 
4297
- export function __wbg_list_8668d159d21f9c4e() {
4307
+ export function __wbg_list_f22b3fc3f932db50() {
4298
4308
  return handleError(function (arg0) {
4299
4309
  const ret = getObject(arg0).list();
4300
4310
  return addHeapObject(ret);
@@ -4495,7 +4505,7 @@ export function __wbg_randomFillSync_ac0988aba3254290() {
4495
4505
  }, arguments);
4496
4506
  }
4497
4507
 
4498
- export function __wbg_remove_567c919685c309cc() {
4508
+ export function __wbg_remove_2860ca0121286728() {
4499
4509
  return handleError(function (arg0, arg1, arg2) {
4500
4510
  let deferred0_0;
4501
4511
  let deferred0_1;
@@ -4510,7 +4520,7 @@ export function __wbg_remove_567c919685c309cc() {
4510
4520
  }, arguments);
4511
4521
  }
4512
4522
 
4513
- export function __wbg_remove_aefa0d0833eac3a1() {
4523
+ export function __wbg_remove_4b6c3a289bd83e64() {
4514
4524
  return handleError(function (arg0, arg1, arg2) {
4515
4525
  let deferred0_0;
4516
4526
  let deferred0_1;
@@ -4556,15 +4566,7 @@ export function __wbg_setTimeout_ca12ead8b48245e2(arg0, arg1) {
4556
4566
  return addHeapObject(ret);
4557
4567
  }
4558
4568
 
4559
- export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
4560
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
4561
- }
4562
-
4563
- export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
4564
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
4565
- }
4566
-
4567
- export function __wbg_set_5154dc89823ea3f4() {
4569
+ export function __wbg_set_2e736aaa4683c4c3() {
4568
4570
  return handleError(function (arg0, arg1, arg2, arg3) {
4569
4571
  let deferred0_0;
4570
4572
  let deferred0_1;
@@ -4579,6 +4581,14 @@ export function __wbg_set_5154dc89823ea3f4() {
4579
4581
  }, arguments);
4580
4582
  }
4581
4583
 
4584
+ export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
4585
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
4586
+ }
4587
+
4588
+ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
4589
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
4590
+ }
4591
+
4582
4592
  export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
4583
4593
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4584
4594
  }
@@ -4588,7 +4598,7 @@ export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
4588
4598
  return addHeapObject(ret);
4589
4599
  }
4590
4600
 
4591
- export function __wbg_set_9c4e9b1b55de3d7d() {
4601
+ export function __wbg_set_e4e1569b3197663a() {
4592
4602
  return handleError(function (arg0, arg1, arg2, arg3) {
4593
4603
  let deferred0_0;
4594
4604
  let deferred0_1;
@@ -4813,28 +4823,28 @@ export function __wbindgen_cb_drop(arg0) {
4813
4823
  return ret;
4814
4824
  }
4815
4825
 
4816
- export function __wbindgen_closure_wrapper187(arg0, arg1, arg2) {
4826
+ export function __wbindgen_closure_wrapper188(arg0, arg1, arg2) {
4817
4827
  const ret = makeMutClosure(arg0, arg1, 7, __wbg_adapter_54);
4818
4828
  return addHeapObject(ret);
4819
4829
  }
4820
4830
 
4821
- export function __wbindgen_closure_wrapper189(arg0, arg1, arg2) {
4831
+ export function __wbindgen_closure_wrapper190(arg0, arg1, arg2) {
4822
4832
  const ret = makeMutClosure(arg0, arg1, 7, __wbg_adapter_57);
4823
4833
  return addHeapObject(ret);
4824
4834
  }
4825
4835
 
4826
- export function __wbindgen_closure_wrapper3594(arg0, arg1, arg2) {
4827
- const ret = makeMutClosure(arg0, arg1, 290, __wbg_adapter_60);
4836
+ export function __wbindgen_closure_wrapper3761(arg0, arg1, arg2) {
4837
+ const ret = makeMutClosure(arg0, arg1, 294, __wbg_adapter_60);
4828
4838
  return addHeapObject(ret);
4829
4839
  }
4830
4840
 
4831
- export function __wbindgen_closure_wrapper5956(arg0, arg1, arg2) {
4832
- const ret = makeMutClosure(arg0, arg1, 315, __wbg_adapter_60);
4841
+ export function __wbindgen_closure_wrapper6113(arg0, arg1, arg2) {
4842
+ const ret = makeMutClosure(arg0, arg1, 319, __wbg_adapter_60);
4833
4843
  return addHeapObject(ret);
4834
4844
  }
4835
4845
 
4836
- export function __wbindgen_closure_wrapper6337(arg0, arg1, arg2) {
4837
- const ret = makeMutClosure(arg0, arg1, 339, __wbg_adapter_54);
4846
+ export function __wbindgen_closure_wrapper6494(arg0, arg1, arg2) {
4847
+ const ret = makeMutClosure(arg0, arg1, 342, __wbg_adapter_54);
4838
4848
  return addHeapObject(ret);
4839
4849
  }
4840
4850
 
Binary file
@@ -175,11 +175,7 @@ export const import_ssh_key: (a: number, b: number, c: number, d: number, e: num
175
175
  export const isTestError: (a: number) => number;
176
176
  export const __wbg_authclient_free: (a: number, b: number) => void;
177
177
  export const authclient_send_access: (a: number) => number;
178
- export const sendaccessclient_request_send_access_token: (
179
- a: number,
180
- b: number,
181
- c: number,
182
- ) => number;
178
+ export const sendaccessclient_request_send_access_token: (a: number, b: number) => number;
183
179
  export const isCollectionDecryptError: (a: number) => number;
184
180
  export const cryptoclient_initialize_user_crypto: (a: number, b: number) => number;
185
181
  export const cryptoclient_initialize_org_crypto: (a: number, b: number) => number;
@@ -398,12 +394,12 @@ export const __wbindgen_exn_store: (a: number) => void;
398
394
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
399
395
  export const __wbindgen_export_4: WebAssembly.Table;
400
396
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
401
- export const _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6a23de37c0a4c025: (
397
+ export const _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb3d7232059e1cc02: (
402
398
  a: number,
403
399
  b: number,
404
400
  c: number,
405
401
  ) => void;
406
- export const _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3dbaf14f9a6d0ccb: (
402
+ export const _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0165cee9349ff8be: (
407
403
  a: number,
408
404
  b: number,
409
405
  c: number,