@bitwarden/sdk-internal 0.2.0-main.200 → 0.2.0-main.201

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.
@@ -157,6 +157,56 @@ export interface InitOrgCryptoRequest {
157
157
  organizationKeys: Map<Uuid, UnsignedSharedKey>;
158
158
  }
159
159
 
160
+ /**
161
+ * Response from the `update_password` function
162
+ */
163
+ export interface UpdatePasswordResponse {
164
+ /**
165
+ * Hash of the new password
166
+ */
167
+ passwordHash: string;
168
+ /**
169
+ * User key, encrypted with the new password
170
+ */
171
+ newKey: EncString;
172
+ }
173
+
174
+ /**
175
+ * Request for deriving a pin protected user key
176
+ */
177
+ export interface DerivePinKeyResponse {
178
+ /**
179
+ * [UserKey] protected by PIN
180
+ */
181
+ pinProtectedUserKey: EncString;
182
+ /**
183
+ * PIN protected by [UserKey]
184
+ */
185
+ encryptedPin: EncString;
186
+ }
187
+
188
+ /**
189
+ * Request for migrating an account from password to key connector.
190
+ */
191
+ export interface DeriveKeyConnectorRequest {
192
+ /**
193
+ * Encrypted user key, used to validate the master key
194
+ */
195
+ userKeyEncrypted: EncString;
196
+ /**
197
+ * The user\'s master password
198
+ */
199
+ password: string;
200
+ /**
201
+ * The KDF parameters used to derive the master key
202
+ */
203
+ kdf: Kdf;
204
+ /**
205
+ * The user\'s email address
206
+ */
207
+ email: string;
208
+ }
209
+
160
210
  /**
161
211
  * Response from the `make_key_pair` function
162
212
  */
@@ -208,6 +258,27 @@ export interface VerifyAsymmetricKeysResponse {
208
258
  */
209
259
  export type OrganizationId = Tagged<Uuid, "OrganizationId">;
210
260
 
261
+ export interface DeriveKeyConnectorError extends Error {
262
+ name: "DeriveKeyConnectorError";
263
+ variant: "WrongPassword" | "Crypto";
264
+ }
265
+
266
+ export function isDeriveKeyConnectorError(error: any): error is DeriveKeyConnectorError;
267
+
268
+ export interface EnrollAdminPasswordResetError extends Error {
269
+ name: "EnrollAdminPasswordResetError";
270
+ variant: "VaultLocked" | "Crypto" | "InvalidBase64";
271
+ }
272
+
273
+ export function isEnrollAdminPasswordResetError(error: any): error is EnrollAdminPasswordResetError;
274
+
275
+ export interface CryptoClientError extends Error {
276
+ name: "CryptoClientError";
277
+ variant: "NotAuthenticated" | "VaultLocked" | "Crypto";
278
+ }
279
+
280
+ export function isCryptoClientError(error: any): error is CryptoClientError;
281
+
211
282
  export interface EncryptionSettingsError extends Error {
212
283
  name: "EncryptionSettingsError";
213
284
  variant:
@@ -1069,6 +1140,9 @@ export class CiphersClient {
1069
1140
  move_to_organization(cipher_view: CipherView, organization_id: OrganizationId): CipherView;
1070
1141
  decrypt_fido2_private_key(cipher_view: CipherView): string;
1071
1142
  }
1143
+ /**
1144
+ * A client for the crypto operations.
1145
+ */
1072
1146
  export class CryptoClient {
1073
1147
  private constructor();
1074
1148
  free(): void;
@@ -245,6 +245,45 @@ function addBorrowedObject(obj) {
245
245
  heap[--stack_pointer] = obj;
246
246
  return stack_pointer;
247
247
  }
248
+ /**
249
+ * @param {any} error
250
+ * @returns {boolean}
251
+ */
252
+ module.exports.isDeriveKeyConnectorError = function (error) {
253
+ try {
254
+ const ret = wasm.isDeriveKeyConnectorError(addBorrowedObject(error));
255
+ return ret !== 0;
256
+ } finally {
257
+ heap[stack_pointer++] = undefined;
258
+ }
259
+ };
260
+
261
+ /**
262
+ * @param {any} error
263
+ * @returns {boolean}
264
+ */
265
+ module.exports.isEnrollAdminPasswordResetError = function (error) {
266
+ try {
267
+ const ret = wasm.isEnrollAdminPasswordResetError(addBorrowedObject(error));
268
+ return ret !== 0;
269
+ } finally {
270
+ heap[stack_pointer++] = undefined;
271
+ }
272
+ };
273
+
274
+ /**
275
+ * @param {any} error
276
+ * @returns {boolean}
277
+ */
278
+ module.exports.isCryptoClientError = function (error) {
279
+ try {
280
+ const ret = wasm.isCryptoClientError(addBorrowedObject(error));
281
+ return ret !== 0;
282
+ } finally {
283
+ heap[stack_pointer++] = undefined;
284
+ }
285
+ };
286
+
248
287
  /**
249
288
  * @param {any} error
250
289
  * @returns {boolean}
@@ -666,7 +705,7 @@ function __wbg_adapter_56(arg0, arg1, arg2) {
666
705
  );
667
706
  }
668
707
 
669
- function __wbg_adapter_253(arg0, arg1, arg2, arg3) {
708
+ function __wbg_adapter_256(arg0, arg1, arg2, arg3) {
670
709
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h334034c47a371f71(
671
710
  arg0,
672
711
  arg1,
@@ -1193,7 +1232,9 @@ const CryptoClientFinalization =
1193
1232
  typeof FinalizationRegistry === "undefined"
1194
1233
  ? { register: () => {}, unregister: () => {} }
1195
1234
  : new FinalizationRegistry((ptr) => wasm.__wbg_cryptoclient_free(ptr >>> 0, 1));
1196
-
1235
+ /**
1236
+ * A client for the crypto operations.
1237
+ */
1197
1238
  class CryptoClient {
1198
1239
  static __wrap(ptr) {
1199
1240
  ptr = ptr >>> 0;
@@ -3198,7 +3239,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function (arg0, arg1) {
3198
3239
  const a = state0.a;
3199
3240
  state0.a = 0;
3200
3241
  try {
3201
- return __wbg_adapter_253(a, state0.b, arg0, arg1);
3242
+ return __wbg_adapter_256(a, state0.b, arg0, arg1);
3202
3243
  } finally {
3203
3244
  state0.a = a;
3204
3245
  }
@@ -3555,18 +3596,18 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
3555
3596
  return ret;
3556
3597
  };
3557
3598
 
3558
- module.exports.__wbindgen_closure_wrapper2349 = function (arg0, arg1, arg2) {
3559
- const ret = makeMutClosure(arg0, arg1, 674, __wbg_adapter_50);
3599
+ module.exports.__wbindgen_closure_wrapper2339 = function (arg0, arg1, arg2) {
3600
+ const ret = makeMutClosure(arg0, arg1, 669, __wbg_adapter_50);
3560
3601
  return addHeapObject(ret);
3561
3602
  };
3562
3603
 
3563
- module.exports.__wbindgen_closure_wrapper3188 = function (arg0, arg1, arg2) {
3564
- const ret = makeMutClosure(arg0, arg1, 758, __wbg_adapter_53);
3604
+ module.exports.__wbindgen_closure_wrapper3178 = function (arg0, arg1, arg2) {
3605
+ const ret = makeMutClosure(arg0, arg1, 753, __wbg_adapter_53);
3565
3606
  return addHeapObject(ret);
3566
3607
  };
3567
3608
 
3568
- module.exports.__wbindgen_closure_wrapper3598 = function (arg0, arg1, arg2) {
3569
- const ret = makeMutClosure(arg0, arg1, 880, __wbg_adapter_56);
3609
+ module.exports.__wbindgen_closure_wrapper3588 = function (arg0, arg1, arg2) {
3610
+ const ret = makeMutClosure(arg0, arg1, 875, __wbg_adapter_56);
3570
3611
  return addHeapObject(ret);
3571
3612
  };
3572
3613
 
@@ -1,6 +1,14 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const __wbg_cryptoclient_free: (a: number, b: number) => void;
5
+ export const cryptoclient_initialize_user_crypto: (a: number, b: number) => number;
6
+ export const cryptoclient_initialize_org_crypto: (a: number, b: number) => number;
7
+ export const cryptoclient_make_key_pair: (a: number, b: number, c: number, d: number) => void;
8
+ export const cryptoclient_verify_asymmetric_keys: (a: number, b: number, c: number) => void;
9
+ export const isDeriveKeyConnectorError: (a: number) => number;
10
+ export const isEnrollAdminPasswordResetError: (a: number) => number;
11
+ export const isCryptoClientError: (a: number) => number;
4
12
  export const isEncryptionSettingsError: (a: number) => number;
5
13
  export const isCryptoError: (a: number) => number;
6
14
  export const __wbg_exporterclient_free: (a: number, b: number) => void;
@@ -142,11 +150,6 @@ export const bitwardenclient_version: (a: number, b: number) => void;
142
150
  export const bitwardenclient_throw: (a: number, b: number, c: number, d: number) => void;
143
151
  export const bitwardenclient_http_get: (a: number, b: number, c: number) => number;
144
152
  export const bitwardenclient_crypto: (a: number) => number;
145
- export const __wbg_cryptoclient_free: (a: number, b: number) => void;
146
- export const cryptoclient_initialize_user_crypto: (a: number, b: number) => number;
147
- export const cryptoclient_initialize_org_crypto: (a: number, b: number) => number;
148
- export const cryptoclient_make_key_pair: (a: number, b: number, c: number, d: number) => void;
149
- export const cryptoclient_verify_asymmetric_keys: (a: number, b: number, c: number) => void;
150
153
  export const set_log_level: (a: number) => void;
151
154
  export const init_sdk: (a: number) => void;
152
155
  export const __wbg_purecrypto_free: (a: number, b: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.200",
3
+ "version": "0.2.0-main.201",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",