Skip to content

Commit 25ed97f

Browse files
committed
docs(changeset): fix: wrap the askar registration.
Signed-off-by: Timo Glastra <timo@animo.id>
1 parent c36ad59 commit 25ed97f

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.changeset/wet-comics-love.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@openwallet-foundation/askar-react-native": patch
3+
"@openwallet-foundation/askar-nodejs": patch
4+
"@openwallet-foundation/askar-shared": patch
5+
---
6+
7+
fix: wrap the askar registration with a `NativeAskar` class that exposes two static members: a `.instance` getter and `register` method.
8+
9+
Previously when you did not import the native askar library on the first line (or above all logic that uses Askar) the reference to Askar would be undefined. (i.e. askar-shared is imported before askar-react-native or askar-nodejs)
10+
11+
The `registerAskar` method and `askar` property are kept for backwards compatibility, but these are still prone to the same error. `registerAskar` integrated with the new `NativeAskar` class, and so all usages within the shared library, as well as the nodejs and react-native wrappers will be fixed. We recommend to update to the new `NativeAskar` class for all other usages.

packages/askar-nodejs/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { registerAskar } from '@openwallet-foundation/askar-shared'
1+
import { NativeAskar } from '@openwallet-foundation/askar-shared'
22
import { NodeJSAskar } from './NodeJSAskar'
33

44
export const askarNodeJS = new NodeJSAskar()
5-
registerAskar({ askar: askarNodeJS })
5+
NativeAskar.register(askarNodeJS)
66

77
export * from '@openwallet-foundation/askar-shared'

packages/askar-react-native/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { registerAskar } from '@openwallet-foundation/askar-shared'
1+
import { NativeAskar } from '@openwallet-foundation/askar-shared'
22
import { NativeModules } from 'react-native'
33
import type { NativeBindings } from './NativeBindings'
44

@@ -17,4 +17,4 @@ if (!_askar) {
1717

1818
declare let _askar: NativeBindings
1919

20-
registerAskar({ askar: new ReactNativeAskar(_askar) })
20+
NativeAskar.register(new ReactNativeAskar(_askar))

0 commit comments

Comments
 (0)