Skip to content

Commit

Permalink
Merge branch 'develop' into optional-namespaces
Browse files Browse the repository at this point in the history
# Conflicts:
#	Example/WalletApp/PresentationLayer/Wallet/Wallet/WalletView.swift
  • Loading branch information
alexander-lsvk committed Feb 15, 2023
2 parents 156ccf7 + 6d53da2 commit 20b1ed8
Show file tree
Hide file tree
Showing 119 changed files with 1,678 additions and 355 deletions.
1 change: 1 addition & 0 deletions .env.Showcase
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SCHEME = "Showcase"
APP_IDENTIFIER = "com.walletconnect.chat"
MATCH_IDENTIFIERS = "com.walletconnect.chat"
APPLE_ID = "1634760092"
1 change: 1 addition & 0 deletions .env.WalletApp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SCHEME = "WalletApp"
APP_IDENTIFIER = "com.walletconnect.walletapp"
MATCH_IDENTIFIERS = "com.walletconnect.walletapp,com.walletconnect.walletapp.PNDecryptionService"
APPLE_ID = "1667351690"
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: release

on:
schedule:
# Runs "Every Monday 10am CET"
- cron: '0 10 * * 1'

workflow_dispatch:

jobs:
build:
runs-on: macos-12

steps:
- uses: actions/checkout@v2

- name: Setup Xcode Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 14.1

- uses: actions/cache@v2
with:
path: |
.build
SourcePackagesCache
DerivedDataCache
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Release
shell: bash
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_USER: ${{ secrets.GH_USER }}
APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }}
APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }}
APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }}
run: |
make release_all APPLE_ID=${{ secrets.APPLE_ID }} TOKEN=$(echo -n $GH_USER:$GH_TOKEN | base64) PROJECT_ID=${{ secrets.RELEASE_PROJECT_ID }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output
fastlane/README.md
.env

# Configuration
Configuration.xcconfig
Expand All @@ -28,4 +29,5 @@ SourcePackagesCache
DerivedDataCache

# Artifacts
*.ipa
*.ipa
*.zip
67 changes: 67 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/WalletConnectEcho.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WalletConnectEcho"
BuildableName = "WalletConnectEcho"
BlueprintName = "WalletConnectEcho"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WalletConnectEcho"
BuildableName = "WalletConnectEcho"
BlueprintName = "WalletConnectEcho"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
143 changes: 126 additions & 17 deletions Example/ExampleApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1410"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WalletConnectJWT"
BuildableName = "WalletConnectJWT"
BlueprintName = "WalletConnectJWT"
ReferencedContainer = "container:..">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WalletConnectJWT"
BuildableName = "WalletConnectJWT"
BlueprintName = "WalletConnectJWT"
ReferencedContainer = "container:..">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1410"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WalletConnectSigner"
BuildableName = "WalletConnectSigner"
BlueprintName = "WalletConnectSigner"
ReferencedContainer = "container:..">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WalletConnectSigner"
BuildableName = "WalletConnectSigner"
BlueprintName = "WalletConnectSigner"
ReferencedContainer = "container:..">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
3 changes: 2 additions & 1 deletion Example/IntegrationTests/Auth/AuthTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ final class AuthTests: XCTestCase {
Task(priority: .high) {
let signerFactory = DefaultSignerFactory()
let signer = MessageSignerFactory(signerFactory: signerFactory).create(projectId: InputConfig.projectId)
let signature = try! signer.sign(payload: request.payload, address: walletAccount.address, privateKey: prvKey, type: .eip191)
let payload = try! request.payload.cacaoPayload(address: walletAccount.address)
let signature = try! signer.sign(payload: payload, privateKey: prvKey, type: .eip191)
try! await walletAuthClient.respond(requestId: request.id, signature: signature, from: walletAccount)
}
}
Expand Down
8 changes: 3 additions & 5 deletions Example/IntegrationTests/Auth/Signer/CacaoSignerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ class CacaoSignerTest: XCTestCase {

func testCacaoSign() throws {
let address = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
let formatted = try SIWEMessageFormatter().formatMessage(
from: payload,
address: address
)
let cacaoPayload = try payload.cacaoPayload(address: address)
let formatted = try SIWECacaoFormatter().formatMessage(from: cacaoPayload)
XCTAssertEqual(formatted, message)
XCTAssertEqual(try signer.sign(payload: payload, address: address, privateKey: privateKey, type: .eip191), signature)
XCTAssertEqual(try signer.sign(payload: cacaoPayload, privateKey: privateKey, type: .eip191), signature)
}

func testCacaoVerify() async throws {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation
import XCTest
@testable import Auth
@testable import WalletConnectSigner
import JSONRPC

class EIP1271VerifierTests: XCTestCase {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation
import XCTest
@testable import Auth
@testable import WalletConnectSigner

class EIP191VerifierTests: XCTestCase {

Expand Down
46 changes: 46 additions & 0 deletions Example/IntegrationTests/Chat/RegistryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,50 @@ import WalletConnectUtils

final class RegistryTests: XCTestCase {

let account = Account("eip155:1:0x15bca56b6e2728aec2532df9d436bd1600e86688")!
let privateKey = Data(hex: "305c6cde3846927892cd32762f6120539f3ec74c9e3a16b9b798b1e85351ae2a")

var sut: IdentityRegisterService!
var storage: IdentityStorage!
var signer: CacaoMessageSigner!

override func setUp() {
let keyserverURL = URL(string: "https://staging.keys.walletconnect.com")!
let httpService = HTTPNetworkClient(host: keyserverURL.host!)
let accountService = AccountService(currentAccount: account)
let identityNetworkService = IdentityNetworkService(accountService: accountService, httpService: httpService)
storage = IdentityStorage(keychain: KeychainStorageMock())
sut = IdentityRegisterService(
keyserverURL: keyserverURL,
identityStorage: storage,
identityNetworkService: identityNetworkService,
iatProvader: DefaultIATProvider(),
messageFormatter: SIWECacaoFormatter()
)
signer = MessageSignerFactory(signerFactory: DefaultSignerFactory()).create(projectId: InputConfig.projectId)
}

func testRegisterIdentityAndInviteKey() async throws {
var message: String!
let publicKey = try await sut.registerIdentity(account: account, isPrivate: false) { msg in
message = msg
return try! signer.sign(message: msg, privateKey: privateKey, type: .eip191)
}

let cacao = try await sut.resolveIdentity(publicKey: publicKey)
XCTAssertEqual(try SIWECacaoFormatter().formatMessage(from: cacao.p), message)

let recovered = storage.getIdentityKey(for: account)!.publicKey.hexRepresentation
XCTAssertEqual(publicKey, recovered)

let inviteKey = try await sut.registerInvite(account: account, isPrivate: false, onSign: { msg in
return try! signer.sign(message: msg, privateKey: privateKey, type: .eip191)
})

let recoveredKey = storage.getInviteKey(for: account)!
XCTAssertEqual(inviteKey, recoveredKey.publicKey.hexRepresentation)

let resolvedKey = try await sut.resolveInvite(account: account)
XCTAssertEqual(inviteKey, resolvedKey)
}
}
2 changes: 1 addition & 1 deletion Example/IntegrationTests/Pairing/PairingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class PairingTests: XCTestCase {
let (pairingClient, networkingInteractor, keychain, keyValueStorage) = makeClientDependencies(prefix: prefix)
let pushLogger = ConsoleLogger(suffix: prefix + " [Push]", loggingLevel: .debug)
walletPairingClient = pairingClient
let echoClient = EchoClientFactory.create(projectId: "", clientId: "", echoHost: "echo.walletconnect.com")
let echoClient = EchoClientFactory.create(projectId: "", clientId: "", echoHost: "echo.walletconnect.com", environment: .sandbox)
walletPushClient = WalletPushClientFactory.create(logger: pushLogger,
keyValueStorage: keyValueStorage,
keychainStorage: keychain,
Expand Down
2 changes: 1 addition & 1 deletion Example/IntegrationTests/Push/PushTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class PushTests: XCTestCase {
let (pairingClient, networkingInteractor, keychain, keyValueStorage) = makeClientDependencies(prefix: prefix)
let pushLogger = ConsoleLogger(suffix: prefix + " [Push]", loggingLevel: .debug)
walletPairingClient = pairingClient
let echoClient = EchoClientFactory.create(projectId: "", clientId: "", echoHost: "echo.walletconnect.com")
let echoClient = EchoClientFactory.create(projectId: "", clientId: "", echoHost: "echo.walletconnect.com", environment: .sandbox)
walletPushClient = WalletPushClientFactory.create(logger: pushLogger,
keyValueStorage: keyValueStorage,
keychainStorage: keychain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ struct ThirdPartyConfigurator: Configurator {
)

Web3Wallet.configure(metadata: metadata, signerFactory: DefaultSignerFactory())
Push.configure()

Push.configure(environment: BuildConfiguration.shared.apnsEnvironment)
}

}
Loading

0 comments on commit 20b1ed8

Please sign in to comment.