@openwallet-foundation/askar-react-native 0.3.1 → 0.3.2-alpha-20250205012009

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 (3) hide show
  1. package/README.md +7 -17
  2. package/cpp/askar.cpp +12 -12
  3. package/package.json +10 -11
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Askar React Native
2
2
 
3
- Wrapper for React Native around Askar
3
+ Wrapper for React Native around Askar.
4
+
5
+ See the [project README](https://github.com/openwallet-foundation/askar-wrapper-javascript) for version compatability between Askar and this JavaScript Wrapper.
4
6
 
5
7
  ## Requirements
6
8
 
7
- This module uses the new React Native Turbo Modules. These are faster than the
8
- previous Native Modules, and can be completely synchronous. A React Native
9
- version of `>= 0.66.0` is required for this package to work.
9
+ This library requires and has been tested with React Native version `0.75.x` and `0.76.x`. Newer versions might also work, but they have not been tested.
10
10
 
11
11
  ## Installation
12
12
 
@@ -19,20 +19,10 @@ yarn add @openwallet-foundation/askar-react-native
19
19
  You can import all types and classes from the `@openwallet-foundation/askar-react-native` library:
20
20
 
21
21
  ```typescript
22
- import { Key, KeyAlgs } from '@openwallet-foundation/askar-react-native'
22
+ import { Key, KeyAlgs } from "@openwallet-foundation/askar-react-native";
23
23
 
24
- const seed = Uint8Array.from(Buffer.from('testseed000000000000000000000001'))
25
- const key = Key.fromSeed({ algorithm: KeyAlgs.Bls12381G1, seed })
24
+ const seed = Uint8Array.from(Buffer.from("testseed000000000000000000000001"));
25
+ const key = Key.fromSeed({ algorithm: KeyAlgs.Bls12381G1, seed });
26
26
  ```
27
27
 
28
28
  > **Note**: If you want to use this library in a cross-platform environment you need to import methods from the `@openwallet-foundation/askar-shared` package instead. This is a platform independent package that allows to register the native bindings. The `@openwallet-foundation/askar-react-native` package uses this package under the hood. See the [Askar Shared README](https://github.com/openwallet-foundation/askar-wrapper-javascript/tree/main/packages/askar-shared/README.md) for documentation on how to use this package.
29
-
30
- ## Version Compatibility
31
-
32
- The JavaScript wrapper is versioned independently from the native bindings. The following table shows the compatibility between the different versions:
33
-
34
- | Askar | JavaScript Wrapper |
35
- | ----------- | ------------------ |
36
- | v0.2.9 | v0.1.x |
37
- | v0.3.x | v0.2.x |
38
- | v0.4.1 | v0.3.x |
package/cpp/askar.cpp CHANGED
@@ -238,10 +238,10 @@ jsi::Value storeRekey(jsi::Runtime &rt, jsi::Object options) {
238
238
  State *state = new State(&cb);
239
239
  state->rt = &rt;
240
240
 
241
- ErrorCode code = askar_store_rekey(storeHandle,
242
- keyMethod.length() ? keyMethod.c_str() : nullptr,
241
+ ErrorCode code = askar_store_rekey(storeHandle,
242
+ keyMethod.length() ? keyMethod.c_str() : nullptr,
243
243
  passKey.c_str(), callback, CallbackId(state));
244
-
244
+
245
245
  return createReturnValue(rt, code, nullptr);
246
246
  }
247
247
 
@@ -350,7 +350,7 @@ jsi::Value sessionFetchAll(jsi::Runtime &rt, jsi::Object options) {
350
350
  state->rt = &rt;
351
351
 
352
352
  ErrorCode code = askar_session_fetch_all(
353
- sessionHandle,
353
+ sessionHandle,
354
354
  category.c_str(),
355
355
  tagFilter.length() ? tagFilter.c_str() : nullptr,
356
356
  limit,
@@ -518,7 +518,7 @@ jsi::Value sessionUpdateKey(jsi::Runtime &rt, jsi::Object options) {
518
518
 
519
519
  jsi::Value scanStart(jsi::Runtime &rt, jsi::Object options) {
520
520
  auto storeHandle = jsiToValue<int64_t>(rt, options, "storeHandle");
521
- auto category = jsiToValue<std::string>(rt, options, "category");
521
+ auto category = jsiToValue<std::string>(rt, options, "category", true);
522
522
 
523
523
  auto tagFilter = jsiToValue<std::string>(rt, options, "tagFilter", true);
524
524
  auto profile = jsiToValue<std::string>(rt, options, "profile", true);
@@ -532,12 +532,12 @@ jsi::Value scanStart(jsi::Runtime &rt, jsi::Object options) {
532
532
  state->rt = &rt;
533
533
 
534
534
  ErrorCode code = askar_scan_start(
535
- storeHandle,
535
+ storeHandle,
536
536
  profile.length() ? profile.c_str() : nullptr,
537
- category.c_str(),
537
+ category.length() ? category.c_str() : nullptr,
538
538
  tagFilter.length() ? tagFilter.c_str() : nullptr,
539
- offset,
540
- limit,
539
+ offset,
540
+ limit,
541
541
  orderBy.length() ? orderBy.c_str() : nullptr,
542
542
  descending,
543
543
  callbackWithResponse,
@@ -636,9 +636,9 @@ jsi::Value keyGenerate(jsi::Runtime &rt, jsi::Object options) {
636
636
  LocalKeyHandle out;
637
637
 
638
638
  ErrorCode code = askar_key_generate(
639
- algorithm.c_str(),
640
- keyBackend.length() ? keyBackend.c_str() : nullptr,
641
- ephemeral,
639
+ algorithm.c_str(),
640
+ keyBackend.length() ? keyBackend.c_str() : nullptr,
641
+ ephemeral,
642
642
  &out
643
643
  );
644
644
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openwallet-foundation/askar-react-native",
3
- "version": "0.3.1",
3
+ "version": "0.3.2-alpha-20250205012009",
4
4
  "license": "Apache-2.0",
5
5
  "description": "React Native wrapper for Askar",
6
6
  "main": "build/index",
@@ -28,16 +28,9 @@
28
28
  "cpp/**/*.h",
29
29
  "askar.podspec"
30
30
  ],
31
- "scripts": {
32
- "types:check": "pnpm compile --noEmit",
33
- "build": "pnpm clean && pnpm compile",
34
- "clean": "rimraf -rf ./build",
35
- "compile": "tsc -p ./tsconfig.build.json",
36
- "install": "node-pre-gyp install"
37
- },
38
31
  "dependencies": {
39
32
  "@mapbox/node-pre-gyp": "^1.0.11",
40
- "@openwallet-foundation/askar-shared": "0.3.1"
33
+ "@openwallet-foundation/askar-shared": "0.3.2-alpha-20250205012009"
41
34
  },
42
35
  "devDependencies": {
43
36
  "react": "18.2.0",
@@ -55,5 +48,11 @@
55
48
  "host": "https://github.com/openwallet-foundation/askar/releases/download/",
56
49
  "package_name": "library-ios-android.tar.gz"
57
50
  },
58
- "gitHead": "7e626433903c6e138ec6354e3e15447d7056a5f2"
59
- }
51
+ "scripts": {
52
+ "types:check": "pnpm compile --noEmit",
53
+ "build": "pnpm clean && pnpm compile",
54
+ "clean": "rimraf -rf ./build",
55
+ "compile": "tsc -p ./tsconfig.build.json",
56
+ "install": "node-pre-gyp install"
57
+ }
58
+ }