@bitwarden/sdk-internal 0.2.0-main.129 → 0.2.0-main.130

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.
@@ -424,11 +424,11 @@ export class CryptoClient {
424
424
  export class PureCrypto {
425
425
  private constructor();
426
426
  free(): void;
427
- static symmetric_decrypt(enc_string: string, key_b64: string): string;
428
- static symmetric_decrypt_to_bytes(enc_string: string, key_b64: string): Uint8Array;
429
- static symmetric_decrypt_array_buffer(enc_bytes: Uint8Array, key_b64: string): Uint8Array;
430
- static symmetric_encrypt(plain: string, key_b64: string): string;
431
- static symmetric_encrypt_to_array_buffer(plain: Uint8Array, key_b64: string): Uint8Array;
427
+ static symmetric_decrypt(enc_string: string, key: Uint8Array): string;
428
+ static symmetric_decrypt_to_bytes(enc_string: string, key: Uint8Array): Uint8Array;
429
+ static symmetric_decrypt_array_buffer(enc_bytes: Uint8Array, key: Uint8Array): Uint8Array;
430
+ static symmetric_encrypt(plain: string, key: Uint8Array): string;
431
+ static symmetric_encrypt_to_array_buffer(plain: Uint8Array, key: Uint8Array): Uint8Array;
432
432
  }
433
433
  export class VaultClient {
434
434
  private constructor();
@@ -384,17 +384,17 @@ module.exports.init_sdk = function (log_level) {
384
384
  wasm.init_sdk(isLikeNone(log_level) ? 5 : log_level);
385
385
  };
386
386
 
387
- function getArrayU8FromWasm0(ptr, len) {
388
- ptr = ptr >>> 0;
389
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
390
- }
391
-
392
387
  function passArray8ToWasm0(arg, malloc) {
393
388
  const ptr = malloc(arg.length * 1, 1) >>> 0;
394
389
  getUint8ArrayMemory0().set(arg, ptr / 1);
395
390
  WASM_VECTOR_LEN = arg.length;
396
391
  return ptr;
397
392
  }
393
+
394
+ function getArrayU8FromWasm0(ptr, len) {
395
+ ptr = ptr >>> 0;
396
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
397
+ }
398
398
  /**
399
399
  * Generate a new SSH key pair
400
400
  *
@@ -861,17 +861,17 @@ class PureCrypto {
861
861
  }
862
862
  /**
863
863
  * @param {string} enc_string
864
- * @param {string} key_b64
864
+ * @param {Uint8Array} key
865
865
  * @returns {string}
866
866
  */
867
- static symmetric_decrypt(enc_string, key_b64) {
867
+ static symmetric_decrypt(enc_string, key) {
868
868
  let deferred4_0;
869
869
  let deferred4_1;
870
870
  try {
871
871
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
872
872
  const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
873
873
  const len0 = WASM_VECTOR_LEN;
874
- const ptr1 = passStringToWasm0(key_b64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
874
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
875
875
  const len1 = WASM_VECTOR_LEN;
876
876
  wasm.purecrypto_symmetric_decrypt(retptr, ptr0, len0, ptr1, len1);
877
877
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -895,15 +895,15 @@ class PureCrypto {
895
895
  }
896
896
  /**
897
897
  * @param {string} enc_string
898
- * @param {string} key_b64
898
+ * @param {Uint8Array} key
899
899
  * @returns {Uint8Array}
900
900
  */
901
- static symmetric_decrypt_to_bytes(enc_string, key_b64) {
901
+ static symmetric_decrypt_to_bytes(enc_string, key) {
902
902
  try {
903
903
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
904
904
  const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
905
905
  const len0 = WASM_VECTOR_LEN;
906
- const ptr1 = passStringToWasm0(key_b64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
906
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
907
907
  const len1 = WASM_VECTOR_LEN;
908
908
  wasm.purecrypto_symmetric_decrypt_to_bytes(retptr, ptr0, len0, ptr1, len1);
909
909
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -922,15 +922,15 @@ class PureCrypto {
922
922
  }
923
923
  /**
924
924
  * @param {Uint8Array} enc_bytes
925
- * @param {string} key_b64
925
+ * @param {Uint8Array} key
926
926
  * @returns {Uint8Array}
927
927
  */
928
- static symmetric_decrypt_array_buffer(enc_bytes, key_b64) {
928
+ static symmetric_decrypt_array_buffer(enc_bytes, key) {
929
929
  try {
930
930
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
931
931
  const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
932
932
  const len0 = WASM_VECTOR_LEN;
933
- const ptr1 = passStringToWasm0(key_b64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
933
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
934
934
  const len1 = WASM_VECTOR_LEN;
935
935
  wasm.purecrypto_symmetric_decrypt_array_buffer(retptr, ptr0, len0, ptr1, len1);
936
936
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -949,17 +949,17 @@ class PureCrypto {
949
949
  }
950
950
  /**
951
951
  * @param {string} plain
952
- * @param {string} key_b64
952
+ * @param {Uint8Array} key
953
953
  * @returns {string}
954
954
  */
955
- static symmetric_encrypt(plain, key_b64) {
955
+ static symmetric_encrypt(plain, key) {
956
956
  let deferred4_0;
957
957
  let deferred4_1;
958
958
  try {
959
959
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
960
960
  const ptr0 = passStringToWasm0(plain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
961
961
  const len0 = WASM_VECTOR_LEN;
962
- const ptr1 = passStringToWasm0(key_b64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
962
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
963
963
  const len1 = WASM_VECTOR_LEN;
964
964
  wasm.purecrypto_symmetric_encrypt(retptr, ptr0, len0, ptr1, len1);
965
965
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -983,15 +983,15 @@ class PureCrypto {
983
983
  }
984
984
  /**
985
985
  * @param {Uint8Array} plain
986
- * @param {string} key_b64
986
+ * @param {Uint8Array} key
987
987
  * @returns {Uint8Array}
988
988
  */
989
- static symmetric_encrypt_to_array_buffer(plain, key_b64) {
989
+ static symmetric_encrypt_to_array_buffer(plain, key) {
990
990
  try {
991
991
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
992
992
  const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
993
993
  const len0 = WASM_VECTOR_LEN;
994
- const ptr1 = passStringToWasm0(key_b64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
994
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
995
995
  const len1 = WASM_VECTOR_LEN;
996
996
  wasm.purecrypto_symmetric_encrypt_to_array_buffer(retptr, ptr0, len0, ptr1, len1);
997
997
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.129",
3
+ "version": "0.2.0-main.130",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",