Skip to content

Commit

Permalink
fix(react-native): move bbs dep to bbs package (#1076)
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra authored Oct 27, 2022
1 parent f777b3d commit c6762bb
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 14 deletions.
5 changes: 0 additions & 5 deletions DEVREADME.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

This file is intended for developers working on the internals of the framework. If you're just looking how to get started with the framework, see the [docs](./docs)

## Installing dependencies

Right now, as a patch that will later be changed, some platforms will have an "error" when installing the dependencies with yarn. This is because the BBS signatures library that we use is built for Linux x86 and MacOS x86 (and not Windows and MacOS arm). This means that it will show that it could not download the binary.
This is not an error for developers, the library that fails is `node-bbs-signaturs` and is an optional dependency for perfomance improvements. It will fallback to a, slower, wasm build.

## Running tests

Test are executed using jest. Some test require either the **mediator agents** or the **ledger** to be running. When running tests that require a connection to the ledger pool, you need to set the `TEST_AGENT_PUBLIC_DID_SEED` and `GENESIS_TXN_PATH` environment variables.
Expand Down
44 changes: 44 additions & 0 deletions packages/bbs-signatures/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,47 @@
<br />

Aries Framework JavaScript BBS Module provides an optional addon to Aries Framework JavaScript to use BBS signatures in W3C VC exchange.

## Installation

```sh
yarn add @aries-framework/bbs-signatures
```

### React Native

When using AFJ inside the React Native environment, temporarily, a dependency for creating keys, signing and verifying, with bbs keys must be swapped. Inside your `package.json` the following must be added. This is only needed for React Native environments

#### yarn

```diff
+ "resolutions": {
+ "@mattrglobal/bbs-signatures": "@animo-id/react-native-bbs-signatures@^0.1.0",
+ },
"dependencies": {
...
+ "@animo-id/react-native-bbs-signatures": "^0.1.0",
}
```

#### npm

```diff
+ "overrides": {
+ "@mattrglobal/bbs-signatures": "@animo-id/react-native-bbs-signatures@^0.1.0",
+ },
"dependencies": {
...
+ "@animo-id/react-native-bbs-signatures": "^0.1.0",
}
```

The resolution field says that any instance of `@mattrglobal/bbs-signatures` in any child dependency must be swapped with `@animo-id/react-native-bbs-signatures`.

The added dependency is required for autolinking and should be the same as the one used in the resolution.

[React Native Bbs Signature](https://github.com/animo/react-native-bbs-signatures) has some quirks with setting it up correctly. If any errors occur while using this library, please refer to their README for the installation guide.

### Issue with `node-bbs-signatures`

Right now some platforms will see an "error" when installing the `@aries-framework/bbs-signatures` package. This is because the BBS signatures library that we use under the hood is built for Linux x86 and MacOS x86 (and not Windows and MacOS arm). This means that it will show that it could not download the binary. This is not an error for developers, the library that fails is `node-bbs-signatures` and is an optional dependency for performance improvements. It will fallback to a (slower) wasm build.
8 changes: 7 additions & 1 deletion packages/bbs-signatures/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@
"@stablelib/random": "^1.0.2"
},
"peerDependencies": {
"@aries-framework/core": "0.2.5"
"@aries-framework/core": "0.2.5",
"@animo-id/react-native-bbs-signatures": "^0.1.0"
},
"devDependencies": {
"@aries-framework/node": "0.2.5",
"reflect-metadata": "^0.1.13",
"rimraf": "~3.0.2",
"typescript": "~4.3.0"
},
"peerDependenciesMeta": {
"@animo-id/react-native-bbs-signatures": {
"optional": true
}
}
}
4 changes: 1 addition & 3 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"events": "^3.3.0"
},
"devDependencies": {
"@animo-id/react-native-bbs-signatures": "^0.1.0",
"@types/indy-sdk-react-native": "npm:@types/indy-sdk@^1.16.21",
"@types/react-native": "^0.64.10",
"indy-sdk-react-native": "^0.2.2",
Expand All @@ -43,7 +42,6 @@
"peerDependencies": {
"indy-sdk-react-native": "^0.2.2",
"react-native-fs": "^2.18.0",
"react-native-get-random-values": "^1.7.0",
"@animo-id/react-native-bbs-signatures": "^0.1.0"
"react-native-get-random-values": "^1.7.0"
}
}
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
"@jridgewell/gen-mapping" "^0.1.0"
"@jridgewell/trace-mapping" "^0.3.9"

"@animo-id/react-native-bbs-signatures@^0.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@animo-id/react-native-bbs-signatures/-/react-native-bbs-signatures-0.1.0.tgz#f62bc16b867c9f690977982d66f0a03566b21ad2"
integrity sha512-7qvsiWhGfUev8ngE8YzF6ON9PtCID5LiYVYM4EC5eyj80gCdhx3R46CI7K1qbqIlGsoTYQ/Xx5Ubo5Ji9eaUEA==

"@azure/core-asynciterator-polyfill@^1.0.0":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@azure/core-asynciterator-polyfill/-/core-asynciterator-polyfill-1.0.2.tgz#0dd3849fb8d97f062a39db0e5cadc9ffaf861fec"
Expand Down

0 comments on commit c6762bb

Please sign in to comment.