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

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
- 0e948af85dd51dec72fad210a896b64fe4604a52
1
+ 138223508066b9e2e319cc08c956eb819a0bf199
@@ -117,6 +117,10 @@ export interface InitUserCryptoRequest {
117
117
  * The user\'s encrypted private key
118
118
  */
119
119
  privateKey: EncString;
120
+ /**
121
+ * The user\'s signing key
122
+ */
123
+ signingKey: EncString | undefined;
120
124
  /**
121
125
  * The initialization method to use
122
126
  */
@@ -253,6 +257,24 @@ export interface VerifyAsymmetricKeysResponse {
253
257
  validPrivateKey: boolean;
254
258
  }
255
259
 
260
+ /**
261
+ * A new signing key pair along with the signed public key
262
+ */
263
+ export interface MakeUserSigningKeysResponse {
264
+ /**
265
+ * Base64 encoded verifying key
266
+ */
267
+ verifyingKey: string;
268
+ /**
269
+ * Signing key, encrypted with the user\'s symmetric key
270
+ */
271
+ signingKey: EncString;
272
+ /**
273
+ * The user\'s public key, signed by the signing key
274
+ */
275
+ signedPublicKey: SignedPublicKey;
276
+ }
277
+
256
278
  /**
257
279
  * NewType wrapper for `OrganizationId`
258
280
  */
@@ -360,6 +382,13 @@ export type UnsignedSharedKey = string;
360
382
 
361
383
  export type EncString = string;
362
384
 
385
+ export type SignedPublicKey = string;
386
+
387
+ /**
388
+ * The type of key / signature scheme used for signing and verifying.
389
+ */
390
+ export type SignatureAlgorithm = "ed25519";
391
+
363
392
  /**
364
393
  * Key Derivation Function for Bitwarden Account
365
394
  *
@@ -391,7 +420,10 @@ export interface CryptoError extends Error {
391
420
  | "ZeroNumber"
392
421
  | "OperationNotSupported"
393
422
  | "WrongKeyType"
394
- | "InvalidNonceLength";
423
+ | "WrongCoseKeyId"
424
+ | "InvalidNonceLength"
425
+ | "SignatureError"
426
+ | "EncodingError";
395
427
  }
396
428
 
397
429
  export function isCryptoError(error: any): error is CryptoError;
@@ -1167,6 +1199,10 @@ export class CryptoClient {
1167
1199
  * Crypto initialization not required.
1168
1200
  */
1169
1201
  verify_asymmetric_keys(request: VerifyAsymmetricKeysRequest): VerifyAsymmetricKeysResponse;
1202
+ /**
1203
+ * Makes a new signing key pair and signs the public key for the user
1204
+ */
1205
+ make_user_signing_keys_for_enrollment(): MakeUserSigningKeysResponse;
1170
1206
  }
1171
1207
  export class ExporterClient {
1172
1208
  private constructor();
@@ -1411,6 +1447,25 @@ export class PureCrypto {
1411
1447
  encapsulated_key: string,
1412
1448
  decapsulation_key: Uint8Array,
1413
1449
  ): Uint8Array;
1450
+ /**
1451
+ * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
1452
+ * the corresponding verifying key.
1453
+ */
1454
+ static verifying_key_for_signing_key(signing_key: string, wrapping_key: Uint8Array): Uint8Array;
1455
+ /**
1456
+ * Returns the algorithm used for the given verifying key.
1457
+ */
1458
+ static key_algorithm_for_verifying_key(verifying_key: Uint8Array): SignatureAlgorithm;
1459
+ /**
1460
+ * For a given signing identity (verifying key), this function verifies that the signing
1461
+ * identity claimed ownership of the public key. This is a one-sided claim and merely shows
1462
+ * that the signing identity has the intent to receive messages encrypted to the public
1463
+ * key.
1464
+ */
1465
+ static verify_and_unwrap_signed_public_key(
1466
+ signed_public_key: Uint8Array,
1467
+ verifying_key: Uint8Array,
1468
+ ): Uint8Array;
1414
1469
  }
1415
1470
  export class TotpClient {
1416
1471
  private constructor();
@@ -711,7 +711,7 @@ function __wbg_adapter_56(arg0, arg1, arg2) {
711
711
  );
712
712
  }
713
713
 
714
- function __wbg_adapter_256(arg0, arg1, arg2, arg3) {
714
+ function __wbg_adapter_260(arg0, arg1, arg2, arg3) {
715
715
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h334034c47a371f71(
716
716
  arg0,
717
717
  arg1,
@@ -1323,6 +1323,25 @@ export class CryptoClient {
1323
1323
  wasm.__wbindgen_add_to_stack_pointer(16);
1324
1324
  }
1325
1325
  }
1326
+ /**
1327
+ * Makes a new signing key pair and signs the public key for the user
1328
+ * @returns {MakeUserSigningKeysResponse}
1329
+ */
1330
+ make_user_signing_keys_for_enrollment() {
1331
+ try {
1332
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1333
+ wasm.cryptoclient_make_user_signing_keys_for_enrollment(retptr, this.__wbg_ptr);
1334
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1335
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1336
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1337
+ if (r2) {
1338
+ throw takeObject(r1);
1339
+ }
1340
+ return takeObject(r0);
1341
+ } finally {
1342
+ wasm.__wbindgen_add_to_stack_pointer(16);
1343
+ }
1344
+ }
1326
1345
  }
1327
1346
 
1328
1347
  const ExporterClientFinalization =
@@ -2831,6 +2850,88 @@ export class PureCrypto {
2831
2850
  wasm.__wbindgen_add_to_stack_pointer(16);
2832
2851
  }
2833
2852
  }
2853
+ /**
2854
+ * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
2855
+ * the corresponding verifying key.
2856
+ * @param {string} signing_key
2857
+ * @param {Uint8Array} wrapping_key
2858
+ * @returns {Uint8Array}
2859
+ */
2860
+ static verifying_key_for_signing_key(signing_key, wrapping_key) {
2861
+ try {
2862
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2863
+ const ptr0 = passStringToWasm0(signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2864
+ const len0 = WASM_VECTOR_LEN;
2865
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
2866
+ const len1 = WASM_VECTOR_LEN;
2867
+ wasm.purecrypto_verifying_key_for_signing_key(retptr, ptr0, len0, ptr1, len1);
2868
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2869
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2870
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2871
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2872
+ if (r3) {
2873
+ throw takeObject(r2);
2874
+ }
2875
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
2876
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2877
+ return v3;
2878
+ } finally {
2879
+ wasm.__wbindgen_add_to_stack_pointer(16);
2880
+ }
2881
+ }
2882
+ /**
2883
+ * Returns the algorithm used for the given verifying key.
2884
+ * @param {Uint8Array} verifying_key
2885
+ * @returns {SignatureAlgorithm}
2886
+ */
2887
+ static key_algorithm_for_verifying_key(verifying_key) {
2888
+ try {
2889
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2890
+ const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
2891
+ const len0 = WASM_VECTOR_LEN;
2892
+ wasm.purecrypto_key_algorithm_for_verifying_key(retptr, ptr0, len0);
2893
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2894
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2895
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2896
+ if (r2) {
2897
+ throw takeObject(r1);
2898
+ }
2899
+ return takeObject(r0);
2900
+ } finally {
2901
+ wasm.__wbindgen_add_to_stack_pointer(16);
2902
+ }
2903
+ }
2904
+ /**
2905
+ * For a given signing identity (verifying key), this function verifies that the signing
2906
+ * identity claimed ownership of the public key. This is a one-sided claim and merely shows
2907
+ * that the signing identity has the intent to receive messages encrypted to the public
2908
+ * key.
2909
+ * @param {Uint8Array} signed_public_key
2910
+ * @param {Uint8Array} verifying_key
2911
+ * @returns {Uint8Array}
2912
+ */
2913
+ static verify_and_unwrap_signed_public_key(signed_public_key, verifying_key) {
2914
+ try {
2915
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2916
+ const ptr0 = passArray8ToWasm0(signed_public_key, wasm.__wbindgen_malloc);
2917
+ const len0 = WASM_VECTOR_LEN;
2918
+ const ptr1 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
2919
+ const len1 = WASM_VECTOR_LEN;
2920
+ wasm.purecrypto_verify_and_unwrap_signed_public_key(retptr, ptr0, len0, ptr1, len1);
2921
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2922
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2923
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2924
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2925
+ if (r3) {
2926
+ throw takeObject(r2);
2927
+ }
2928
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
2929
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2930
+ return v3;
2931
+ } finally {
2932
+ wasm.__wbindgen_add_to_stack_pointer(16);
2933
+ }
2934
+ }
2834
2935
  }
2835
2936
 
2836
2937
  const TotpClientFinalization =
@@ -3230,7 +3331,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
3230
3331
  const a = state0.a;
3231
3332
  state0.a = 0;
3232
3333
  try {
3233
- return __wbg_adapter_256(a, state0.b, arg0, arg1);
3334
+ return __wbg_adapter_260(a, state0.b, arg0, arg1);
3234
3335
  } finally {
3235
3336
  state0.a = a;
3236
3337
  }
@@ -3587,18 +3688,18 @@ export function __wbindgen_cb_drop(arg0) {
3587
3688
  return ret;
3588
3689
  }
3589
3690
 
3590
- export function __wbindgen_closure_wrapper2339(arg0, arg1, arg2) {
3591
- const ret = makeMutClosure(arg0, arg1, 669, __wbg_adapter_50);
3691
+ export function __wbindgen_closure_wrapper2476(arg0, arg1, arg2) {
3692
+ const ret = makeMutClosure(arg0, arg1, 717, __wbg_adapter_50);
3592
3693
  return addHeapObject(ret);
3593
3694
  }
3594
3695
 
3595
- export function __wbindgen_closure_wrapper3178(arg0, arg1, arg2) {
3596
- const ret = makeMutClosure(arg0, arg1, 753, __wbg_adapter_53);
3696
+ export function __wbindgen_closure_wrapper3315(arg0, arg1, arg2) {
3697
+ const ret = makeMutClosure(arg0, arg1, 801, __wbg_adapter_53);
3597
3698
  return addHeapObject(ret);
3598
3699
  }
3599
3700
 
3600
- export function __wbindgen_closure_wrapper3588(arg0, arg1, arg2) {
3601
- const ret = makeMutClosure(arg0, arg1, 875, __wbg_adapter_56);
3701
+ export function __wbindgen_closure_wrapper3728(arg0, arg1, arg2) {
3702
+ const ret = makeMutClosure(arg0, arg1, 924, __wbg_adapter_56);
3602
3703
  return addHeapObject(ret);
3603
3704
  }
3604
3705
 
Binary file
@@ -6,6 +6,7 @@ export const cryptoclient_initialize_user_crypto: (a: number, b: number) => numb
6
6
  export const cryptoclient_initialize_org_crypto: (a: number, b: number) => number;
7
7
  export const cryptoclient_make_key_pair: (a: number, b: number, c: number, d: number) => void;
8
8
  export const cryptoclient_verify_asymmetric_keys: (a: number, b: number, c: number) => void;
9
+ export const cryptoclient_make_user_signing_keys_for_enrollment: (a: number, b: number) => void;
9
10
  export const isDeriveKeyConnectorError: (a: number) => number;
10
11
  export const isEnrollAdminPasswordResetError: (a: number) => number;
11
12
  export const isCryptoClientError: (a: number) => number;
@@ -273,6 +274,21 @@ export const purecrypto_decapsulate_key_unsigned: (
273
274
  d: number,
274
275
  e: number,
275
276
  ) => void;
277
+ export const purecrypto_verifying_key_for_signing_key: (
278
+ a: number,
279
+ b: number,
280
+ c: number,
281
+ d: number,
282
+ e: number,
283
+ ) => void;
284
+ export const purecrypto_key_algorithm_for_verifying_key: (a: number, b: number, c: number) => void;
285
+ export const purecrypto_verify_and_unwrap_signed_public_key: (
286
+ a: number,
287
+ b: number,
288
+ c: number,
289
+ d: number,
290
+ e: number,
291
+ ) => void;
276
292
  export const generate_ssh_key: (a: number, b: number) => void;
277
293
  export const import_ssh_key: (a: number, b: number, c: number, d: number, e: number) => void;
278
294
  export const isTestError: (a: number) => number;