Skip to content

Commit

Permalink
2.3.0-beta02
Browse files Browse the repository at this point in the history
  • Loading branch information
quetool committed Jul 1, 2024
1 parent 3372606 commit 786aa14
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 42 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 2.3.0-beta01
## 2.3.0-beta02

- One-Click Auth support

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion example/dapp/lib/pages/connect_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ class ConnectPageState extends State<ConnectPage> {
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',
Expand Down
1 change: 0 additions & 1 deletion lib/apis/sign_api/models/auth/auth_client_models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 0 additions & 17 deletions lib/apis/sign_api/utils/auth/auth_api_validators.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/version.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
7 changes: 0 additions & 7 deletions test/auth_api/utils/engine_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 0 additions & 11 deletions test/auth_api/validation_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ void main() {
),
),
);
expect(
() => AuthApiValidators.isValidRequest(
testAuthRequestParamsInvalidDomain),
throwsA(
isA<WalletConnectError>().having(
(e) => e.message,
'message',
'Missing or invalid. requestAuth() invalid domain: ${testAuthRequestParamsInvalidDomain.domain}. aud must contain domain.',
),
),
);
expect(
() => AuthApiValidators.isValidRequest(
testAuthRequestParamsInvalidNonce,
Expand Down

0 comments on commit 786aa14

Please sign in to comment.