magiclabs / magic-js

Magic browser/React Native JavaScript SDK is your entry-point to integrating passwordless authentication inside your application.
https://magic.link/docs/api-reference/client-side-sdks/web
Apache License 2.0
462 stars 86 forks source link

Flow domain tags problem #344

Open bluesign opened 2 years ago

bluesign commented 2 years ago

✅ Prerequisites

🐛 Description

https://github.com/magiclabs/magic-js/pull/293 broke Flow transaction signing for FCL >= 0.0.46

🧩 Steps to Reproduce

Try to run demo app with FCL >= 0.0.46 ( which is very old version )

😮 Actual behavior

FAILED TRANSACTION [Error Code: 1006] invalid proposal key: public key 0 on account 4333f1b7e58a550a does not have a valid signature: [Error Code: 1009] invalid envelope key: public key 0 on account 4333f1b7e58a550a does not have a valid signature: signature is not valid

FCL 0.0.46 introduces domain tags to FCL

2021-05-05 BREAKING -- Prepends a transaction domain tag to encoded payload and envelope messages. Transaction domain tags allow signers to identify which messages are intended to represent encoded transactions, and which are not. The Flow protocol has been updated (as of May 5th 2021) to both accept signatures produced from messages prepended with a transaction domain tag, and from messages that are not. The next spork (time and date of next spork are TBD) will strictly require all signatures for transnactions to have been produced from messages prepended with a transaction domain tag. This breaking change requires all users of Flow Client Library and the Flow JavaScript SDK to update their versions to a version greater than or equal to the verison that this change was included in.

Probably you started prepending domain tag when signing and this caused double domain tag on payload. As FCL already prepends when version is >= 0.0.46

am-hernandez commented 2 years ago

Thank you @bluesign for reporting this issue. I will bring this to our Engineering team and will update this issue accordingly.

gregsantos commented 1 year ago

Wondering if there has been an update here for Flow tx signing support?

zolrath commented 1 year ago

Looking for an update here as well.

Thank you!