From b6b863234a726b7fbabef6c989ada80c9b17d738 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Tue, 2 Aug 2022 15:15:25 +0200 Subject: [PATCH 1/3] manage keys for response --- .../Services/Wallet/AuthRequestSubscriber.swift | 15 +++++++++++++-- .../Auth/Services/Wallet/AuthRespondService.swift | 15 ++++++++++++++- .../Auth/Types/RequestSubscriptionPayload.swift | 2 +- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Sources/Auth/Services/Wallet/AuthRequestSubscriber.swift b/Sources/Auth/Services/Wallet/AuthRequestSubscriber.swift index 904ed6106..664cb688b 100644 --- a/Sources/Auth/Services/Wallet/AuthRequestSubscriber.swift +++ b/Sources/Auth/Services/Wallet/AuthRequestSubscriber.swift @@ -1,9 +1,11 @@ import Combine import Foundation import WalletConnectUtils +import WalletConnectKMS class AuthRequestSubscriber { private let networkingInteractor: NetworkInteracting + private let kms: KeyManagementService private let logger: ConsoleLogging private var publishers = [AnyCancellable]() private let messageFormatter: SIWEMessageFormatting @@ -21,17 +23,26 @@ class AuthRequestSubscriber { private func subscribeForRequest() { networkingInteractor.requestPublisher.sink { [unowned self] subscriptionPayload in guard subscriptionPayload.request.method == "wc_authRequest" else { return } - guard let authRequest = try? subscriptionPayload.request.params?.get(AuthRequestParams.self) else { + guard let authRequestParams = try? subscriptionPayload.request.params?.get(AuthRequestParams.self) else { logger.debug("Malformed auth request params") return } do { - let message = try messageFormatter.formatMessage(from: authRequest) + let message = try messageFormatter.formatMessage(from: authRequestParams) guard let requestId = subscriptionPayload.request.id?.right else { return } + try setKeysForResponse(authRequestParams: authRequestParams) onRequest?(requestId, message) } catch { logger.debug(error) } }.store(in: &publishers) } + + private func setKeysForResponse(authRequestParams: AuthRequestParams) throws { + let peerPubKey = authRequestParams.requester.publicKey + let responseTopic = peerPubKey.rawRepresentation.sha256().toHexString() + let selfPubKey = try kms.createX25519KeyPair() + let agreementKeys = try kms.performKeyAgreement(selfPublicKey: selfPubKey, peerPublicKey: peerPubKey) + try kms.setAgreementSecret(agreementKeys, topic: responseTopic) + } } diff --git a/Sources/Auth/Services/Wallet/AuthRespondService.swift b/Sources/Auth/Services/Wallet/AuthRespondService.swift index 718f02de0..a287643a8 100644 --- a/Sources/Auth/Services/Wallet/AuthRespondService.swift +++ b/Sources/Auth/Services/Wallet/AuthRespondService.swift @@ -1,13 +1,26 @@ import Foundation +import WalletConnectKMS actor AuthRespondService { private let networkingInteractor: NetworkInteracting + private let kms: KeyManagementService - init(networkingInteractor: NetworkInteracting) { + init(networkingInteractor: NetworkInteracting, + kms: KeyManagementService, + logger: ConsoleLogging) { self.networkingInteractor = networkingInteractor + self.kms = kms + self.logger = logger } func respond(respondParams: RespondParams) async throws { +// B generates keyPair Y and generates shared symKey R. + let pubKey = try kms.createX25519KeyPair() + kms.performKeyAgreement(selfPublicKey: pubKey, peerPublicKey: <#T##String#>) + +// B encrypts response with symKey R as type 1 envelope. + +// B sends response on response topic. } } diff --git a/Sources/Auth/Types/RequestSubscriptionPayload.swift b/Sources/Auth/Types/RequestSubscriptionPayload.swift index 0a13c1bfb..17bdb8cb3 100644 --- a/Sources/Auth/Types/RequestSubscriptionPayload.swift +++ b/Sources/Auth/Types/RequestSubscriptionPayload.swift @@ -2,6 +2,6 @@ import Foundation import JSONRPC struct RequestSubscriptionPayload: Codable { - let topic: String + let id: String let request: RPCRequest } From e6f44d6aa14e6cf1e3336cf1f15e82f98f6988c1 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Wed, 3 Aug 2022 09:52:40 +0200 Subject: [PATCH 2/3] update AuthRespondService, extend RPCResponse --- .../Common/NetworkingInteractor.swift | 13 +++++-- .../Wallet/AuthRequestSubscriber.swift | 11 +----- .../Services/Wallet/AuthRespondService.swift | 35 +++++++++++++++---- Sources/Auth/Types/RespondParams.swift | 1 + Sources/JSONRPC/RPCResponse.swift | 4 +++ Sources/WalletConnectUtils/RPCHistory.swift | 2 +- 6 files changed, 46 insertions(+), 20 deletions(-) diff --git a/Sources/Auth/Services/Common/NetworkingInteractor.swift b/Sources/Auth/Services/Common/NetworkingInteractor.swift index 5e9f8444e..c577e864c 100644 --- a/Sources/Auth/Services/Common/NetworkingInteractor.swift +++ b/Sources/Auth/Services/Common/NetworkingInteractor.swift @@ -8,7 +8,8 @@ import JSONRPC protocol NetworkInteracting { var requestPublisher: AnyPublisher {get} func subscribe(topic: String) async throws - func request(_ request: RPCRequest, topic: String, envelopeType: Envelope.EnvelopeType) async throws + func request(_ request: RPCRequest, topic: String, tag: Int, envelopeType: Envelope.EnvelopeType) async throws + func respond(topic: String, response: RPCResponse, tag: Int, envelopeType: Envelope.EnvelopeType) async throws } extension NetworkInteracting { @@ -39,9 +40,15 @@ class NetworkingInteractor: NetworkInteracting { try await relayClient.subscribe(topic: topic) } - func request(_ request: RPCRequest, topic: String, envelopeType: Envelope.EnvelopeType) async throws { + func request(_ request: RPCRequest, topic: String, tag: Int, envelopeType: Envelope.EnvelopeType) async throws { try rpcHistory.set(request, forTopic: topic, emmitedBy: .local) let message = try! serializer.serialize(topic: topic, encodable: request, envelopeType: envelopeType) - try await relayClient.publish(topic: topic, payload: message, tag: AuthRequestParams.tag) + try await relayClient.publish(topic: topic, payload: message, tag: tag) + } + + func respond(topic: String, response: RPCResponse, tag: Int, envelopeType: Envelope.EnvelopeType) async throws { + try rpcHistory.resolve(response) + let message = try! serializer.serialize(topic: topic, encodable: response, envelopeType: envelopeType) + try await relayClient.publish(topic: topic, payload: message, tag: tag) } } diff --git a/Sources/Auth/Services/Wallet/AuthRequestSubscriber.swift b/Sources/Auth/Services/Wallet/AuthRequestSubscriber.swift index 664cb688b..240e9654f 100644 --- a/Sources/Auth/Services/Wallet/AuthRequestSubscriber.swift +++ b/Sources/Auth/Services/Wallet/AuthRequestSubscriber.swift @@ -1,11 +1,9 @@ import Combine import Foundation import WalletConnectUtils -import WalletConnectKMS class AuthRequestSubscriber { private let networkingInteractor: NetworkInteracting - private let kms: KeyManagementService private let logger: ConsoleLogging private var publishers = [AnyCancellable]() private let messageFormatter: SIWEMessageFormatting @@ -30,7 +28,6 @@ class AuthRequestSubscriber { do { let message = try messageFormatter.formatMessage(from: authRequestParams) guard let requestId = subscriptionPayload.request.id?.right else { return } - try setKeysForResponse(authRequestParams: authRequestParams) onRequest?(requestId, message) } catch { logger.debug(error) @@ -38,11 +35,5 @@ class AuthRequestSubscriber { }.store(in: &publishers) } - private func setKeysForResponse(authRequestParams: AuthRequestParams) throws { - let peerPubKey = authRequestParams.requester.publicKey - let responseTopic = peerPubKey.rawRepresentation.sha256().toHexString() - let selfPubKey = try kms.createX25519KeyPair() - let agreementKeys = try kms.performKeyAgreement(selfPublicKey: selfPubKey, peerPublicKey: peerPubKey) - try kms.setAgreementSecret(agreementKeys, topic: responseTopic) - } + } diff --git a/Sources/Auth/Services/Wallet/AuthRespondService.swift b/Sources/Auth/Services/Wallet/AuthRespondService.swift index a287643a8..499af7387 100644 --- a/Sources/Auth/Services/Wallet/AuthRespondService.swift +++ b/Sources/Auth/Services/Wallet/AuthRespondService.swift @@ -1,25 +1,48 @@ import Foundation import WalletConnectKMS +import JSONRPC +import WalletConnectUtils actor AuthRespondService { + enum Errors: Error { + case recordForIdNotFound + } private let networkingInteractor: NetworkInteracting private let kms: KeyManagementService + private let rpcHistory: RPCHistory + private let logger: ConsoleLogging init(networkingInteractor: NetworkInteracting, - kms: KeyManagementService, - logger: ConsoleLogging) { + logger: ConsoleLogging, + kms: KeyManagementService) { self.networkingInteractor = networkingInteractor + self.logger = logger self.kms = kms self.logger = logger } func respond(respondParams: RespondParams) async throws { -// B generates keyPair Y and generates shared symKey R. - let pubKey = try kms.createX25519KeyPair() - kms.performKeyAgreement(selfPublicKey: pubKey, peerPublicKey: <#T##String#>) + guard let request = rpcHistory.get(recordId: RPCID(respondParams.id))?.request else { throw Errors.recordForIdNotFound } + + guard let authRequestParams = try? request.params?.get(AuthRequestParams.self) else { + logger.debug("Malformed auth request params") + return + } + + let peerPubKey = authRequestParams.requester.publicKey + let responseTopic = peerPubKey.rawRepresentation.sha256().toHexString() + let selfPubKey = try kms.createX25519KeyPair() + let agreementKeys = try kms.performKeyAgreement(selfPublicKey: selfPubKey, peerPublicKey: peerPubKey) + try kms.setAgreementSecret(agreementKeys, topic: responseTopic) + + + let cacao = + let response = RPCResponse(id: request.id, result: cacao) + + -// B encrypts response with symKey R as type 1 envelope. + networkingInteractor.respond(topic: respondParams.topic, response: response, tag: AuthResponseParams.tag, envelopeType: .type1(pubKey: selfPubKey.rawRepresentation)) // B sends response on response topic. } diff --git a/Sources/Auth/Types/RespondParams.swift b/Sources/Auth/Types/RespondParams.swift index c316e92d5..fcd9b3293 100644 --- a/Sources/Auth/Types/RespondParams.swift +++ b/Sources/Auth/Types/RespondParams.swift @@ -1,6 +1,7 @@ import Foundation struct RespondParams { + let id: Int64 let topic: String let signature: CacaoSignature } diff --git a/Sources/JSONRPC/RPCResponse.swift b/Sources/JSONRPC/RPCResponse.swift index 9a350c460..e0e60f06f 100644 --- a/Sources/JSONRPC/RPCResponse.swift +++ b/Sources/JSONRPC/RPCResponse.swift @@ -43,6 +43,10 @@ public struct RPCResponse: Equatable { self.init(id: RPCID(id), outcome: .success(AnyCodable(result))) } + public init(id: RPCID, result: C) where C: Codable { + self.init(id: id, outcome: .success(AnyCodable(result))) + } + public init(id: Int64, error: JSONRPCError) { self.init(id: RPCID(id), outcome: .failure(error)) } diff --git a/Sources/WalletConnectUtils/RPCHistory.swift b/Sources/WalletConnectUtils/RPCHistory.swift index 86c5b8d05..9db98e294 100644 --- a/Sources/WalletConnectUtils/RPCHistory.swift +++ b/Sources/WalletConnectUtils/RPCHistory.swift @@ -10,7 +10,7 @@ public final class RPCHistory { let id: RPCID let topic: String let origin: Origin - let request: RPCRequest + public let request: RPCRequest var response: RPCResponse? = nil } From 39238f0f164afda92bdec26da3337cf7f1e020d4 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Wed, 3 Aug 2022 10:13:55 +0200 Subject: [PATCH 3/3] Update Auth respond service --- Example/IntegrationTests/Chat/ChatTests.swift | 2 +- Package.swift | 2 +- .../Services/App/AuthRequestService.swift | 3 +-- .../Auth/Services/Common/CacaoFormatter.swift | 11 ++++++++ .../Common/NetworkingInteractor.swift | 5 ++-- .../Wallet/AuthRequestSubscriber.swift | 3 +-- .../Services/Wallet/AuthRespondService.swift | 26 +++++++------------ Sources/Auth/Types/Cacao/Cacao.swift | 7 +++++ .../ProtocolRPCParams/AuthRequestParams.swift | 1 - .../AuthResponseParams.swift | 1 - .../Types/RequestSubscriptionPayload.swift | 2 +- Sources/Chat/ChatClientFactory.swift | 3 +-- Sources/WalletConnectUtils/RPCHistory.swift | 2 +- .../Mocks/NetworkingInteractorMock.swift | 14 ++++++++-- .../Mocks/SIWEMessageFormatterMock.swift | 1 - .../Stubs/RequestSubscriptionPayload.swift | 3 +-- .../ApproveEngineTests.swift | 2 +- 17 files changed, 50 insertions(+), 38 deletions(-) create mode 100644 Sources/Auth/Services/Common/CacaoFormatter.swift create mode 100644 Sources/Auth/Types/Cacao/Cacao.swift diff --git a/Example/IntegrationTests/Chat/ChatTests.swift b/Example/IntegrationTests/Chat/ChatTests.swift index d89910ee1..812b34e05 100644 --- a/Example/IntegrationTests/Chat/ChatTests.swift +++ b/Example/IntegrationTests/Chat/ChatTests.swift @@ -15,7 +15,7 @@ final class ChatTests: XCTestCase { override func setUp() { registry = KeyValueRegistry() invitee = makeClient(prefix: "🦖 Registered") - inviter = makeClient(prefix: "🍄 Inviter") + inviter = makeClient(prefix: "🍄 Inviter") waitClientsConnected() } diff --git a/Package.swift b/Package.swift index 14aa4884f..a94e15017 100644 --- a/Package.swift +++ b/Package.swift @@ -18,7 +18,7 @@ let package = Package( targets: ["Chat"]), .library( name: "WalletConnectPairing", - targets: ["WalletConnectPairing"]), + targets: ["WalletConnectPairing"]) ], dependencies: [], targets: [ diff --git a/Sources/Auth/Services/App/AuthRequestService.swift b/Sources/Auth/Services/App/AuthRequestService.swift index 75f22f9ec..b82d5259b 100644 --- a/Sources/Auth/Services/App/AuthRequestService.swift +++ b/Sources/Auth/Services/App/AuthRequestService.swift @@ -24,8 +24,7 @@ actor AuthRequestService { let payload = AuthPayload(requestParams: params, iat: issueAt) let params = AuthRequestParams(requester: requester, payloadParams: payload) let request = RPCRequest(method: "wc_authRequest", params: params) - try await networkingInteractor.request(request, topic: topic) + try await networkingInteractor.request(request, topic: topic, tag: AuthRequestParams.tag) try await networkingInteractor.subscribe(topic: responseTopic) } } - diff --git a/Sources/Auth/Services/Common/CacaoFormatter.swift b/Sources/Auth/Services/Common/CacaoFormatter.swift new file mode 100644 index 000000000..7daf6b3d1 --- /dev/null +++ b/Sources/Auth/Services/Common/CacaoFormatter.swift @@ -0,0 +1,11 @@ +import Foundation + +protocol CacaoFormatting { + func format(_ request: AuthRequestParams, _ signature: CacaoSignature, _ issuer: Account) -> Cacao +} + +class CacaoFormatter: CacaoFormatting { + func format(_ request: AuthRequestParams, _ signature: CacaoSignature, _ issuer: Account) -> Cacao { + fatalError("not implemented") + } +} diff --git a/Sources/Auth/Services/Common/NetworkingInteractor.swift b/Sources/Auth/Services/Common/NetworkingInteractor.swift index c577e864c..c81420b26 100644 --- a/Sources/Auth/Services/Common/NetworkingInteractor.swift +++ b/Sources/Auth/Services/Common/NetworkingInteractor.swift @@ -13,12 +13,11 @@ protocol NetworkInteracting { } extension NetworkInteracting { - func request(_ request: RPCRequest, topic: String, envelopeType: Envelope.EnvelopeType = .type0) async throws { - try await self.request(request, topic: topic, envelopeType: envelopeType) + func request(_ request: RPCRequest, topic: String, tag: Int, envelopeType: Envelope.EnvelopeType = .type0) async throws { + try await self.request(request, topic: topic, tag: tag, envelopeType: envelopeType) } } - class NetworkingInteractor: NetworkInteracting { private let relayClient: RelayClient private let serializer: Serializing diff --git a/Sources/Auth/Services/Wallet/AuthRequestSubscriber.swift b/Sources/Auth/Services/Wallet/AuthRequestSubscriber.swift index 240e9654f..07469153d 100644 --- a/Sources/Auth/Services/Wallet/AuthRequestSubscriber.swift +++ b/Sources/Auth/Services/Wallet/AuthRequestSubscriber.swift @@ -7,7 +7,7 @@ class AuthRequestSubscriber { private let logger: ConsoleLogging private var publishers = [AnyCancellable]() private let messageFormatter: SIWEMessageFormatting - var onRequest: ((_ id: Int64, _ message: String)->())? + var onRequest: ((_ id: Int64, _ message: String)->Void)? init(networkingInteractor: NetworkInteracting, logger: ConsoleLogging, @@ -35,5 +35,4 @@ class AuthRequestSubscriber { }.store(in: &publishers) } - } diff --git a/Sources/Auth/Services/Wallet/AuthRespondService.swift b/Sources/Auth/Services/Wallet/AuthRespondService.swift index 499af7387..006459d37 100644 --- a/Sources/Auth/Services/Wallet/AuthRespondService.swift +++ b/Sources/Auth/Services/Wallet/AuthRespondService.swift @@ -6,6 +6,7 @@ import WalletConnectUtils actor AuthRespondService { enum Errors: Error { case recordForIdNotFound + case malformedAuthRequestParams } private let networkingInteractor: NetworkInteracting private let kms: KeyManagementService @@ -14,21 +15,17 @@ actor AuthRespondService { init(networkingInteractor: NetworkInteracting, logger: ConsoleLogging, - kms: KeyManagementService) { + kms: KeyManagementService, + rpcHistory: RPCHistory) { self.networkingInteractor = networkingInteractor self.logger = logger self.kms = kms - self.logger = logger + self.rpcHistory = rpcHistory } - func respond(respondParams: RespondParams) async throws { - + func respond(respondParams: RespondParams, issuer: Account) async throws { guard let request = rpcHistory.get(recordId: RPCID(respondParams.id))?.request else { throw Errors.recordForIdNotFound } - - guard let authRequestParams = try? request.params?.get(AuthRequestParams.self) else { - logger.debug("Malformed auth request params") - return - } + guard let authRequestParams = try? request.params?.get(AuthRequestParams.self) else { throw Errors.malformedAuthRequestParams } let peerPubKey = authRequestParams.requester.publicKey let responseTopic = peerPubKey.rawRepresentation.sha256().toHexString() @@ -36,14 +33,9 @@ actor AuthRespondService { let agreementKeys = try kms.performKeyAgreement(selfPublicKey: selfPubKey, peerPublicKey: peerPubKey) try kms.setAgreementSecret(agreementKeys, topic: responseTopic) + let cacao = CacaoFormatter().format(authRequestParams, respondParams.signature, issuer) + let response = RPCResponse(id: request.id!, result: cacao) - let cacao = - let response = RPCResponse(id: request.id, result: cacao) - - - - networkingInteractor.respond(topic: respondParams.topic, response: response, tag: AuthResponseParams.tag, envelopeType: .type1(pubKey: selfPubKey.rawRepresentation)) - -// B sends response on response topic. + try await networkingInteractor.respond(topic: respondParams.topic, response: response, tag: AuthResponseParams.tag, envelopeType: .type1(pubKey: selfPubKey.rawRepresentation)) } } diff --git a/Sources/Auth/Types/Cacao/Cacao.swift b/Sources/Auth/Types/Cacao/Cacao.swift new file mode 100644 index 000000000..95a2d59c5 --- /dev/null +++ b/Sources/Auth/Types/Cacao/Cacao.swift @@ -0,0 +1,7 @@ +import Foundation + +struct Cacao: Codable, Equatable { + let header: CacaoHeader + let payload: CacaoPayload + let signature: CacaoSignature +} diff --git a/Sources/Auth/Types/ProtocolRPCParams/AuthRequestParams.swift b/Sources/Auth/Types/ProtocolRPCParams/AuthRequestParams.swift index 9c7bdeb2f..c39ba3489 100644 --- a/Sources/Auth/Types/ProtocolRPCParams/AuthRequestParams.swift +++ b/Sources/Auth/Types/ProtocolRPCParams/AuthRequestParams.swift @@ -1,4 +1,3 @@ - import Foundation import WalletConnectUtils diff --git a/Sources/Auth/Types/ProtocolRPCParams/AuthResponseParams.swift b/Sources/Auth/Types/ProtocolRPCParams/AuthResponseParams.swift index ccf385bc6..a0d64b152 100644 --- a/Sources/Auth/Types/ProtocolRPCParams/AuthResponseParams.swift +++ b/Sources/Auth/Types/ProtocolRPCParams/AuthResponseParams.swift @@ -1,4 +1,3 @@ - import Foundation import WalletConnectUtils diff --git a/Sources/Auth/Types/RequestSubscriptionPayload.swift b/Sources/Auth/Types/RequestSubscriptionPayload.swift index 17bdb8cb3..b7865d715 100644 --- a/Sources/Auth/Types/RequestSubscriptionPayload.swift +++ b/Sources/Auth/Types/RequestSubscriptionPayload.swift @@ -2,6 +2,6 @@ import Foundation import JSONRPC struct RequestSubscriptionPayload: Codable { - let id: String + let id: Int64 let request: RPCRequest } diff --git a/Sources/Chat/ChatClientFactory.swift b/Sources/Chat/ChatClientFactory.swift index f524337df..89f4907b1 100644 --- a/Sources/Chat/ChatClientFactory.swift +++ b/Sources/Chat/ChatClientFactory.swift @@ -10,8 +10,7 @@ public struct ChatClientFactory { relayClient: RelayClient, kms: KeyManagementService, logger: ConsoleLogging, - keyValueStorage: KeyValueStorage) -> ChatClient - { + keyValueStorage: KeyValueStorage) -> ChatClient { let topicToRegistryRecordStore = CodableStore(defaults: keyValueStorage, identifier: StorageDomainIdentifiers.topicToInvitationPubKey.rawValue) let serialiser = Serializer(kms: kms) let jsonRpcHistory = JsonRpcHistory(logger: logger, keyValueStore: CodableStore(defaults: keyValueStorage, identifier: StorageDomainIdentifiers.jsonRpcHistory.rawValue)) diff --git a/Sources/WalletConnectUtils/RPCHistory.swift b/Sources/WalletConnectUtils/RPCHistory.swift index 9db98e294..8112cacc3 100644 --- a/Sources/WalletConnectUtils/RPCHistory.swift +++ b/Sources/WalletConnectUtils/RPCHistory.swift @@ -11,7 +11,7 @@ public final class RPCHistory { let topic: String let origin: Origin public let request: RPCRequest - var response: RPCResponse? = nil + var response: RPCResponse? } enum HistoryError: Error { diff --git a/Tests/AuthTests/Mocks/NetworkingInteractorMock.swift b/Tests/AuthTests/Mocks/NetworkingInteractorMock.swift index 6b7e061bf..32e8abe85 100644 --- a/Tests/AuthTests/Mocks/NetworkingInteractorMock.swift +++ b/Tests/AuthTests/Mocks/NetworkingInteractorMock.swift @@ -1,16 +1,26 @@ import Foundation import Combine @testable import Auth +import JSONRPC +import WalletConnectKMS struct NetworkingInteractorMock: NetworkInteracting { + let requestPublisherSubject = PassthroughSubject() var requestPublisher: AnyPublisher { requestPublisherSubject.eraseToAnyPublisher() } - + func subscribe(topic: String) async throws { - + + } + + func request(_ request: RPCRequest, topic: String, tag: Int, envelopeType: Envelope.EnvelopeType) async throws { + } + func respond(topic: String, response: RPCResponse, tag: Int, envelopeType: Envelope.EnvelopeType) async throws { + + } } diff --git a/Tests/AuthTests/Mocks/SIWEMessageFormatterMock.swift b/Tests/AuthTests/Mocks/SIWEMessageFormatterMock.swift index 9b14ba473..b576bfc68 100644 --- a/Tests/AuthTests/Mocks/SIWEMessageFormatterMock.swift +++ b/Tests/AuthTests/Mocks/SIWEMessageFormatterMock.swift @@ -7,4 +7,3 @@ class SIWEMessageFormatterMock: SIWEMessageFormatting { return formattedMessage } } - diff --git a/Tests/AuthTests/Stubs/RequestSubscriptionPayload.swift b/Tests/AuthTests/Stubs/RequestSubscriptionPayload.swift index 73401fc60..0423623ec 100644 --- a/Tests/AuthTests/Stubs/RequestSubscriptionPayload.swift +++ b/Tests/AuthTests/Stubs/RequestSubscriptionPayload.swift @@ -10,7 +10,6 @@ extension RequestSubscriptionPayload { let payload = AuthPayload(requestParams: RequestParams.stub(), iat: issueAt) let params = AuthRequestParams(requester: requester, payloadParams: payload) let request = RPCRequest(method: "wc_authRequest", params: params, id: id) - return RequestSubscriptionPayload(topic: "", request: request) + return RequestSubscriptionPayload(id: 123, request: request) } } - diff --git a/Tests/WalletConnectSignTests/ApproveEngineTests.swift b/Tests/WalletConnectSignTests/ApproveEngineTests.swift index ea2b09fee..88e7a541c 100644 --- a/Tests/WalletConnectSignTests/ApproveEngineTests.swift +++ b/Tests/WalletConnectSignTests/ApproveEngineTests.swift @@ -64,7 +64,7 @@ final class ApproveEngineTests: XCTestCase { XCTAssertTrue(networkingInteractor.didCallSubscribe) XCTAssert(cryptoMock.hasAgreementSecret(for: topicB), "Responder must store agreement key for topic B") XCTAssertEqual(networkingInteractor.didRespondOnTopic!, topicA, "Responder must respond on topic A") - XCTAssertEqual(extendedPairing.expiryDate.timeIntervalSince1970, Date(timeIntervalSinceNow: 2_592_000).timeIntervalSince1970, accuracy: 1, "pairing expiry has been extended by 30 days") + XCTAssertEqual(extendedPairing.expiryDate.timeIntervalSince1970, Date(timeIntervalSinceNow: 2_592_000).timeIntervalSince1970, accuracy: 1, "pairing expiry has been extended by 30 days") } func testReceiveProposal() {