openwallet-foundation / bifold-wallet

Aries Mobile Agent React Native - Part of the Aries Bifold effort to provide SSI capabilities in a production ready app.
Apache License 2.0
136 stars 134 forks source link

TextEncoder undefined on ios deployment #1156

Open biagioboi opened 3 weeks ago

biagioboi commented 3 weeks ago

I'm trying to release a new JsonLdCredential. As ususal, the JsonLdCredentialFormatService.processCredential() function is called with the right parameters. On line 212 the call to const result = await w3cCredentialService.verifyCredential(agentContext, { credential }); put in the result the following message {"isValid": false, "validations":{"vcJs":{"isValid": false, "results" :[{"proof ": ..., "verified": false, "error" : {"name": "ReferenceError" , "mess age": "Property 'TextEncoder' doesn't exist", "stack": "ReferenceError: Property 'TextEncoder' doesn't existing at ?anon_0_....} which is an error caused by the missing TextEncoder from the JSON Parser or from the Signaure Suite. In any case the class TextEncoder doesn't exist on react native deployment.

Screenshot 2024-06-08 alle 23 37 13

I've seen multiple solutions to this undefined error from another project by importing text-encoding or text-encoding-polyfill but I'm not able to make it work.

Step to reproduce: accept a JsonLdCredential from the wallet with Ed25519Signature2018 proof.

Node.js: v18.18.2 Npm: v9.8.1 Yarn: v3.3.1