From 6f12109adac9bf04e447320b3820170a1067b42d Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Tue, 26 Jul 2022 11:36:12 +0200 Subject: [PATCH 01/10] Add auth target --- Package.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Package.swift b/Package.swift index 537aeed2a..d39b1d0ce 100644 --- a/Package.swift +++ b/Package.swift @@ -27,6 +27,10 @@ let package = Package( name: "Chat", dependencies: ["WalletConnectRelay", "WalletConnectUtils", "WalletConnectKMS"], path: "Sources/Chat"), + .target( + name: "Auth", + dependencies: ["WalletConnectRelay", "WalletConnectUtils", "WalletConnectKMS"], + path: "Sources/Auth"), .target( name: "WalletConnectRelay", dependencies: ["WalletConnectUtils", "WalletConnectKMS"], @@ -50,6 +54,9 @@ let package = Package( .testTarget( name: "ChatTests", dependencies: ["Chat", "WalletConnectUtils", "TestingUtils"]), + .testTarget( + name: "AuthTests", + dependencies: ["Auth", "WalletConnectUtils", "TestingUtils"]), .testTarget( name: "RelayerTests", dependencies: ["WalletConnectRelay", "WalletConnectUtils", "TestingUtils"]), From 267072864bce9b98b092ff3294e150f719025d77 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Tue, 26 Jul 2022 11:44:38 +0200 Subject: [PATCH 02/10] Add AuthTests scheme --- .../xcshareddata/xcschemes/AuthTests.xcscheme | 52 +++++++++++++++++++ Sources/Auth/File.swift | 6 +++ Tests/AuthTests/File.swift | 7 +++ 3 files changed, 65 insertions(+) create mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/AuthTests.xcscheme create mode 100644 Sources/Auth/File.swift create mode 100644 Tests/AuthTests/File.swift diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/AuthTests.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/AuthTests.xcscheme new file mode 100644 index 000000000..b6a508a85 --- /dev/null +++ b/.swiftpm/xcode/xcshareddata/xcschemes/AuthTests.xcscheme @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/Auth/File.swift b/Sources/Auth/File.swift new file mode 100644 index 000000000..3e684ae92 --- /dev/null +++ b/Sources/Auth/File.swift @@ -0,0 +1,6 @@ + +import Foundation + +class AuthClient { + +} diff --git a/Tests/AuthTests/File.swift b/Tests/AuthTests/File.swift new file mode 100644 index 000000000..6c6f031a6 --- /dev/null +++ b/Tests/AuthTests/File.swift @@ -0,0 +1,7 @@ + +import Foundation +import XCTest + +class AuthClientTest: XCTestCase { + +} From 9e34bdc9233a203eea6ff249bf6b972666d37692 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Tue, 26 Jul 2022 12:02:20 +0200 Subject: [PATCH 03/10] add core auth services --- .../IntegrationTests/Relay/RelayClientEndToEndTests.swift | 2 +- .../PresentationLayer/Import/ImportInteractor.swift | 1 - Sources/Auth/{File.swift => AuthClient.swift} | 3 +-- Sources/Auth/Services/App/AuthRequestService.swift | 7 +++++++ Sources/Auth/Services/App/CreatePairingService.swift | 5 +++++ Sources/Auth/Services/Wallet/AuthService.swift | 5 +++++ Sources/Auth/Services/Wallet/PairService.swift | 5 +++++ Sources/WalletConnectSign/Types/Session/WCSession.swift | 2 +- Tests/AuthTests/{File.swift => AuthClientTest.swift} | 3 +-- Tests/RelayerTests/DispatcherTests.swift | 1 - 10 files changed, 26 insertions(+), 8 deletions(-) rename Sources/Auth/{File.swift => AuthClient.swift} (89%) create mode 100644 Sources/Auth/Services/App/AuthRequestService.swift create mode 100644 Sources/Auth/Services/App/CreatePairingService.swift create mode 100644 Sources/Auth/Services/Wallet/AuthService.swift create mode 100644 Sources/Auth/Services/Wallet/PairService.swift rename Tests/AuthTests/{File.swift => AuthClientTest.swift} (93%) diff --git a/Example/IntegrationTests/Relay/RelayClientEndToEndTests.swift b/Example/IntegrationTests/Relay/RelayClientEndToEndTests.swift index 12baaea83..44f329ac4 100644 --- a/Example/IntegrationTests/Relay/RelayClientEndToEndTests.swift +++ b/Example/IntegrationTests/Relay/RelayClientEndToEndTests.swift @@ -22,7 +22,7 @@ final class RelayClientEndToEndTests: XCTestCase { ) let urlFactory = RelayUrlFactory(socketAuthenticator: socketAuthenticator) let socket = WebSocket(url: urlFactory.create(host: relayHost, projectId: projectId)) - + let logger = ConsoleLogger() let dispatcher = Dispatcher(socket: socket, socketConnectionHandler: ManualSocketConnectionHandler(socket: socket), logger: logger) return RelayClient(dispatcher: dispatcher, logger: logger, keyValueStorage: RuntimeKeyValueStorage()) diff --git a/Example/Showcase/Classes/PresentationLayer/Import/ImportInteractor.swift b/Example/Showcase/Classes/PresentationLayer/Import/ImportInteractor.swift index a6bcca7e8..81d70a023 100644 --- a/Example/Showcase/Classes/PresentationLayer/Import/ImportInteractor.swift +++ b/Example/Showcase/Classes/PresentationLayer/Import/ImportInteractor.swift @@ -1,4 +1,3 @@ - final class ImportInteractor { private let registerService: RegisterService private let accountStorage: AccountStorage diff --git a/Sources/Auth/File.swift b/Sources/Auth/AuthClient.swift similarity index 89% rename from Sources/Auth/File.swift rename to Sources/Auth/AuthClient.swift index 3e684ae92..10888619f 100644 --- a/Sources/Auth/File.swift +++ b/Sources/Auth/AuthClient.swift @@ -1,6 +1,5 @@ - import Foundation class AuthClient { - + } diff --git a/Sources/Auth/Services/App/AuthRequestService.swift b/Sources/Auth/Services/App/AuthRequestService.swift new file mode 100644 index 000000000..348997b3f --- /dev/null +++ b/Sources/Auth/Services/App/AuthRequestService.swift @@ -0,0 +1,7 @@ +// + +import Foundation + +actor AuthRequestService { + +} diff --git a/Sources/Auth/Services/App/CreatePairingService.swift b/Sources/Auth/Services/App/CreatePairingService.swift new file mode 100644 index 000000000..05f195fba --- /dev/null +++ b/Sources/Auth/Services/App/CreatePairingService.swift @@ -0,0 +1,5 @@ +import Foundation + +actor CreatePairingService { + +} diff --git a/Sources/Auth/Services/Wallet/AuthService.swift b/Sources/Auth/Services/Wallet/AuthService.swift new file mode 100644 index 000000000..8fa7707d0 --- /dev/null +++ b/Sources/Auth/Services/Wallet/AuthService.swift @@ -0,0 +1,5 @@ +import Foundation + +actor AuthService { + +} diff --git a/Sources/Auth/Services/Wallet/PairService.swift b/Sources/Auth/Services/Wallet/PairService.swift new file mode 100644 index 000000000..79aca7f24 --- /dev/null +++ b/Sources/Auth/Services/Wallet/PairService.swift @@ -0,0 +1,5 @@ +import Foundation + +actor PairService { + +} diff --git a/Sources/WalletConnectSign/Types/Session/WCSession.swift b/Sources/WalletConnectSign/Types/Session/WCSession.swift index 4c4109bc6..cb0771d43 100644 --- a/Sources/WalletConnectSign/Types/Session/WCSession.swift +++ b/Sources/WalletConnectSign/Types/Session/WCSession.swift @@ -57,7 +57,7 @@ struct WCSession: SequenceObject, Equatable { peerParticipant: Participant, namespaces: [String: SessionNamespace], requiredNamespaces: [String: ProposalNamespace], - events: Set, + events: Set, accounts: Set, acknowledged: Bool, expiry: Int64 diff --git a/Tests/AuthTests/File.swift b/Tests/AuthTests/AuthClientTest.swift similarity index 93% rename from Tests/AuthTests/File.swift rename to Tests/AuthTests/AuthClientTest.swift index 6c6f031a6..69cfe3f72 100644 --- a/Tests/AuthTests/File.swift +++ b/Tests/AuthTests/AuthClientTest.swift @@ -1,7 +1,6 @@ - import Foundation import XCTest class AuthClientTest: XCTestCase { - + } diff --git a/Tests/RelayerTests/DispatcherTests.swift b/Tests/RelayerTests/DispatcherTests.swift index b8d6e1040..78103a30c 100644 --- a/Tests/RelayerTests/DispatcherTests.swift +++ b/Tests/RelayerTests/DispatcherTests.swift @@ -7,7 +7,6 @@ import Combine class WebSocketMock: WebSocketConnecting { var request: URLRequest = URLRequest(url: URL(string: "wss://relay.walletconnect.com")!) - var onText: ((String) -> Void)? var onConnect: (() -> Void)? var onDisconnect: ((Error?) -> Void)? From 1e904456d8a8ab7abd5cf635ca2c64707ad8257f Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Tue, 26 Jul 2022 12:16:21 +0200 Subject: [PATCH 04/10] savepoint --- Sources/Auth/Services/App/CreatePairingService.swift | 3 +++ Sources/Auth/Services/Wallet/AuthService.swift | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Sources/Auth/Services/App/CreatePairingService.swift b/Sources/Auth/Services/App/CreatePairingService.swift index 05f195fba..2b3f3aaeb 100644 --- a/Sources/Auth/Services/App/CreatePairingService.swift +++ b/Sources/Auth/Services/App/CreatePairingService.swift @@ -2,4 +2,7 @@ import Foundation actor CreatePairingService { + func create() async throws -> WalletConnectURI { + fatalError("not implemented") + } } diff --git a/Sources/Auth/Services/Wallet/AuthService.swift b/Sources/Auth/Services/Wallet/AuthService.swift index 8fa7707d0..135c761eb 100644 --- a/Sources/Auth/Services/Wallet/AuthService.swift +++ b/Sources/Auth/Services/Wallet/AuthService.swift @@ -2,4 +2,7 @@ import Foundation actor AuthService { + func pair(_ uri: WalletConnectURI) async throws { + fatalError("not implemented") + } } From a8e25a479161284a8b0456e9e1928b0cc7ab95b3 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Tue, 26 Jul 2022 13:02:45 +0200 Subject: [PATCH 05/10] Move WalletConnectURI to utlis package --- .../Services/App/AuthRequestService.swift | 2 - Sources/Auth/Types/RelayProtocolOptions.swift | 6 +++ Sources/Auth/Types/WalletConnectURI.swift | 6 +++ .../Types/Common/RelayProtocolOptions.swift | 6 --- .../Types/RelayProtocolOptions.swift | 6 +++ .../Types/WalletConnectURI.swift | 52 ++----------------- .../RelayProtocolOptions.swift | 11 ++++ .../WalletConnectUtils/WalletConnectURI.swift | 50 ++++++++++++++++++ 8 files changed, 83 insertions(+), 56 deletions(-) create mode 100644 Sources/Auth/Types/RelayProtocolOptions.swift create mode 100644 Sources/Auth/Types/WalletConnectURI.swift delete mode 100644 Sources/WalletConnectSign/Types/Common/RelayProtocolOptions.swift create mode 100644 Sources/WalletConnectSign/Types/RelayProtocolOptions.swift create mode 100644 Sources/WalletConnectUtils/RelayProtocolOptions.swift create mode 100644 Sources/WalletConnectUtils/WalletConnectURI.swift diff --git a/Sources/Auth/Services/App/AuthRequestService.swift b/Sources/Auth/Services/App/AuthRequestService.swift index 348997b3f..6d9c54822 100644 --- a/Sources/Auth/Services/App/AuthRequestService.swift +++ b/Sources/Auth/Services/App/AuthRequestService.swift @@ -1,5 +1,3 @@ -// - import Foundation actor AuthRequestService { diff --git a/Sources/Auth/Types/RelayProtocolOptions.swift b/Sources/Auth/Types/RelayProtocolOptions.swift new file mode 100644 index 000000000..087d73ce7 --- /dev/null +++ b/Sources/Auth/Types/RelayProtocolOptions.swift @@ -0,0 +1,6 @@ +// + +import Foundation +import WalletConnectUtils + +typealias RelayProtocolOptions = WalletConnectUtils.RelayProtocolOptions diff --git a/Sources/Auth/Types/WalletConnectURI.swift b/Sources/Auth/Types/WalletConnectURI.swift new file mode 100644 index 000000000..d5cdf5f31 --- /dev/null +++ b/Sources/Auth/Types/WalletConnectURI.swift @@ -0,0 +1,6 @@ +// + +import Foundation +import WalletConnectUtils + +typealias WalletConnectURI = WalletConnectUtils.WalletConnectURI diff --git a/Sources/WalletConnectSign/Types/Common/RelayProtocolOptions.swift b/Sources/WalletConnectSign/Types/Common/RelayProtocolOptions.swift deleted file mode 100644 index 2d0009aa9..000000000 --- a/Sources/WalletConnectSign/Types/Common/RelayProtocolOptions.swift +++ /dev/null @@ -1,6 +0,0 @@ -import Foundation - -struct RelayProtocolOptions: Codable, Equatable { - let `protocol`: String - let data: String? -} diff --git a/Sources/WalletConnectSign/Types/RelayProtocolOptions.swift b/Sources/WalletConnectSign/Types/RelayProtocolOptions.swift new file mode 100644 index 000000000..24094e9c2 --- /dev/null +++ b/Sources/WalletConnectSign/Types/RelayProtocolOptions.swift @@ -0,0 +1,6 @@ +// + +import Foundation +import WalletConnectUtils + +typealias RelayProtocolOptions = WalletConnectUtils.RelayProtocolOptions diff --git a/Sources/WalletConnectSign/Types/WalletConnectURI.swift b/Sources/WalletConnectSign/Types/WalletConnectURI.swift index 0d43287a6..87b17dfeb 100644 --- a/Sources/WalletConnectSign/Types/WalletConnectURI.swift +++ b/Sources/WalletConnectSign/Types/WalletConnectURI.swift @@ -1,50 +1,6 @@ -import Foundation - -public struct WalletConnectURI: Equatable { - - let topic: String - let version: String - let symKey: String - let relay: RelayProtocolOptions - - init(topic: String, symKey: String, relay: RelayProtocolOptions) { - self.version = "2" - self.topic = topic - self.symKey = symKey - self.relay = relay - } +// - public init?(string: String) { - guard string.hasPrefix("wc:") else { - return nil - } - let urlString = !string.hasPrefix("wc://") ? string.replacingOccurrences(of: "wc:", with: "wc://") : string - guard let components = URLComponents(string: urlString) else { - return nil - } - let query: [String: String]? = components.queryItems?.reduce(into: [:]) { $0[$1.name] = $1.value } - - guard let topic = components.user, - let version = components.host, - let symKey = query?["symKey"], - let relayProtocol = query?["relay-protocol"] - else { return nil } - let relayData = query?["relay-data"] - self.version = version - self.topic = topic - self.symKey = symKey - self.relay = RelayProtocolOptions(protocol: relayProtocol, data: relayData) - } - - public var absoluteString: String { - return "wc:\(topic)@\(version)?symKey=\(symKey)&\(relayQuery)" - } +import Foundation +import WalletConnectUtils - private var relayQuery: String { - var query = "relay-protocol=\(relay.protocol)" - if let relayData = relay.data { - query = "\(query)&relay-data=\(relayData)" - } - return query - } -} +typealias WalletConnectURI = WalletConnectUtils.WalletConnectURI diff --git a/Sources/WalletConnectUtils/RelayProtocolOptions.swift b/Sources/WalletConnectUtils/RelayProtocolOptions.swift new file mode 100644 index 000000000..e437e9342 --- /dev/null +++ b/Sources/WalletConnectUtils/RelayProtocolOptions.swift @@ -0,0 +1,11 @@ +import Foundation + +public struct RelayProtocolOptions: Codable, Equatable { + public let `protocol`: String + public let data: String? + + public init(protocol: String, data: String?) { + self.protocol = `protocol` + self.data = data + } +} diff --git a/Sources/WalletConnectUtils/WalletConnectURI.swift b/Sources/WalletConnectUtils/WalletConnectURI.swift new file mode 100644 index 000000000..d149f7f70 --- /dev/null +++ b/Sources/WalletConnectUtils/WalletConnectURI.swift @@ -0,0 +1,50 @@ +import Foundation + +public struct WalletConnectURI: Equatable { + + public let topic: String + public let version: String + public let symKey: String + public let relay: RelayProtocolOptions + + public init(topic: String, symKey: String, relay: RelayProtocolOptions) { + self.version = "2" + self.topic = topic + self.symKey = symKey + self.relay = relay + } + + public init?(string: String) { + guard string.hasPrefix("wc:") else { + return nil + } + let urlString = !string.hasPrefix("wc://") ? string.replacingOccurrences(of: "wc:", with: "wc://") : string + guard let components = URLComponents(string: urlString) else { + return nil + } + let query: [String: String]? = components.queryItems?.reduce(into: [:]) { $0[$1.name] = $1.value } + + guard let topic = components.user, + let version = components.host, + let symKey = query?["symKey"], + let relayProtocol = query?["relay-protocol"] + else { return nil } + let relayData = query?["relay-data"] + self.version = version + self.topic = topic + self.symKey = symKey + self.relay = RelayProtocolOptions(protocol: relayProtocol, data: relayData) + } + + public var absoluteString: String { + return "wc:\(topic)@\(version)?symKey=\(symKey)&\(relayQuery)" + } + + private var relayQuery: String { + var query = "relay-protocol=\(relay.protocol)" + if let relayData = relay.data { + query = "\(query)&relay-data=\(relayData)" + } + return query + } +} From 1f48b607e6dbe95ed9dfc21b36b99dfbc495f950 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Tue, 26 Jul 2022 13:13:44 +0200 Subject: [PATCH 06/10] Update basic auth methods --- Sources/Auth/Services/App/AuthRequestService.swift | 2 ++ Sources/Auth/Services/Wallet/AuthService.swift | 4 ++-- Sources/Auth/Services/Wallet/PairService.swift | 3 +++ Sources/Auth/Types/RequestParams.swift | 7 +++++++ Sources/Auth/Types/RespondParams.swift | 7 +++++++ 5 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 Sources/Auth/Types/RequestParams.swift create mode 100644 Sources/Auth/Types/RespondParams.swift diff --git a/Sources/Auth/Services/App/AuthRequestService.swift b/Sources/Auth/Services/App/AuthRequestService.swift index 6d9c54822..af1240aa1 100644 --- a/Sources/Auth/Services/App/AuthRequestService.swift +++ b/Sources/Auth/Services/App/AuthRequestService.swift @@ -2,4 +2,6 @@ import Foundation actor AuthRequestService { + func request(params: RequestParams, topic: String) async throws { + } } diff --git a/Sources/Auth/Services/Wallet/AuthService.swift b/Sources/Auth/Services/Wallet/AuthService.swift index 135c761eb..4e73117f0 100644 --- a/Sources/Auth/Services/Wallet/AuthService.swift +++ b/Sources/Auth/Services/Wallet/AuthService.swift @@ -2,7 +2,7 @@ import Foundation actor AuthService { - func pair(_ uri: WalletConnectURI) async throws { - fatalError("not implemented") + func respond(respondParams: RespondParams) async throws { + } } diff --git a/Sources/Auth/Services/Wallet/PairService.swift b/Sources/Auth/Services/Wallet/PairService.swift index 79aca7f24..7aa241a02 100644 --- a/Sources/Auth/Services/Wallet/PairService.swift +++ b/Sources/Auth/Services/Wallet/PairService.swift @@ -2,4 +2,7 @@ import Foundation actor PairService { + func pair(_ uri: WalletConnectURI) async throws { + fatalError("not implemented") + } } diff --git a/Sources/Auth/Types/RequestParams.swift b/Sources/Auth/Types/RequestParams.swift new file mode 100644 index 000000000..3489b2f83 --- /dev/null +++ b/Sources/Auth/Types/RequestParams.swift @@ -0,0 +1,7 @@ +// + +import Foundation + +struct RequestParams { + +} diff --git a/Sources/Auth/Types/RespondParams.swift b/Sources/Auth/Types/RespondParams.swift new file mode 100644 index 000000000..6ff4318ad --- /dev/null +++ b/Sources/Auth/Types/RespondParams.swift @@ -0,0 +1,7 @@ +// + +import Foundation + +struct RespondParams { + +} From 0ac81dc0c3397e2659bf131dc3941e4af8fdef65 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Thu, 28 Jul 2022 11:33:42 +0200 Subject: [PATCH 07/10] Add Request Params --- Sources/Auth/Services/App/AuthRequestService.swift | 1 + Sources/Auth/Types/RequestParams.swift | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Sources/Auth/Services/App/AuthRequestService.swift b/Sources/Auth/Services/App/AuthRequestService.swift index af1240aa1..4d6a332ef 100644 --- a/Sources/Auth/Services/App/AuthRequestService.swift +++ b/Sources/Auth/Services/App/AuthRequestService.swift @@ -3,5 +3,6 @@ import Foundation actor AuthRequestService { func request(params: RequestParams, topic: String) async throws { + } } diff --git a/Sources/Auth/Types/RequestParams.swift b/Sources/Auth/Types/RequestParams.swift index 3489b2f83..895bf4191 100644 --- a/Sources/Auth/Types/RequestParams.swift +++ b/Sources/Auth/Types/RequestParams.swift @@ -1,7 +1,14 @@ -// - import Foundation struct RequestParams { - + let domain: String + let chainId: String + let nonce: String + let aud: String + let nbf: String? + let exp: String? + let statement: String? + let requestId: String? + let resources: String? } + From 11107d8e6d4d803aa94d5bb05d4d94bb52ff5ac5 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Thu, 28 Jul 2022 11:39:05 +0200 Subject: [PATCH 08/10] Add AuthPayloadParams --- Sources/Auth/Types/AuthPayloadParams.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Sources/Auth/Types/AuthPayloadParams.swift diff --git a/Sources/Auth/Types/AuthPayloadParams.swift b/Sources/Auth/Types/AuthPayloadParams.swift new file mode 100644 index 000000000..aa26d360e --- /dev/null +++ b/Sources/Auth/Types/AuthPayloadParams.swift @@ -0,0 +1,16 @@ +import Foundation + +struct AuthPayloadParams { + let type: String + let chainId: String + let domain: String + let aud: String + let version: String + let nonce: String + let iat: String + let nbf: String? + let exp: String? + let statement: String? + let requestId: String? + let resources: String? +} From 24a023284205dbd3f86836a988b1e128dc4690d1 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Thu, 28 Jul 2022 11:44:40 +0200 Subject: [PATCH 09/10] Add Cacao --- .../Auth/Services/App/AuthRequestService.swift | 2 +- Sources/Auth/Types/Cacao/CacaoHeader.swift | 5 +++++ Sources/Auth/Types/Cacao/CacaoPayload.swift | 15 +++++++++++++++ Sources/Auth/Types/Cacao/CacaoSignature.swift | 7 +++++++ Sources/Auth/Types/RequestParams.swift | 1 - 5 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 Sources/Auth/Types/Cacao/CacaoHeader.swift create mode 100644 Sources/Auth/Types/Cacao/CacaoPayload.swift create mode 100644 Sources/Auth/Types/Cacao/CacaoSignature.swift diff --git a/Sources/Auth/Services/App/AuthRequestService.swift b/Sources/Auth/Services/App/AuthRequestService.swift index 4d6a332ef..2d6c3986a 100644 --- a/Sources/Auth/Services/App/AuthRequestService.swift +++ b/Sources/Auth/Services/App/AuthRequestService.swift @@ -3,6 +3,6 @@ import Foundation actor AuthRequestService { func request(params: RequestParams, topic: String) async throws { - + } } diff --git a/Sources/Auth/Types/Cacao/CacaoHeader.swift b/Sources/Auth/Types/Cacao/CacaoHeader.swift new file mode 100644 index 000000000..ae85fc651 --- /dev/null +++ b/Sources/Auth/Types/Cacao/CacaoHeader.swift @@ -0,0 +1,5 @@ +import Foundation + +struct CacaoHeader { + let t: String +} diff --git a/Sources/Auth/Types/Cacao/CacaoPayload.swift b/Sources/Auth/Types/Cacao/CacaoPayload.swift new file mode 100644 index 000000000..cb1d488b9 --- /dev/null +++ b/Sources/Auth/Types/Cacao/CacaoPayload.swift @@ -0,0 +1,15 @@ +import Foundation + +struct CacaoPayload { + let iss: String + let domain: String + let aud: String + let version: String + let nonce: String + let iat: String + let nbf: String + let exp: String + let statement: String + let requestId: String + let resources: String +} diff --git a/Sources/Auth/Types/Cacao/CacaoSignature.swift b/Sources/Auth/Types/Cacao/CacaoSignature.swift new file mode 100644 index 000000000..5c23277f0 --- /dev/null +++ b/Sources/Auth/Types/Cacao/CacaoSignature.swift @@ -0,0 +1,7 @@ +import Foundation + +struct CacaoSignature { + let t: String + let s: String + let m: String +} diff --git a/Sources/Auth/Types/RequestParams.swift b/Sources/Auth/Types/RequestParams.swift index 895bf4191..7a6082f52 100644 --- a/Sources/Auth/Types/RequestParams.swift +++ b/Sources/Auth/Types/RequestParams.swift @@ -11,4 +11,3 @@ struct RequestParams { let requestId: String? let resources: String? } - From 5795f02e74587a185ed07593510cf4989f2c5ee0 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Thu, 28 Jul 2022 11:48:02 +0200 Subject: [PATCH 10/10] Add respond params --- Sources/Auth/Types/RespondParams.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Sources/Auth/Types/RespondParams.swift b/Sources/Auth/Types/RespondParams.swift index 6ff4318ad..c316e92d5 100644 --- a/Sources/Auth/Types/RespondParams.swift +++ b/Sources/Auth/Types/RespondParams.swift @@ -1,7 +1,6 @@ -// - import Foundation struct RespondParams { - + let topic: String + let signature: CacaoSignature }