@openwallet-foundation/askar-react-native 0.4.1 → 0.4.2-alpha-20250919145219

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.
Files changed (2) hide show
  1. package/cpp/askar.cpp +42 -14
  2. package/package.json +2 -2
package/cpp/askar.cpp CHANGED
@@ -75,7 +75,9 @@ jsi::Value entryListGetValue(jsi::Runtime &rt, jsi::Object options) {
75
75
 
76
76
  ErrorCode code = askar_entry_list_get_value(entryListHandle, index, &out);
77
77
 
78
- return createReturnValue(rt, code, &out);
78
+ auto ret = createReturnValue(rt, code, &out);
79
+ askar_buffer_free(out);
80
+ return ret;
79
81
  }
80
82
 
81
83
  jsi::Value entryListGetName(jsi::Runtime &rt, jsi::Object options) {
@@ -721,7 +723,9 @@ jsi::Value keyGetJwkSecret(jsi::Runtime &rt, jsi::Object options) {
721
723
 
722
724
  ErrorCode code = askar_key_get_jwk_secret(localKeyHandle, &out);
723
725
 
724
- return createReturnValue(rt, code, &out);
726
+ auto ret = createReturnValue(rt, code, &out);
727
+ askar_buffer_free(out);
728
+ return ret;
725
729
  }
726
730
 
727
731
  jsi::Value keyGetJwkThumbprint(jsi::Runtime &rt, jsi::Object options) {
@@ -745,7 +749,9 @@ jsi::Value keyGetPublicBytes(jsi::Runtime &rt, jsi::Object options) {
745
749
 
746
750
  ErrorCode code = askar_key_get_public_bytes(localKeyHandle, &out);
747
751
 
748
- return createReturnValue(rt, code, &out);
752
+ auto ret = createReturnValue(rt, code, &out);
753
+ askar_buffer_free(out);
754
+ return ret;
749
755
  }
750
756
 
751
757
  jsi::Value keyGetSecretBytes(jsi::Runtime &rt, jsi::Object options) {
@@ -756,7 +762,9 @@ jsi::Value keyGetSecretBytes(jsi::Runtime &rt, jsi::Object options) {
756
762
 
757
763
  ErrorCode code = askar_key_get_secret_bytes(localKeyHandle, &out);
758
764
 
759
- return createReturnValue(rt, code, &out);
765
+ auto ret = createReturnValue(rt, code, &out);
766
+ askar_buffer_free(out);
767
+ return ret;
760
768
  }
761
769
 
762
770
  jsi::Value keySignMessage(jsi::Runtime &rt, jsi::Object options) {
@@ -772,7 +780,9 @@ jsi::Value keySignMessage(jsi::Runtime &rt, jsi::Object options) {
772
780
  localKeyHandle, message, sigType.length() ? sigType.c_str() : nullptr,
773
781
  &out);
774
782
 
775
- return createReturnValue(rt, code, &out);
783
+ auto ret = createReturnValue(rt, code, &out);
784
+ askar_buffer_free(out);
785
+ return ret;
776
786
  }
777
787
 
778
788
  jsi::Value keyUnwrapKey(jsi::Runtime &rt, jsi::Object options) {
@@ -820,7 +830,9 @@ jsi::Value keyWrapKey(jsi::Runtime &rt, jsi::Object options) {
820
830
 
821
831
  ErrorCode code = askar_key_wrap_key(localKeyHandle, other, nonce, &out);
822
832
 
823
- return createReturnValue(rt, code, &out);
833
+ auto ret = createReturnValue(rt, code, &out);
834
+ askar_buffer_free(out.buffer);
835
+ return ret;
824
836
  }
825
837
 
826
838
  jsi::Value keyConvert(jsi::Runtime &rt, jsi::Object options) {
@@ -855,7 +867,9 @@ jsi::Value keyCryptoBox(jsi::Runtime &rt, jsi::Object options) {
855
867
  ErrorCode code =
856
868
  askar_key_crypto_box(recipientKey, senderKey, message, nonce, &out);
857
869
 
858
- return createReturnValue(rt, code, &out);
870
+ auto ret = createReturnValue(rt, code, &out);
871
+ askar_buffer_free(out);
872
+ return ret;
859
873
  }
860
874
 
861
875
  jsi::Value keyCryptoBoxOpen(jsi::Runtime &rt, jsi::Object options) {
@@ -869,7 +883,9 @@ jsi::Value keyCryptoBoxOpen(jsi::Runtime &rt, jsi::Object options) {
869
883
  ErrorCode code =
870
884
  askar_key_crypto_box_open(recipientKey, senderKey, message, nonce, &out);
871
885
 
872
- return createReturnValue(rt, code, &out);
886
+ auto ret = createReturnValue(rt, code, &out);
887
+ askar_buffer_free(out);
888
+ return ret;
873
889
  }
874
890
 
875
891
  jsi::Value keyCryptoBoxRandomNonce(jsi::Runtime &rt, jsi::Object options) {
@@ -877,7 +893,9 @@ jsi::Value keyCryptoBoxRandomNonce(jsi::Runtime &rt, jsi::Object options) {
877
893
 
878
894
  ErrorCode code = askar_key_crypto_box_random_nonce(&out);
879
895
 
880
- return createReturnValue(rt, code, &out);
896
+ auto ret = createReturnValue(rt, code, &out);
897
+ askar_buffer_free(out);
898
+ return ret;
881
899
  }
882
900
 
883
901
  jsi::Value keyCryptoBoxSeal(jsi::Runtime &rt, jsi::Object options) {
@@ -889,7 +907,9 @@ jsi::Value keyCryptoBoxSeal(jsi::Runtime &rt, jsi::Object options) {
889
907
 
890
908
  ErrorCode code = askar_key_crypto_box_seal(localKeyHandle, message, &out);
891
909
 
892
- return createReturnValue(rt, code, &out);
910
+ auto ret = createReturnValue(rt, code, &out);
911
+ askar_buffer_free(out);
912
+ return ret;
893
913
  }
894
914
 
895
915
  jsi::Value keyCryptoBoxSealOpen(jsi::Runtime &rt, jsi::Object options) {
@@ -902,7 +922,9 @@ jsi::Value keyCryptoBoxSealOpen(jsi::Runtime &rt, jsi::Object options) {
902
922
  ErrorCode code =
903
923
  askar_key_crypto_box_seal_open(localKeyHandle, ciphertext, &out);
904
924
 
905
- return createReturnValue(rt, code, &out);
925
+ auto ret = createReturnValue(rt, code, &out);
926
+ askar_buffer_free(out);
927
+ return ret;
906
928
  }
907
929
 
908
930
  jsi::Value keyDeriveEcdh1pu(jsi::Runtime &rt, jsi::Object options) {
@@ -958,7 +980,9 @@ jsi::Value keyAeadDecrypt(jsi::Runtime &rt, jsi::Object options) {
958
980
  ErrorCode code =
959
981
  askar_key_aead_decrypt(localKeyHandle, ciphertext, nonce, tag, aad, &out);
960
982
 
961
- return createReturnValue(rt, code, &out);
983
+ auto ret = createReturnValue(rt, code, &out);
984
+ askar_buffer_free(out);
985
+ return ret;
962
986
  }
963
987
 
964
988
  jsi::Value keyAeadEncrypt(jsi::Runtime &rt, jsi::Object options) {
@@ -974,7 +998,9 @@ jsi::Value keyAeadEncrypt(jsi::Runtime &rt, jsi::Object options) {
974
998
  ErrorCode code =
975
999
  askar_key_aead_encrypt(localKeyHandle, message, nonce, aad, &out);
976
1000
 
977
- return createReturnValue(rt, code, &out);
1001
+ auto ret = createReturnValue(rt, code, &out);
1002
+ askar_buffer_free(out.buffer);
1003
+ return ret;
978
1004
  }
979
1005
 
980
1006
  jsi::Value keyAeadGetPadding(jsi::Runtime &rt, jsi::Object options) {
@@ -1009,7 +1035,9 @@ jsi::Value keyAeadRandomNonce(jsi::Runtime &rt, jsi::Object options) {
1009
1035
 
1010
1036
  ErrorCode code = askar_key_aead_random_nonce(localKeyHandle, &out);
1011
1037
 
1012
- return createReturnValue(rt, code, &out);
1038
+ auto ret = createReturnValue(rt, code, &out);
1039
+ askar_buffer_free(out);
1040
+ return ret;
1013
1041
  }
1014
1042
 
1015
1043
  jsi::Value keyEntryListCount(jsi::Runtime &rt, jsi::Object options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openwallet-foundation/askar-react-native",
3
- "version": "0.4.1",
3
+ "version": "0.4.2-alpha-20250919145219",
4
4
  "license": "Apache-2.0",
5
5
  "description": "React Native wrapper for Askar",
6
6
  "main": "build/index",
@@ -30,7 +30,7 @@
30
30
  "scripts"
31
31
  ],
32
32
  "dependencies": {
33
- "@openwallet-foundation/askar-shared": "0.4.1"
33
+ "@openwallet-foundation/askar-shared": "0.4.2-alpha-20250919145219"
34
34
  },
35
35
  "devDependencies": {
36
36
  "react": "18.2.0",