Skip to content

Commit

Permalink
chore: update dep and fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
soralit committed Nov 27, 2024
1 parent 721e73f commit c2a1063
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 215 deletions.
69 changes: 21 additions & 48 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,84 +1,57 @@
{
"pins" : [
{
"identity" : "bcswiftcrypto",
"kind" : "remoteSourceControl",
"location" : "https://github.com/KeystoneHQ/BCSwiftCrypto.git",
"state" : {
"revision" : "f3b7faadfbd681786e9db73d66d3fe1053628fe5",
"version" : "0.9.0"
}
},
{
"identity" : "bcswiftdcbor",
"kind" : "remoteSourceControl",
"location" : "https://github.com/KeystoneHQ/BCSwiftDCBOR.git",
"location" : "https://github.com/BlockchainCommons/BCSwiftDCBOR",
"state" : {
"revision" : "0330a29a502a43e0c5da1289f00bfa0c1488378c",
"version" : "0.11.1"
"revision" : "21efa67ada2f22a6c277e1961f1059bb376e9b1a",
"version" : "2.0.2"
}
},
{
"identity" : "bcswiftfloat16",
"kind" : "remoteSourceControl",
"location" : "https://github.com/KeystoneHQ/BCSwiftFloat16.git",
"state" : {
"revision" : "5781bf741d202b69ffaa98c5e84e1229bd99e694",
"version" : "0.3.0"
}
},
{
"identity" : "cryptoswift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
"state" : {
"revision" : "678d442c6f7828def400a70ae15968aef67ef52d",
"version" : "1.8.3"
}
},
{
"identity" : "secp256k1",
"kind" : "remoteSourceControl",
"location" : "https://github.com/portto/secp256k1.git",
"location" : "https://github.com/blockchaincommons/BCSwiftFloat16",
"state" : {
"revision" : "6864a2560066cedede330c4b344689432a7300f7",
"version" : "0.0.5"
"revision" : "a27f3935a7b1db715713eda67369b02feade2ded",
"version" : "2.0.0"
}
},
{
"identity" : "secp256k1.swift",
"identity" : "bcswifttags",
"kind" : "remoteSourceControl",
"location" : "https://github.com/KeystoneHQ/secp256k1.swift.git",
"location" : "https://github.com/BlockchainCommons/BCSwiftTags",
"state" : {
"revision" : "95bfcee9f194c7a0d52ec29f40bf884812559a7c",
"version" : "0.8.1"
"revision" : "ced8d92c7cc53375cdf9806c59251fe0161f02ec",
"version" : "0.2.3"
}
},
{
"identity" : "swift-collections",
"identity" : "swift-numberkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"location" : "https://github.com/objecthub/swift-numberkit.git",
"state" : {
"revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb",
"version" : "1.1.0"
"revision" : "33af3f9011e45dcd8ee696492d30dbcd5a8a67f3",
"version" : "2.6.0"
}
},
{
"identity" : "swift-collections-sorted-collections",
"identity" : "swiftsortedcollections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/soralit/swift-collections-sorted-collections",
"location" : "https://github.com/wolfmcnally/SwiftSortedCollections",
"state" : {
"revision" : "eebe309da4f42ab6a38a057c74b3d8e7b4233b38",
"version" : "1.2.2"
"revision" : "dd6c8e0eaef987e55a35c056d185144a7c71fc19",
"version" : "0.1.0"
}
},
{
"identity" : "urkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/KeystoneHQ/URKit.git",
"location" : "https://github.com/BlockchainCommons/URKit",
"state" : {
"revision" : "dfac3005730c2ac189e7db173705c9e400046dcd",
"version" : "11.5.1"
"revision" : "c7cf16b03ce061c2d461fb4c635cc27c9e1d00e3",
"version" : "15.0.0"
}
}
],
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// swift-tools-version: 5.6
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "KeystoneSDK",
platforms: [.iOS(.v13), .macOS(.v11)],
platforms: [.iOS(.v15), .macOS(.v13)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
Expand All @@ -15,7 +15,7 @@ let package = Package(
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/KeystoneHQ/URKit.git", from: "11.5.1")
.package(url: "https://github.com/BlockchainCommons/URKit", from: "15.0.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
2 changes: 1 addition & 1 deletion Sources/KeystoneSDK/Model/ZcashAccounts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation

public struct ZcashAccounts : Equatable, Codable {
public var seedFingerprint: String
public var keys: Array<ZcashUnifiedAccount>
public var accounts: Array<ZcashUnifiedAccount>
}

public struct ZcashUnifiedAccount: Equatable, Codable {
Expand Down
12 changes: 0 additions & 12 deletions Tests/KeystoneSDKTests/Chain/KeystoneAptosSDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,6 @@ final class KeystoneAptosSDKTests: XCTestCase {
XCTAssertEqual(signature.authenticationPublicKey, "8e53e7b10656816de70824e3016fc1a277e77825e12825dc4f239f418ab2e04e")
}

func testParseSignatureError() {
let signatureHex = "a201d825509b1de"
let sdk = KeystoneAptosSDK()
let ur = try! UR(type: "aptos-signature", cbor: CBOR(signatureHex.hexadecimal))

var thrownError: Swift.Error?
XCTAssertThrowsError(try sdk.parseSignature(ur: ur)) {
thrownError = $0
}
XCTAssertEqual(thrownError as? KeystoneError, .parseSignatureError("signature is invalid"))
}

func testGenerateSignRequest() {
let signRequest = AptosSignRequest(
requestId: "7AFD5E09-9267-43FB-A02E-08C4A09417EC",
Expand Down
12 changes: 0 additions & 12 deletions Tests/KeystoneSDKTests/Chain/KeystoneArweaveSDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,6 @@ final class KeystoneArweaveSDKTests: XCTestCase {
XCTAssertEqual(signature.signature, "80337c3a47f1b69a38544c69f379a4aa0ea8ef1f853b718d992c6a73c643e63ca6dff9186cd2f41a45c6405ef6b71353c3b6864c799699964e559afa7aa7f7c345c1966c998193539985e2724831025beadb0a1a269f54ec4a95c69a3bc4295a5c6c5f926dcc84fbf2251b56c841f764b162e062c8db5302090aa1d528d83cf48b53aa0709009f3975d63ea8ff26e80b4f2f01380e100860b304fccbbc0877278efbf72fb045331f76df132a5119bd51590f0502350d3cb31f14daba731893c5834e2e8bfa5bf517ac63693b81041cf7f8ed7293d034b3e54c4d02c66542d3b9648e9ecf912101a20b87f39d75d4f1a02c816f424c8a1fda05a9e7e8ccf064d31c0bf10c661872a7f40c0b1d75dbfae6a95ddcc81eead3f49cfa3803517cf9d79f2541041416c3e8ecfc0292d864f34fe613866e86b7b0bc7abc5b3f84e6ee3b06933c4f82552bb985f6b7fac0a580e94d7a0e8e295dd2e49ece66ead0ee6a46b84553302b94701a9d24b91c085154b7e67a7ac59e3a41ae96c8e1afd1aa778633457005555cff4198820c2aa8ea1ff0f86a9f4ae03d96b215449c63bff7cae9a114c9db05cc4e4d9993a13149393b6a6992b6042bb82d34ffdc7f1aeaf17fa5240ca6ebd9e62fd6c90bce91747af37bf8fc3c72859a1dfec2cf2c49295e1ccdc09b91d9074d204dea74a70002baa05fc86acfcff45fe7f0dd7e5e24c8f69575")
}

func testParseSignatureError() {
let signatureHex = "a201d825509b1de"
let sdk = KeystoneArweaveSDK()
let ur = try! UR(type: "arweave-signature", cbor: CBOR(signatureHex.hexadecimal))

var thrownError: Swift.Error?
XCTAssertThrowsError(try sdk.parseSignature(ur: ur)) {
thrownError = $0
}
XCTAssertEqual(thrownError as? KeystoneError, .parseSignatureError("signature is invalid"))
}

func testGenerateSignRequest() {
let signRequest = ArweaveSignRequest(
masterFingerprint: "F23F9FD2",
Expand Down
14 changes: 1 addition & 13 deletions Tests/KeystoneSDKTests/Chain/KeystoneBitcoinSDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,8 @@ final class KeystoneBitcoinSDKTests: XCTestCase {
XCTAssertEqual(psbt, "70736274FF01009A020000000258E87A21B56DAF0C23BE8E7070456C336F7CBAA5C8757924F545887BB2ABDD750000000000FFFFFFFF838D0427D0EC650A68AA46BB0B098AEA4422C071B2CA78352A077959D07CEA1D0100000000FFFFFFFF0270AAF00800000000160014D85C2B71D0060B09C9886AEB815E50991DDA124D00E1F5050000000016001400AEA9A2E5F0F876A588DF5546E8742D1D87008F000000000000000000".hexadecimal)
}

func testParsePsbtError() {
let psbtCborHex = "58A770736274FF01009A020000000258E87A21B56DAF0C23BE8E7070456C336F7CBAA5C8757924F545887BB2ABDD750000000000FFFFFFFF838D0427D0EC650A68AA46BB0B098AEA4422C071B2CA78352A077959D07CEA1D0100000000FFFFFFFF0270AAF00800000000160014D85C2B71D0060B09C9886AEB815E50991DDA124D00E1F5050000000016001400AEA9A2E5F0F876A588DF5546E8742D1D87008"
let bitcoinSdk = KeystoneBitcoinSDK()
let ur = try! UR(type: "crypto-psbt", cbor: CBOR(psbtCborHex.hexadecimal))

var thrownError: Swift.Error?
XCTAssertThrowsError(try bitcoinSdk.parsePSBT(ur: ur)) {
thrownError = $0
}
XCTAssertEqual(thrownError as? KeystoneError, .parsePSBTError("PSBT is invalid"))
}

func testParsePsbtTypeError() {
let psbtCborHex = "58A770736274FF01009A020000000258E87A21B56DAF0C23BE8E7070456C336F7CBAA5C8757924F545887BB2ABDD750000000000FFFFFFFF838D0427D0EC650A68AA46BB0B098AEA4422C071B2CA78352A077959D07CEA1D0100000000FFFFFFFF0270AAF00800000000160014D85C2B71D0060B09C9886AEB815E50991DDA124D00E1F5050000000016001400AEA9A2E5F0F876A588DF5546E8742D1D87008"
let psbtCborHex = "58A770736274FF01009A020000000258E87A21B56DAF0C23BE8E7070456C336F7CBAA5C8757924F545887BB2ABDD750000000000FFFFFFFF838D0427D0EC650A68AA46BB0B098AEA4422C071B2CA78352A077959D07CEA1D0100000000FFFFFFFF0270AAF00800000000160014D85C2B71D0060B09C9886AEB815E50991DDA124D00E1F5050000000016001400AEA9A2E5F0F876A588DF5546E8742D1D87008F000000000000000000"
let bitcoinSdk = KeystoneBitcoinSDK()
let ur = try! UR(type: "crypto-hdkey", cbor: CBOR(psbtCborHex.hexadecimal))

Expand Down
24 changes: 7 additions & 17 deletions Tests/KeystoneSDKTests/Chain/KeystoneCardanoSDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@ final class KeystoneCardanoSDKTests: XCTestCase {
XCTAssertEqual(signature.witnessSet, "a100828258207233f4cd5f24fa554e1ea4ed9251e39f4e18b2e0efd909b27ca01333c22ac49a5840725d8d98bab67eec8bf2704153f725f35ff7b0c9fabee135d97cf6c6b0885b14aa8748d9ba236abd19560b43afb0c5ac6d03359a1ef71b0712fc300d73e23e07825820c4af2472a9b27acad95967b1f5ff224cf3065824f6f1f0df7dbf4b52b819b1e85840c1ba75df625c7f657633f85f07d0bfd67f4e8ffb6b81b4b65a0ab186b459c4434971c25191b2725bff3f29bb9c1d247aabd60e63f0ea6ba53db0624ae1bcc101")
}

func testParseSignatureError() {
let signatureHex = "a201d825509b1de"
let sdk = KeystoneCardanoSDK()
let ur = try! UR(type: "cardano-signature", cbor: CBOR(signatureHex.hexadecimal))

var thrownError: Swift.Error?
XCTAssertThrowsError(try sdk.parseSignature(ur: ur)) {
thrownError = $0
}
XCTAssertEqual(thrownError as? KeystoneError, .parseSignatureError("signature is invalid"))
}

func testGenerateSignRequest() {
let signRequest = CardanoSignRequest(
requestId: "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
Expand All @@ -43,15 +31,15 @@ final class KeystoneCardanoSDKTests: XCTestCase {
CardanoSignRequest.Utxo(
transactionHash: "4e3a6e7fdcb0d0efa17bf79c13aed2b4cb9baf37fb1aa2e39553d5bd720c5c99",
index: 3,
amount: 10000000,
amount: "10000000",
xfp: "73c5da0a",
hdPath: "m/1852'/1815'/0'/0/0",
address: "addr1qy8ac7qqy0vtulyl7wntmsxc6wex80gvcyjy33qffrhm7sh927ysx5sftuw0dlft05dz3c7revpf7jx0xnlcjz3g69mq4afdhv"
),
CardanoSignRequest.Utxo(
transactionHash: "4e3a6e7fdcb0d0efa17bf79c13aed2b4cb9baf37fb1aa2e39553d5bd720c5c99",
index: 4,
amount: 18020000,
amount: "18020000",
xfp: "73c5da0a",
hdPath: "m/1852'/1815'/0'/0/1",
address: "addr1qyz85693g4fr8c55mfyxhae8j2u04pydxrgqr73vmwpx3azv4dgkyrgylj5yl2m0jlpdpeswyyzjs0vhwvnl6xg9f7ssrxkz90"
Expand All @@ -69,8 +57,10 @@ final class KeystoneCardanoSDKTests: XCTestCase {
let signRequestEncoder = try! sdk.generateSignRequest(cardanoSignRequest: signRequest)

let qrCode = signRequestEncoder.nextPart()

print(qrCode)

XCTAssertEqual(qrCode, "ur:cardano-sign-request/1-2/lpadaocfaojkcydstoptbghkadftonadtpdagdndcawmgtfrkigrpmndutdnbtkgfssbjnaohdoylroxaelflfhdcxglftjtlbuopftiwsoykgylnsbwpltdqzsbndpeemzocyoevlmdgutlryjpbnhhnlaxlfhdcxglftjtlbuopftiwsoykgylnsbwpltdqzsbndpeemzocyoevlmdgutlryjpbnhhnlaaadlfoeaehdcahskkurgskpylhsjnkicttensrfcyjtolqzbkbtkgldzeoldlrtmhndjzemadcfsrgdoeaehdcahssopfsokoctttuoaaaapytlhyztldgddsidlugdecpsidfnhsgwrdtiehadcfsrgdaocfmnsbaxaenbykynaxlftaaynlonadhdcxglftjtlbuopftiwsoykgylnsbwpltdqzsbndpeemzocyoevlmdgutlryjpbnhhnlaoaxaxcyaemkmtlaaataaddyoeadlecfatfnykcfatchykaeykaewkaewkaocyjksktnbkahksiohsieiejpehjskkethsiaemjsjskkdykojykpjzkkjzemktjtjyjnjkksiaenktihksetdyiokoiakkimkkeoeojsiyiyjpisjnemhysedtsp")
XCTAssertEqual(qrCode, "ur:cardano-sign-request/1-2/lpadaocfaokgcynncemytahkadfmonadtpdagdndcawmgtfrkigrpmndutdnbtkgfssbjnaohdoylroxaelflfhdcxglftjtlbuopftiwsoykgylnsbwpltdqzsbndpeemzocyoevlmdgutlryjpbnhhnlaxlfhdcxglftjtlbuopftiwsoykgylnsbwpltdqzsbndpeemzocyoevlmdgutlryjpbnhhnlaaadlfoeaehdcahskkurgskpylhsjnkicttensrfcyjtolqzbkbtkgldzeoldlrtmhndjzemadcfsrgdoeaehdcahssopfsokoctttuoaaaapytlhyztldgddsidlugdecpsidfnhsgwrdtiehadcfsrgdaocfmnsbaxaenbykynaxlftaaynlonadhdcxglftjtlbuopftiwsoykgylnsbwpltdqzsbndpeemzocyoevlmdgutlryjpbnhhnlaoaxaxisehdydydydydydydyaataaddyoeadlecfatfnykcfatchykaeykaewkaewkaocyjksktnbkahksiohsieiejpehjskkethsiaemjsjskkdykojykpjzkkjzemktjtjyjnjkksiaenktihksetdyiokoiakkimkkeoeojsiyiyjpisjnemgwgumoey")
}

func testGenerateSignRequestError() {
Expand All @@ -81,15 +71,15 @@ final class KeystoneCardanoSDKTests: XCTestCase {
CardanoSignRequest.Utxo(
transactionHash: "4e3a6e7fdcb0d0efa17bf79c13aed2b4cb9baf37fb1aa2e39553d5bd720c5c99",
index: 3,
amount: 10000000,
amount: "10000000",
xfp: "73c5da",
hdPath: "m/1852'/1815'/0'/0/0",
address: "addr1qy8ac7qqy0vtulyl7wntmsxc6wex80gvcyjy33qffrhm7sh927ysx5sftuw0dlft05dz3c7revpf7jx0xnlcjz3g69mq4afdhv"
),
CardanoSignRequest.Utxo(
transactionHash: "4e3a6e7fdcb0d0efa17bf79c13aed2b4cb9baf37fb1aa2e39553d5bd720c5c99",
index: 4,
amount: 18020000,
amount: "18020000",
xfp: "73c5da0a",
hdPath: "m/1852'/1815'/0'/0/1",
address: "addr1qyz85693g4fr8c55mfyxhae8j2u04pydxrgqr73vmwpx3azv4dgkyrgylj5yl2m0jlpdpeswyyzjs0vhwvnl6xg9f7ssrxkz90"
Expand Down
12 changes: 0 additions & 12 deletions Tests/KeystoneSDKTests/Chain/KeystoneCosmosSDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ final class KeystoneCosmosSDKTests: XCTestCase {
XCTAssertEqual(signature.publicKey, "03f3ded94f2969d76200c6ed5db836041cc815fa62aa791e047905186c07e00275")
}

func testParseSignatureError() {
let signatureHex = "a201d825509b1de"
let sdk = KeystoneCosmosSDK()
let ur = try! UR(type: "cosmos-signature", cbor: CBOR(signatureHex.hexadecimal))

var thrownError: Swift.Error?
XCTAssertThrowsError(try sdk.parseSignature(ur: ur)) {
thrownError = $0
}
XCTAssertEqual(thrownError as? KeystoneError, .parseSignatureError("signature is invalid"))
}

func testGenerateSignRequest() {
let signRequest = CosmosSignRequest(
requestId: "7AFD5E09-9267-43FB-A02E-08C4A09417EC",
Expand Down
13 changes: 0 additions & 13 deletions Tests/KeystoneSDKTests/Chain/KeystoneDashSDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,6 @@ final class KeystoneDashSDKTests: XCTestCase {
]
)

func testParseSignResultError() {
let signResultData = "a1015901b11f8b08000000000000004d9"

let ltcSdk = KeystoneLitecoinSDK()
let ur = try! UR(type: "keystone-sign-result", cbor: CBOR( signResultData.hexadecimal))

var thrownError: Swift.Error?
XCTAssertThrowsError(try ltcSdk.parseSignResult(ur: ur)) {
thrownError = $0
}
XCTAssertEqual(thrownError as? KeystoneError, .parseSignatureError("sign result is invalid"))
}

func testGenerateSignRequest() {
let dashSignRequest = KeystoneSignRequest<UtxoBaseTransaction>(
requestId: "cc946be2-8e4c-42be-a321-56a53a8cf516",
Expand Down
13 changes: 0 additions & 13 deletions Tests/KeystoneSDKTests/Chain/KeystoneEthereumSDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,6 @@ final class KeystoneEthereumSDKTests: XCTestCase {
XCTAssertEqual(ethSignature.signature, "d4f0a7bcd95bba1fbb1051885054730e3f47064288575aacc102fbbf6a9a14daa066991e360d3e3406c20c00a40973eff37c7d641e5b351ec4a99bfe86f335f713")
}

func testParseSignatureError() {
let ethSignatureHex = "a201d825509b1de"
let ethereumSdk = KeystoneEthereumSDK()
let ur = try! UR(type: "eth-signature", cbor: CBOR(ethSignatureHex.hexadecimal))

var thrownError: Swift.Error?
XCTAssertThrowsError(try ethereumSdk.parseSignature(ur: ur)) {
thrownError = $0
}
XCTAssertEqual(thrownError as? KeystoneError, .parseSignatureError("signature is invalid"))
}


func testGenerateSignRequest() {
let ethSignRequest = EthSignRequest(
requestId: "6c3633c0-02c0-4313-9cd7-e25f4f296729",
Expand Down
12 changes: 0 additions & 12 deletions Tests/KeystoneSDKTests/Chain/KeystoneEvmSDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ final class KeystoneEvmSDKTests: XCTestCase {
XCTAssertEqual(signature.signature, "a0e2577ca16119a32f421c6a1c90fa2178a9382f30bf3575ff276fb820b32b3269d49d6bbfc82bae899f60c15de4b97f24a7ebb6d4712534829628ccfbef38bc")
}

func testParseSignatureError() {
let signatureHex = "a201d825509b1de"
let sdk = KeystoneEvmSDK()
let ur = try! UR(type: "evm-signature", cbor: CBOR(signatureHex.hexadecimal))

var thrownError: Swift.Error?
XCTAssertThrowsError(try sdk.parseSignature(ur: ur)) {
thrownError = $0
}
XCTAssertEqual(thrownError as? KeystoneError, .parseSignatureError("signature is invalid"))
}

func testGenerateSignRequest() {
let signRequest = EvmSignRequest(
requestId: "05752335-5d51-4a64-a481-ff2200000000",
Expand Down
13 changes: 0 additions & 13 deletions Tests/KeystoneSDKTests/Chain/KeystoneLitecoinSDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@ final class KeystoneLitecoinSDKTests: XCTestCase {
XCTAssertEqual(signResult.rawData, "0200000000010163f6a8b2c0bde7883e4a6c155125395e3e2448432d4e433859ba11aeaacb9ba50100000017160014c441eed18e39c40e7b3ee821df2ece9217063708fdffffff02102700000000000017a914e3d32848c1f470bd0d69b8f13b59297d13d8debf87ec661a010000000017a9147b636e7e8d46daab9ec0aaa49e816c1510c77b6b870247304402204f5d70c78b2e4e036c7789cef4b9958adaa6a60edbecaa323821a52d4f56a4eb02204519108508b96e3c50fc20db850b8ed2789a18411f63d658b9b13f5175da57250121035684d200e10bc1a3e2bd7d59e58a07f2f19ef968725e18f1ed65e13396ab946600000000")
}

func testParseSignResultError() {
let signResultData = "a1015901b11f8b08000000000000004d9"

let ltcSdk = KeystoneLitecoinSDK()
let ur = try! UR(type: "keystone-sign-result", cbor: CBOR(signResultData.hexadecimal))

var thrownError: Swift.Error?
XCTAssertThrowsError(try ltcSdk.parseSignResult(ur: ur)) {
thrownError = $0
}
XCTAssertEqual(thrownError as? KeystoneError, .parseSignatureError("sign result is invalid"))
}

func testGenerateSignRequest() {
let ltcSignRequest = KeystoneSignRequest<LitecoinTransaction>(
requestId: "cc946be2-8e4c-42be-a321-56a53a8cf516",
Expand Down
13 changes: 0 additions & 13 deletions Tests/KeystoneSDKTests/Chain/KeystoneNearSDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ final class KeystoneNearSDKTests: XCTestCase {
XCTAssertEqual(nearSignature.signature, ["85c578f8ca68bf8d771f0346ed68c4170df9ee9878cb76f3e2fac425c3f5793d36a741547e245c6c7ac1b9433ad5fc523d41152cac2a3726cbe134e0a0366802"])
}

func testParseSignatureError() {
let cborHex = "a201d825509b1de"
let sdk = KeystoneNearSDK()
let ur = try! UR(type: "near-signature", cbor: CBOR(cborHex.hexadecimal))

var thrownError: Swift.Error?
XCTAssertThrowsError(try sdk.parseSignature(ur: ur)) {
thrownError = $0
}
XCTAssertEqual(thrownError as? KeystoneError, .parseSignatureError("signature is invalid"))
}


func testGenerateSignRequest() {
let signRequest = NearSignRequest(
requestId: "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
Expand Down
Loading

0 comments on commit c2a1063

Please sign in to comment.