Skip to content

Commit

Permalink
Merge pull request #1400 from WalletConnect/develop
Browse files Browse the repository at this point in the history
1.19.6
  • Loading branch information
llbartekll authored Aug 13, 2024
2 parents 6b48ddc + 20894e5 commit 1427dcb
Show file tree
Hide file tree
Showing 50 changed files with 715 additions and 161 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source .env
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ jobs:
APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }}
APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }}
WALLETAPP_SENTRY_DSN: ${{ secrets.WALLETAPP_SENTRY_DSN }}
MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }}
run: |
make release APPLE_ID=${{ secrets.APPLE_ID }} TOKEN=$(echo -n $GH_USER:$GH_TOKEN | base64) PROJECT_ID=${{ secrets.RELEASE_PROJECT_ID }} WALLETAPP_SENTRY_DSN=${{ secrets.WALLETAPP_SENTRY_DSN }} MIXPANEL_TOKEN=${{secrets.MIXPANEL_TOKEN}} APP=${{ github.event.inputs.app }}
20 changes: 19 additions & 1 deletion Example/DApp/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,25 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
order: 1,
mobileLink: "rn-web3wallet://",
linkMode: "https://lab.web3modal.com/walletkit_rn"
)
),
.init(
id: "flutter-sample",
name: "Flutter Sample Wallet",
homepage: "https://walletconnect.com/",
imageUrl: "https://avatars.githubusercontent.com/u/37784886?s=200&v=4",
order: 1,
mobileLink: "wcflutterwallet://",
linkMode: "https://lab.web3modal.com/walletkit_flutter"
),
.init(
id: "flutter-sample-internal",
name: "Flutter Sample Wallet Internal",
homepage: "https://walletconnect.com/",
imageUrl: "https://avatars.githubusercontent.com/u/37784886?s=200&v=4",
order: 1,
mobileLink: "wcflutterwallet-internal://",
linkMode: "https://lab.web3modal.com/walletkit_flutter_internal"
),
]
)

Expand Down
40 changes: 20 additions & 20 deletions Example/ExampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2651,7 +2651,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 173;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -2715,7 +2715,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 173;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -2744,7 +2744,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
Expand All @@ -2762,7 +2762,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
Expand All @@ -2784,7 +2784,7 @@
CODE_SIGN_ENTITLEMENTS = DApp/DApp.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 18;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = DApp/Info.plist;
Expand Down Expand Up @@ -2820,7 +2820,7 @@
CODE_SIGN_ENTITLEMENTS = DApp/DAppRelease.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 18;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = DApp/Info.plist;
Expand Down Expand Up @@ -2854,7 +2854,7 @@
CODE_SIGN_ENTITLEMENTS = PNDecryptionService/PNDecryptionService.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = PNDecryptionService/Info.plist;
Expand Down Expand Up @@ -2884,7 +2884,7 @@
CODE_SIGN_ENTITLEMENTS = PNDecryptionService/PNDecryptionServiceRelease.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = PNDecryptionService/Info.plist;
Expand Down Expand Up @@ -2916,7 +2916,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5R8AG9K22;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -2951,7 +2951,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5R8AG9K22;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -2983,7 +2983,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
Expand All @@ -3001,7 +3001,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
Expand All @@ -3019,7 +3019,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand All @@ -3042,7 +3042,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
Expand All @@ -3064,7 +3064,7 @@
CODE_SIGN_ENTITLEMENTS = WalletApp/WalletApp.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 164;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -3100,7 +3100,7 @@
CODE_SIGN_ENTITLEMENTS = WalletApp/WalletAppRelease.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 164;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -3131,7 +3131,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
Expand All @@ -3149,7 +3149,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 173;
DEVELOPMENT_TEAM = W5R8AG9K22;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
Expand Down Expand Up @@ -3277,8 +3277,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/WalletConnect/web3modal-swift";
requirement = {
kind = revision;
revision = 25abd7e5471f21d662400f9763948fbf97c60c97;
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
};
};
A5434021291E6A270068F706 /* XCRemoteSwiftPackageReference "solana-swift" */ = {
Expand Down
4 changes: 2 additions & 2 deletions Example/RelayIntegrationTests/RelayClientEndToEndTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ final class RelayClientEndToEndTests: XCTestCase {
expectationA.assertForOverFulfill = false
expectationB.assertForOverFulfill = false

relayA.messagePublisher.sink { topic, payload, _ in
relayA.messagePublisher.sink { topic, payload, _, _ in
(subscriptionATopic, subscriptionAPayload) = (topic, payload)
expectationA.fulfill()
}.store(in: &publishers)

relayB.messagePublisher.sink { topic, payload, _ in
relayB.messagePublisher.sink { topic, payload, _, _ in
(subscriptionBTopic, subscriptionBPayload) = (topic, payload)
Task(priority: .high) {
sleep(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ final class AuthRequestPresenter: ObservableObject {

/* Redirect */
if let uri = request.requester.redirect?.native {
// WalletConnectRouter.goBack(uri: uri)
WalletConnectRouter.goBack(uri: uri)
router.dismiss()
} else {
showSignedSheet.toggle()
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ let package = Package(
path: "Sources/WalletConnectRouter/Router"),
.target(
name: "WalletConnectVerify",
dependencies: ["WalletConnectUtils", "WalletConnectNetworking"],
dependencies: ["WalletConnectUtils", "WalletConnectNetworking", "WalletConnectJWT"],
resources: [.process("Resources/PrivacyInfo.xcprivacy")]),
.target(
name: "Database",
Expand Down
6 changes: 3 additions & 3 deletions Sources/Auth/Services/Wallet/WalletRequestSubscriber.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ class WalletRequestSubscriber {
Task(priority: .high) {
let assertionId = payload.decryptedPayload.sha256().toHexString()
do {
let response = try await verifyClient.verifyOrigin(assertionId: assertionId)
let verifyContext = verifyClient.createVerifyContext(origin: response.origin, domain: payload.request.payloadParams.domain, isScam: response.isScam)
let response = try await verifyClient.verify(.v1(assertionId: assertionId))
let verifyContext = verifyClient.createVerifyContext(origin: response.origin, domain: payload.request.payloadParams.domain, isScam: response.isScam, isVerified: nil)
verifyContextStore.set(verifyContext, forKey: request.id.string)
onRequest?((request, verifyContext))
} catch {
let verifyContext = verifyClient.createVerifyContext(origin: nil, domain: payload.request.payloadParams.domain, isScam: nil)
let verifyContext = verifyClient.createVerifyContext(origin: nil, domain: payload.request.payloadParams.domain, isScam: nil, isVerified: nil)
verifyContextStore.set(verifyContext, forKey: request.id.string)
onRequest?((request, verifyContext))
return
Expand Down
40 changes: 37 additions & 3 deletions Sources/WalletConnectJWT/JWTValidator.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import Foundation
import CryptoKit

struct JWTValidator {
public struct JWTValidator {

let jwtString: String
private let jwtString: String

func isValid(publicKey: SigningPublicKey) throws -> Bool {
public init(jwtString: String) {
self.jwtString = jwtString
}

public func isValid(publicKey: SigningPublicKey) throws -> Bool {
var components = jwtString.components(separatedBy: ".")

guard components.count == 3 else { throw JWTError.undefinedFormat }
Expand All @@ -20,3 +25,32 @@ struct JWTValidator {
return publicKey.isValid(signature: signatureData, for: unsignedData)
}
}


public struct P256JWTValidator {

private let jwtString: String

public init(jwtString: String) {
self.jwtString = jwtString
}

public func isValid(publicKey: P256.Signing.PublicKey) throws -> Bool {
var components = jwtString.components(separatedBy: ".")

guard components.count == 3 else { throw JWTError.undefinedFormat }

let signature = components.removeLast()

guard let unsignedData = components
.joined(separator: ".")
.data(using: .utf8)
else { throw JWTError.invalidJWTString }

let signatureData = try JWTEncoder.base64urlDecodedData(string: signature)

let P256Signature = try P256.Signing.ECDSASignature(rawRepresentation: signatureData)

return publicKey.isValidSignature(P256Signature, for: unsignedData)
}
}
2 changes: 1 addition & 1 deletion Sources/WalletConnectNetworking/NetworkInteracting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public protocol NetworkInteracting {
var isSocketConnected: Bool { get }
var socketConnectionStatusPublisher: AnyPublisher<SocketConnectionStatus, Never> { get }
var networkConnectionStatusPublisher: AnyPublisher<NetworkConnectionStatus, Never> { get }
var requestPublisher: AnyPublisher<(topic: String, request: RPCRequest, decryptedPayload: Data, publishedAt: Date, derivedTopic: String?), Never> { get }
var requestPublisher: AnyPublisher<(topic: String, request: RPCRequest, decryptedPayload: Data, publishedAt: Date, derivedTopic: String?, encryptedMessage: String, attestation: String?), Never> { get }
func subscribe(topic: String) async throws
func unsubscribe(topic: String)
func batchSubscribe(topics: [String]) async throws
Expand Down
Loading

0 comments on commit 1427dcb

Please sign in to comment.