Comments (7)
I've just published apg-js
version 4.2.0 specifically modified to address the fix that @Jonathansoufer pointed out and more. Give 4.2.0 a try and if it fixes this problem then I would assume this issue could be closed.
from siwe.
Hello, glad to have your feedback. siwe
libraries require some node polyfills, I'm afraid you might be missing them. You might want to use [SSX](https://docs.ssx.id)
which already includes those and also give you a lot more on top. In the same repo there are a lot of React examples not sure if they can help you out.
from siwe.
Wow, that's quite a finding. Just found a similar issue in APG's issues and will try to see if they might accept your solution. Thanks for the time.
from siwe.
Thank you for your quick reply. I am afraid that doesn't solve the problem. In the scenario, I'm the wallet not the dApp itself. So ssx is used by the dApp to establish with the respective backend all the SIWE flow, but as a wallet using the WalletConnect lib (https://walletconnect.com/) to connect into dApps. From that perspective I just need to parse a request and be able to identify if it's a SIWE or not and produce an object out of the string payload received. I can do it via custom implementation but seems that @spruceid/siwe-parser implements that. What am I missing to make this work with React NATIVE?
from siwe.
FIX Summary: It's boils down that the problem is related with the transformers.js
file from a dependency called apg-js
. This call thisThis.utf16le.decode
returns undefined from thisThis
. Referencing this reported issue https://stackoverflow.com/questions/74969277/jest-import-module-typeerror-cannot-read-properties-of-undefined-reading-utf, the fix was patching the package apg-js
as follows:
diff --git a/src/apg-conv-api/transformers.js b/src/apg-conv-api/transformers.js
index 286ee809ab885035b28b206b8bb4967c47ffb849..e359a21f4b00d14e7fa7f9d13076f9320282a060 100644
--- a/src/apg-conv-api/transformers.js
+++ b/src/apg-conv-api/transformers.js
@@ -504,7 +504,7 @@ exports.utf16be = {
};
// The UTF16LE algorithms.
-exports.utf16le = {
+const utf16le = {
encode(chars) {
const bytes = [];
let char;
@@ -575,6 +575,8 @@ exports.utf16le = {
},
};
+exports.utf16le = utf16le;
+
// The UTF32BE algorithms.
exports.utf32be = {
encode(chars) {
@@ -795,10 +797,10 @@ exports.uint32le = {
// Uses the node.js Buffer's native "utf16le" capabilites.
exports.string = {
encode(chars) {
- return thisThis.utf16le.encode(chars).toString('utf16le');
+ return utf16le.encode(chars).toString('utf16le');
},
decode(str) {
- return thisThis.utf16le.decode(Buffer.from(str, 'utf16le'), 0);
+ return utf16le.decode(Buffer.from(str, 'utf16le'), 0);
},
};
from siwe.
Team work!
from siwe.
Same with me
from siwe.
Related Issues (20)
- Cannot read property 'SiweMessage' of undefined HOT 2
- Invalid signature recovery are logged via console.error, breaking applications with custom logging flow
- Viem support? HOT 13
- isEIP55Address cannot be called because @spruceid/siwe-parser might be below 2.0.0 version HOT 3
- Suggestion regarding siwe-parser usage of apg-js. HOT 9
- Please provide CDN HOT 1
- Change Provider configuration to allow plain RPC URL property
- Cannot sign in with Argent wallet HOT 1
- Custom logo when authenticating, possible? HOT 4
- Crash on iOS 14 When Initializing SiweMessage Instance HOT 5
- I'm not getting the right address when checking HOT 3
- '"ethers"' has no exported member named 'providers' HOT 1
- Why version "2.1.4", requires SiweMessage.version to be 1? HOT 1
- Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (2:0) HOT 1
- Cloudflare Workers compatibility HOT 3
- invalid opts check is looking at the wrong array HOT 1
- update quickstart example code to include provider for 1271 support HOT 1
- Impossible to use siwe library due to issues with ethers v6 and v5. HOT 1
- Verify the nonce Bug
- Should `issuedAt` for `SiweMessage` be a required member variable?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from siwe.