-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from WalletConnect/chores/siwe_bug_fixes_and_…
…enhancements Bug fixes and enhancements for SIWE
- Loading branch information
Showing
15 changed files
with
87 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
## 3.3.0-beta04 | ||
## 3.3.0-beta05 | ||
|
||
- One-Click Auth + SIWE implementation | ||
- Coinbase Wallet dependency update | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import 'package:walletconnect_flutter_v2/apis/sign_api/models/auth/common_auth_models.dart'; | ||
import 'package:walletconnect_flutter_v2/apis/sign_api/utils/auth/auth_signature.dart' | ||
as wcfv2; | ||
import 'package:walletconnect_flutter_v2/apis/sign_api/utils/auth/auth_utils.dart'; | ||
import 'package:web3modal_flutter/services/siwe_service/models/w3m_siwe.dart'; | ||
import 'package:web3modal_flutter/services/siwe_service/siwe_service_singleton.dart'; | ||
|
||
class AuthSignature { | ||
/// Given SIWECreateMessageArgs will format message according to EIP-4361 https://docs.login.xyz/general-information/siwe-overview/eip-4361 | ||
static String formatMessage(SIWECreateMessageArgs params) { | ||
return siweService.instance!.formatMessage( | ||
params, | ||
); | ||
} | ||
|
||
static String getAddressFromMessage(String message) { | ||
return wcfv2.AuthSignature.getAddressFromMessage(message); | ||
} | ||
|
||
static String getChainIdFromMessage(String message) { | ||
return wcfv2.AuthSignature.getChainIdFromMessage(message); | ||
} | ||
|
||
// verifies CACAO signature | ||
// Used by the wallet after formatting the message | ||
static Future<bool> verifySignature( | ||
String address, | ||
String message, | ||
CacaoSignature cacaoSignature, | ||
String chainId, | ||
String projectId, | ||
) async { | ||
return wcfv2.AuthSignature.verifySignature( | ||
address, | ||
message, | ||
cacaoSignature, | ||
chainId, | ||
projectId, | ||
); | ||
} | ||
|
||
static String generateNonce() { | ||
return AuthUtils.generateNonce(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters