@bitwarden/sdk-internal 0.2.0-main.175 → 0.2.0-main.177

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.
@@ -101,6 +101,7 @@ export enum UriMatchType {
101
101
  * State used for initializing the user cryptographic state.
102
102
  */
103
103
  export interface InitUserCryptoRequest {
104
+ userId: Uuid | undefined;
104
105
  /**
105
106
  * The user\'s KDF parameters, as received from the prelogin request
106
107
  */
@@ -201,7 +202,13 @@ export interface VerifyAsymmetricKeysResponse {
201
202
 
202
203
  export interface EncryptionSettingsError extends Error {
203
204
  name: "EncryptionSettingsError";
204
- variant: "Crypto" | "InvalidBase64" | "VaultLocked" | "InvalidPrivateKey" | "MissingPrivateKey";
205
+ variant:
206
+ | "Crypto"
207
+ | "InvalidBase64"
208
+ | "VaultLocked"
209
+ | "InvalidPrivateKey"
210
+ | "MissingPrivateKey"
211
+ | "UserIdAlreadySetError";
205
212
  }
206
213
 
207
214
  export function isEncryptionSettingsError(error: any): error is EncryptionSettingsError;
@@ -503,6 +510,15 @@ export interface KeyGenerationError extends Error {
503
510
 
504
511
  export function isKeyGenerationError(error: any): error is KeyGenerationError;
505
512
 
513
+ export interface EncryptionContext {
514
+ /**
515
+ * The Id of the user that encrypted the cipher. It should always represent a UserId, even for
516
+ * Organization-owned ciphers
517
+ */
518
+ encryptedFor: Uuid;
519
+ cipher: Cipher;
520
+ }
521
+
506
522
  export interface Cipher {
507
523
  id: Uuid | undefined;
508
524
  organizationId: Uuid | undefined;
@@ -744,7 +760,7 @@ export function isDecryptError(error: any): error is DecryptError;
744
760
 
745
761
  export interface EncryptError extends Error {
746
762
  name: "EncryptError";
747
- variant: "Crypto" | "VaultLocked";
763
+ variant: "Crypto" | "VaultLocked" | "MissingUserId";
748
764
  }
749
765
 
750
766
  export function isEncryptError(error: any): error is EncryptError;
@@ -1004,7 +1020,7 @@ export class CiphersClient {
1004
1020
  * - `Ok(Cipher)` containing the encrypted cipher
1005
1021
  * - `Err(EncryptError)` if encryption fails
1006
1022
  */
1007
- encrypt(cipher_view: CipherView): Cipher;
1023
+ encrypt(cipher_view: CipherView): EncryptionContext;
1008
1024
  /**
1009
1025
  * Decrypt cipher
1010
1026
  *
@@ -992,7 +992,7 @@ class CiphersClient {
992
992
  * - `Ok(Cipher)` containing the encrypted cipher
993
993
  * - `Err(EncryptError)` if encryption fails
994
994
  * @param {CipherView} cipher_view
995
- * @returns {Cipher}
995
+ * @returns {EncryptionContext}
996
996
  */
997
997
  encrypt(cipher_view) {
998
998
  try {
@@ -3574,12 +3574,12 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
3574
3574
  return ret;
3575
3575
  };
3576
3576
 
3577
- module.exports.__wbindgen_closure_wrapper3081 = function (arg0, arg1, arg2) {
3577
+ module.exports.__wbindgen_closure_wrapper3099 = function (arg0, arg1, arg2) {
3578
3578
  const ret = makeMutClosure(arg0, arg1, 705, __wbg_adapter_50);
3579
3579
  return addHeapObject(ret);
3580
3580
  };
3581
3581
 
3582
- module.exports.__wbindgen_closure_wrapper3476 = function (arg0, arg1, arg2) {
3582
+ module.exports.__wbindgen_closure_wrapper3494 = function (arg0, arg1, arg2) {
3583
3583
  const ret = makeMutClosure(arg0, arg1, 827, __wbg_adapter_53);
3584
3584
  return addHeapObject(ret);
3585
3585
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.175",
3
+ "version": "0.2.0-main.177",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",