You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are building a React Native app for tickets, where the user will need to scan a QR Code (which is the ticket info, like event name, invitee name, etc) after buying a ticket, and generate a DID using this scanned data. The idea is to use Web5 library to create this wallet/DID for the user in our RN app. I'm kinda new to DID and Web5, so any guidance here will be amazing. Let's talk about the error.
I've installed "@web5/api": "^0.9.3", which I believe is the right lib to create this DID user wallet and added this code in a parent component:
When I try to build and run the app using Expo, I receive this error in my terminal:
Android Bundling failed 11126ms (node_modules/expo-router/entry.js)
The package at "node_modules/@tbd54566975/dwn-sdk-js/dist/esm/src/utils/encryption.js" attempted to import the Node standard library module "crypto".
It failed because the native React runtime does not include the Node standard library.
Learn more: https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries
And in my Android, I receive this huge red error screen:
At some moment, I also saw this different version of the same error, while removing and adding the function call, so looks like it's related with this crypto dependency:
ERROR [Error: undefined Unable to resolve module crypto from /my/local/path/node_modules/multiformats/src/hashes/sha2.js: crypto could not be found within the project or in these directories:
node_modules
1 | // @ts-check
2 |
> 3 | import crypto from 'crypto'
| ^
4 | import { from } from './hasher.js'
5 | import { coerce } from '../bytes.js'
6 |]
It's a React Native app using Expo, If I remove the const { web5, did: myDid } = await Web5.connect(); the error is gone.
How can I solve this issue?
Thanks!
The text was updated successfully, but these errors were encountered:
So, after further discussion on TBD's Discord, the best alternative for us now, until this lib is improved to work properly with React Native, is using your Node.js library.
I really appreciate and the guidance and help @blackgirlbytes
We are building a React Native app for tickets, where the user will need to scan a QR Code (which is the ticket info, like event name, invitee name, etc) after buying a ticket, and generate a DID using this scanned data. The idea is to use Web5 library to create this wallet/DID for the user in our RN app. I'm kinda new to DID and Web5, so any guidance here will be amazing. Let's talk about the error.
I've installed
"@web5/api": "^0.9.3"
, which I believe is the right lib to create this DID user wallet and added this code in a parent component:The
ed
andsecp
I added by myself since I was having an error and those imports are not in the docs, not sure if it's correctAnd added this one in a children's component, just for testing purposes:
When I try to build and run the app using Expo, I receive this error in my terminal:
And in my Android, I receive this huge red error screen:
Here is my package.json file:
my metro.config.js file:
At some moment, I also saw this different version of the same error, while removing and adding the function call, so looks like it's related with this crypto dependency:
It's a React Native app using Expo, If I remove the
const { web5, did: myDid } = await Web5.connect();
the error is gone.How can I solve this issue?
Thanks!
The text was updated successfully, but these errors were encountered: