From 786aa14d460f3255864ce459abde8617961b22a2 Mon Sep 17 00:00:00 2001 From: Alfreedom <00tango.bromine@icloud.com> Date: Mon, 1 Jul 2024 10:47:58 +0200 Subject: [PATCH] 2.3.0-beta02 --- CHANGELOG.md | 2 +- README.md | 4 +++- example/dapp/lib/pages/connect_page.dart | 2 +- .../models/auth/auth_client_models.dart | 1 - .../utils/auth/auth_api_validators.dart | 17 ----------------- lib/src/version.dart | 2 +- pubspec.yaml | 4 ++-- test/auth_api/utils/engine_constants.dart | 7 ------- test/auth_api/validation_test.dart | 11 ----------- 9 files changed, 8 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6fa9244..706b77ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.3.0-beta01 +## 2.3.0-beta02 - One-Click Auth support diff --git a/README.md b/README.md index a332a9a6..e2dda8de 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Overview -WalletConnect Dart v2 library for Flutter, heavily inspired by the WalletConnect V2 Javascript Monorepo. +WalletConnect Dart v2 package for WalletKit. https://walletconnect.com/walletkit. + +Check out official docs: https://docs.walletconnect.com/walletkit/overview # To Use diff --git a/example/dapp/lib/pages/connect_page.dart b/example/dapp/lib/pages/connect_page.dart index dad3c545..1691d385 100644 --- a/example/dapp/lib/pages/connect_page.dart +++ b/example/dapp/lib/pages/connect_page.dart @@ -449,7 +449,7 @@ class ConnectPageState extends State { final authResponse = await widget.web3App.authenticate( params: SessionAuthRequestParams( chains: _selectedChains.map((e) => e.chainId).toList(), - domain: Constants.domain, + domain: 'wcflutterdapp://', nonce: AuthUtils.generateNonce(), uri: Constants.aud, statement: 'Welcome to example flutter app', diff --git a/lib/apis/sign_api/models/auth/auth_client_models.dart b/lib/apis/sign_api/models/auth/auth_client_models.dart index 272cf1b3..b1be6e8f 100644 --- a/lib/apis/sign_api/models/auth/auth_client_models.dart +++ b/lib/apis/sign_api/models/auth/auth_client_models.dart @@ -34,7 +34,6 @@ class AuthRequestParams { /// The domain you are logging in to. /// Example: example.com - /// Domain must exist within the aud, or validation will fail final String domain; final String nonce; final String? type; diff --git a/lib/apis/sign_api/utils/auth/auth_api_validators.dart b/lib/apis/sign_api/utils/auth/auth_api_validators.dart index 7d5a39e7..437e9db5 100644 --- a/lib/apis/sign_api/utils/auth/auth_api_validators.dart +++ b/lib/apis/sign_api/utils/auth/auth_api_validators.dart @@ -15,15 +15,6 @@ class AuthApiValidators { 'requestAuth() invalid aud: ${params.aud}. Must be a valid url.', ); } - // final validChainId = true; //NamespaceUtils.isValidChainId(params.chainId); - - if (!params.aud.contains(params.domain)) { - throw Errors.getInternalError( - Errors.MISSING_OR_INVALID, - context: - 'requestAuth() invalid domain: ${params.domain}. aud must contain domain.', - ); - } if (params.nonce.isEmpty) { throw Errors.getInternalError( @@ -92,14 +83,6 @@ class AuthApiValidators { ); } - if (!params.uri.contains(params.domain)) { - throw Errors.getInternalError( - Errors.MISSING_OR_INVALID, - context: - 'authenticate() invalid domain: ${params.domain}. aud must contain domain.', - ); - } - if (params.nonce.isEmpty) { throw Errors.getInternalError( Errors.MISSING_OR_INVALID, diff --git a/lib/src/version.dart b/lib/src/version.dart index 65b3d782..cec7fb2b 100644 --- a/lib/src/version.dart +++ b/lib/src/version.dart @@ -1,2 +1,2 @@ // Generated code. Do not modify. -const packageVersion = '2.3.0-beta01'; +const packageVersion = '2.3.0-beta02'; diff --git a/pubspec.yaml b/pubspec.yaml index 8a5b26a7..bba2985f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: walletconnect_flutter_v2 -description: This repository contains oficial implementation of WalletConnect v2 protocols for Flutter applications. The communications protocol for web3. -version: 2.3.0-beta01 +description: WalletConnect's official Dart library v2 for WalletKit and AppKit. The communications protocol for web3. +version: 2.3.0-beta02 repository: https://github.com/WalletConnect/WalletConnectFlutterV2 environment: diff --git a/test/auth_api/utils/engine_constants.dart b/test/auth_api/utils/engine_constants.dart index c48d184e..15b39f9a 100644 --- a/test/auth_api/utils/engine_constants.dart +++ b/test/auth_api/utils/engine_constants.dart @@ -6,8 +6,6 @@ import 'signature_constants.dart'; const TEST_AUD = 'http://localhost:3000/login'; const TEST_AUD_INVALID = '<>:http://localhost:3000/login'; const TEST_DOMAIN = 'localhost:3000'; -// Invliad because it isn't contained in the audience (aud) -const TEST_DOMAIN_INVALID = 'example.com:3000'; const TEST_PUBLIC_KEY_A = '0x123'; const TEST_PUBLIC_KEY_B = '0xxyz'; @@ -46,11 +44,6 @@ final testAuthRequestParamsInvalidAud = AuthRequestParams( domain: TEST_DOMAIN, aud: TEST_AUD_INVALID, ); -final testAuthRequestParamsInvalidDomain = AuthRequestParams( - chainId: TEST_ETHEREUM_CHAIN, - domain: TEST_DOMAIN_INVALID, - aud: TEST_AUD, -); final testAuthRequestParamsInvalidNonce = AuthRequestParams( chainId: TEST_ETHEREUM_CHAIN, domain: TEST_DOMAIN, diff --git a/test/auth_api/validation_test.dart b/test/auth_api/validation_test.dart index 1f556964..440b073d 100644 --- a/test/auth_api/validation_test.dart +++ b/test/auth_api/validation_test.dart @@ -50,17 +50,6 @@ void main() { ), ), ); - expect( - () => AuthApiValidators.isValidRequest( - testAuthRequestParamsInvalidDomain), - throwsA( - isA().having( - (e) => e.message, - 'message', - 'Missing or invalid. requestAuth() invalid domain: ${testAuthRequestParamsInvalidDomain.domain}. aud must contain domain.', - ), - ), - ); expect( () => AuthApiValidators.isValidRequest( testAuthRequestParamsInvalidNonce,