Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse message not work #27

Open
spidemen2024 opened this issue May 4, 2024 · 2 comments
Open

parse message not work #27

spidemen2024 opened this issue May 4, 2024 · 2 comments

Comments

@spidemen2024
Copy link

spidemen2024 commented May 4, 2024

It is very funny that the parse message function cannot parse internally built messages I also tried the run test case swie_test.go, but it cannot pass. This repo is open to the public. werid.

	message, err := siwe.InitMessage("example.com", "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", "https://example.com", "2", map[string]interface{}{})
	assert.Nil(t, err)
	assert.Equal(t, "2", message.GetNonce())
	//fmt.Print(message.String())
	// verify nonce
	resMessage, err := siwe.ParseMessage(message.String())
	assert.Nil(t, err)
	assert.Nil(t, message, resMessage)

The above code get an error, really interesting.

@sbihel
Copy link
Member

sbihel commented May 4, 2024

What's the error message? I assume it's because the nonce is too short as it should be at least 8 characters long. The InitMessage function should be improved to add nonce validation

@popfendi
Copy link

i can confirm the same behaviour, a message produced by the example in: https://github.com/spruceid/siwe-quickstart/blob/main/01_frontend/src/index.js#L9

throws the error:
Invalid Message: Message could not be parsed
when calling:
message, err := siwe.ParseMessage(req.Message)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants