From 2825f2fbf59b42d482037f4d30f9c7bfbb5449a8 Mon Sep 17 00:00:00 2001 From: Renfeng Shi Date: Wed, 6 Dec 2023 11:02:21 +0800 Subject: [PATCH 1/2] fix: public props --- .../Model/KeystoneSign/KeystoneCommon.swift | 4 ++-- Tests/KeystoneSDKTests/Chain/KeystoneBchSDKTests.swift | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Sources/KeystoneSDK/Model/KeystoneSign/KeystoneCommon.swift b/Sources/KeystoneSDK/Model/KeystoneSign/KeystoneCommon.swift index 23714ab..4cedb79 100644 --- a/Sources/KeystoneSDK/Model/KeystoneSign/KeystoneCommon.swift +++ b/Sources/KeystoneSDK/Model/KeystoneSign/KeystoneCommon.swift @@ -41,8 +41,8 @@ public struct Output: Codable { } public struct TransactionSignResult: Codable { - let requestId: String - let rawData: String + public var requestId: String + public var rawData: String public init(requestId: String, rawData: String) { self.requestId = requestId diff --git a/Tests/KeystoneSDKTests/Chain/KeystoneBchSDKTests.swift b/Tests/KeystoneSDKTests/Chain/KeystoneBchSDKTests.swift index 48b0019..5f41e39 100644 --- a/Tests/KeystoneSDKTests/Chain/KeystoneBchSDKTests.swift +++ b/Tests/KeystoneSDKTests/Chain/KeystoneBchSDKTests.swift @@ -48,4 +48,14 @@ final class KeystoneBchSDKTests: XCTestCase { let qrCode = bchSignRequestEncoder.nextPart() XCTAssertEqual(qrCode, "ur:keystone-sign-request/oyadhkadinctluayaeaeaeaeaeaeaxhlmnsngeaogycesktthtbnjttdhfttgedkdyaawnkbztwsykuetnlrlnqzdtsgemronekbfrwdsfvsvspkflvsbyoekiqzyladhtaaryfxuycplfmtwenyrejoetjobacetodlspctckuodptnoykpvwuyfecsltdscecturwsihjnticlqzcnfrmsoxwznddlwpretnhgltdiswfdvttnmerdjohnwdfzqzpydngejontjsskpdbgsweosfsbdlfhctuyfhjycyjyrlytvtpmghketnpefnvabkchlegajnqzgmsghspsqdfzahgdjossiydmaygdstcemdlrehlkcfemnbpdbwsaecreecfdbwdafnvdqzmkfrknkizebkdrdpfymkprcxfegucycnfnynbgdnlfmevyleeeeswnbadkaovdmeahmyndueidaoftzobwcegumtcljeldlytnhtintdaepdendypfimaxihimnbtnkklywmfpjzsasetypdpdlbenurdwtdkkcyoniswpemwmbywkiamnbbwmpehfwnlfoxsrihnsglbgeewsmymoisnycmctjtimutntwnpsrlbgeosetbttjymkssqdisssmulkimcapeweoxiostbwsrmsndeevyaofegawnzozceoetsggogetsrkfzzmdscnzeflmtadaeaewkmdkbuo") } + + func testParseSignResult() { + let resultHex = "a1015901b11f8b08000000000000004d923d8e14300c85b5628b0121214db9150505cd48fe8b635351a0a9b942123b0d122376b7e12c9c8c1b50517002cca241b88822c7fe64bf97c3cdf1d5a7fcfaf078f99cafbfdcaf4be4dd8fdbc3f3e3e14c7cf6f3077af7fdf6c59bb55c74269d2c659d84669e06139e9a8ec6c3d66ea8c7f7b2713919e0748bec113ef7f018c8a2446d933832c2de9b87efb0ee0a163b8ad17af77df7f319105c030195b70e9bb46016cf8c53862e6c0da9b1b7e4241113a69014666b3e07e2c831d6ac6b2bc65f5447ad53960866065ab22f81ec93338d3036e54a27eca0dcc176eca70042a00eff05f6e128c9c164620bb7f49a0d427dda469ecdc97b20470930b7f55caa38ae735cfbfb54d6ec69211a634ccf05630cf134fcb31fc2ea5533ad03496710012290dda2d74b099292c05a45e62bb74cf766a3483a143266ae51f6706d365a69b3cb26c9f9c468e808d6c0a66bf26ab01741ccca4ccba0020e3441dccaa1adaa2672b9db5bb9d4a9142d49b8a94994538930178eb261468fe6595340dfb4d173bb5a3524962e59a84466d7da5554af6abcfdf6eb865efefb7f1fef2fbf01cb596bb490020000" + let sdk = KeystoneSDK() + let ur = try! UR(type: "keystone-sign-result", cborData: resultHex.hexadecimal) + let signResult = try! sdk.bch.parseSignResult(ur: ur) + + XCTAssertEqual(signResult.requestId, "cc946be2-8e4c-42be-a321-56a53a8cf516") + XCTAssertEqual(signResult.rawData, "0200000000010163f6a8b2c0bde7883e4a6c155125395e3e2448432d4e433859ba11aeaacb9ba50100000017160014c441eed18e39c40e7b3ee821df2ece9217063708fdffffff02102700000000000017a914e3d32848c1f470bd0d69b8f13b59297d13d8debf87ec661a010000000017a9147b636e7e8d46daab9ec0aaa49e816c1510c77b6b870247304402204f5d70c78b2e4e036c7789cef4b9958adaa6a60edbecaa323821a52d4f56a4eb02204519108508b96e3c50fc20db850b8ed2789a18411f63d658b9b13f5175da57250121035684d200e10bc1a3e2bd7d59e58a07f2f19ef968725e18f1ed65e13396ab946600000000") + } } From 6e131fe62fa70f1f517ab0b014e9facb1b600856 Mon Sep 17 00:00:00 2001 From: Renfeng Shi Date: Wed, 6 Dec 2023 11:05:12 +0800 Subject: [PATCH 2/2] fix: update version --- KeystoneSDK.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KeystoneSDK.podspec b/KeystoneSDK.podspec index 1f39281..6f19fee 100644 --- a/KeystoneSDK.podspec +++ b/KeystoneSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "KeystoneSDK" - spec.version = "0.6.4" + spec.version = "0.6.5" spec.summary = "A library to simplify the way how software wallets communicate with the Keystone hardware wallet via UR." spec.homepage = "https://github.com/KeystoneHQ/keystone-sdk-ios" spec.license = { :type => 'Copyright', :text => 'Copyright 2023 Keystone' }