Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/cleanup #29

Merged
merged 66 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
e44882a
feat: add signer extension
ieow May 20, 2024
ec85521
fix: interfaces and file rename
ieow May 20, 2024
40154fc
fea: remove target library
ieow May 20, 2024
c8be977
feat: clean up
ieow May 20, 2024
e6c7802
fix: camelCase, fix package version
ieow May 20, 2024
97fa7f4
feat: add evmSigner
ieow May 24, 2024
8996e8f
fix: revert extension
ieow May 24, 2024
40880a8
feat: add manual
ieow Jun 4, 2024
3931ed6
Update Package.resolved
ieow Jun 14, 2024
262dc44
fix remove macOS from package.
metalurgical Jun 14, 2024
9ed165d
fix: package.resolved revision for tss-client-swift
metalurgical Jun 14, 2024
86c50b4
fix: address comment
ieow Jun 14, 2024
9338f93
fix: resovle comment
ieow Jun 20, 2024
dab503c
fix: break enableMFA to 2 function
ieow Jun 28, 2024
e61bbef
fix: test
ieow Jun 28, 2024
5331918
cleanup mess
metalurgical Jun 28, 2024
08d54ce
update dependencies
metalurgical Jul 30, 2024
71bd3d9
fix: working login, signing, create ,delete factor
ieow Sep 12, 2024
9228f23
fix: update backup and delete backupshare
ieow Sep 12, 2024
6fbf281
add: overwriteMetadataUrl
ieow Sep 12, 2024
4e92f26
revert
metalurgical Sep 15, 2024
ac05a42
update sfa
metalurgical Sep 15, 2024
69bbbcb
update check for the hashed factor pub
AyushBherwani1998 Sep 16, 2024
58c61b4
update existing user check
AyushBherwani1998 Sep 16, 2024
37cc49d
use factorpub for check
AyushBherwani1998 Sep 16, 2024
8d1d830
fix: make tssSign sync
ieow Sep 17, 2024
e9dc224
fix: make public key sync
ieow Sep 17, 2024
7f8f4b0
update dependencies
metalurgical Nov 4, 2024
8aa87ae
fix: use UserInfo type instead of dictionary.
metalurgical Nov 21, 2024
ac4c1ec
update
metalurgical Nov 21, 2024
fe142a0
update: simplify dependencies
metalurgical Nov 21, 2024
b00bfb0
formatting
metalurgical Nov 21, 2024
6f6d5a6
update tss-client 5.0.1
metalurgical Nov 22, 2024
e614b9c
update tkey-mpc-swift to released version (4.0.0)
metalurgical Nov 22, 2024
8c121f7
feat: add podspec
metalurgical Nov 25, 2024
a8e9b5e
fix: address comment
ieow Dec 6, 2024
4560ac1
fix: add default value
ieow Dec 6, 2024
0e91858
resolve comments
AyushBherwani1998 Dec 6, 2024
4e739dd
fix: add default network back
metalurgical Dec 10, 2024
ed436bd
fix: use commitChanges instead
metalurgical Dec 10, 2024
06331d6
fix: enable loginwithJWT aggregate login
ieow Dec 11, 2024
a6e2c35
fix: update with release package
ieow Dec 11, 2024
1dcfa82
fix: update use getTssShare instead of static tssShare
ieow Dec 12, 2024
16633d0
fix: handle edge cases, make tssSign sync
ieow Dec 12, 2024
f9531f3
test: bulk-stream metadata fix
ieow Jan 3, 2025
ad4e182
test: fix set metadata multipart
ieow Jan 3, 2025
9b7094c
fix: make additionalDeviceMetadata valid for both iOS and Mac
metalurgical Jan 3, 2025
7fa1e1c
fix: warnings
metalurgical Jan 3, 2025
ebb331b
fix: mutation of captured variable in concurrent code
metalurgical Jan 3, 2025
9711128
update tkey-mpc version
metalurgical Jan 6, 2025
5babd40
feat: tssSignSync
ieow Jan 8, 2025
fa528f0
use optional var
ieow Jan 8, 2025
742afd2
use completion
ieow Jan 8, 2025
9b37f29
feat: add error propagation
ieow Jan 9, 2025
9fe8aed
test: rss fix
ieow Jan 15, 2025
2b126ca
fix: update tkey-mpc-swift to 4.0.2
metalurgical Jan 15, 2025
a9d23ff
Merge pull request #30 from Web3Auth/update_dependencies
metalurgical Jan 15, 2025
60d3116
cleanup: signatures and function names
metalurgical Jan 15, 2025
cb39bfe
remove duplicate code for factorserialization
metalurgical Jan 15, 2025
539058e
refactor: make endpoints and storage private
metalurgical Jan 15, 2025
3126133
refactor: move resetAccount to helper
metalurgical Jan 15, 2025
4773dfc
Update FactorSerialization.swift
metalurgical Jan 15, 2025
b2f9ab1
feat: add status getter
ieow Jan 17, 2025
2568c97
fix: clear on logout
ieow Jan 17, 2025
790ca56
refactor: cleanup status
metalurgical Jan 17, 2025
b6940af
fix: variable rename
ieow Jan 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/torusresearch/fetch-node-details-swift.git",
"state" : {
"revision" : "c8d0121fed49ce761f5946bc30e1aafbe1ac5acb",
"revision" : "22bfadf7491d77a0bc1953af002cadbd61383e7d",
"version" : "6.0.2"
}
},
Expand All @@ -50,8 +50,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/jwt-kit.git",
"state" : {
"revision" : "c2595b9ad7f512d7f334830b4df1fed6e917946a",
"version" : "4.13.4"
"revision" : "484cb741f041dae2ba756e0400fb7f79707bde44",
"version" : "4.0.0"
}
},
{
Expand Down Expand Up @@ -113,17 +113,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-crypto.git",
"state" : {
"revision" : "bc1c29221f6dfeb0ebbfbc98eb95cd3d4967868e",
"version" : "3.4.0"
"revision" : "ddb07e896a2a8af79512543b1c7eb9797f8898a5",
"version" : "1.1.7"
}
},
{
"identity" : "tkey-mpc-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/tkey/tkey-mpc-swift",
"state" : {
"revision" : "8fe0cc8d5cc2ad5d38bf068bc29f6af7e3146d08",
"version" : "3.0.0"
"branch" : "fix/base64",
"revision" : "5e5bc3ea3dc01fb8921793a0adbf43511d9eb78a"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/vapor/jwt-kit.git", from: "4.0.0"),
.package(url: "https://github.com/torusresearch/tss-client-swift.git", from: "4.0.0"),
.package(url: "https://github.com/tkey/tkey-mpc-swift", from: "3.0.0"),
.package(url: "https://github.com/torusresearch/tss-client-swift.git", exact: "4.0.0"),
metalurgical marked this conversation as resolved.
Show resolved Hide resolved
.package(url: "https://github.com/tkey/tkey-mpc-swift", branch: "fix/base64"),
metalurgical marked this conversation as resolved.
Show resolved Hide resolved
.package(url: "https://github.com/torusresearch/customauth-swift-sdk", from: "10.0.1"),
.package(url: "https://github.com/Web3Auth/single-factor-auth-swift", from: "5.0.0")
],
Expand Down
12 changes: 0 additions & 12 deletions Sources/mpc-core-kit-swift/CoreKitStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@ public class CoreKitStorage {
self.storeKey = storeKey
}

// static func getInstance( storeKey: String , storage: ILocalStorage? = nil) throws -> CoreKitStorage {
// guard let localInstance = self.instance else {
// guard let lStorage = storage else {
// throw "no storage provided or found"
// }
// let local = CoreKitStorage.init(storeKey: storeKey, storage: lStorage)
// CoreKitStorage.instance = local
// return local
// }
// return localInstance
// }

public func resetStore() async throws -> Data {
let result = try await self.storage.get(key: self.storeKey)
let payload = try JSONSerialization.data(withJSONObject: [:])
Expand Down
4 changes: 3 additions & 1 deletion Sources/mpc-core-kit-swift/Helper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import Foundation
import tssClientSwift
import tkey
import BigInt
import curveSecp256k1
import FetchNodeDetails

import SingleFactorAuth

#if canImport(curveSecp256k1)
import curveSecp256k1
#endif

func convertPublicKeyFormat ( publicKey: String, outFormat: PublicKeyEncoding ) throws -> String {
let point = try KeyPoint(address: publicKey)
Expand Down
2 changes: 1 addition & 1 deletion Sources/mpc-core-kit-swift/Interface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public struct MpcKeyDetails : Codable {
public let requiredFactors: Int32
public let threshold: UInt32
public let shareDescriptions : String
public let total_shares: UInt32
public let totalShares: UInt32
public let totalFactors: UInt32?
// public let requiredFactors: String
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import TorusUtils
import FetchNodeDetails
import SingleFactorAuth



#if canImport(curveSecp256k1)
import curveSecp256k1
#endif

public struct MpcCoreKit {

Expand Down Expand Up @@ -164,7 +164,7 @@ public struct MpcCoreKit {
requiredFactors: finalKeyDetails.required_shares,
threshold: finalKeyDetails.threshold,
shareDescriptions: finalKeyDetails.share_descriptions,
total_shares: finalKeyDetails.total_shares,
totalShares: finalKeyDetails.total_shares,
totalFactors: UInt32(factorsCount) + 1
)
return keyDetails
Expand Down Expand Up @@ -255,7 +255,7 @@ public struct MpcCoreKit {
let finalKeyDetails = try thresholdKey.get_key_details()
let tssTag = try TssModule.get_tss_tag(threshold_key: thresholdKey)
let tssPubKey = try? await TssModule.get_tss_pub_key(threshold_key: thresholdKey, tss_tag: tssTag)
ieow marked this conversation as resolved.
Show resolved Hide resolved
return .init(tssPubKey: tssPubKey ?? "", metadataPubKey: try finalKeyDetails.pub_key.getPublicKey(format: .EllipticCompress), requiredFactors: finalKeyDetails.required_shares, threshold: finalKeyDetails.threshold, shareDescriptions: finalKeyDetails.share_descriptions, total_shares: finalKeyDetails.total_shares, totalFactors: 0)
return .init(tssPubKey: tssPubKey ?? "", metadataPubKey: try finalKeyDetails.pub_key.getPublicKey(format: .EllipticCompress), requiredFactors: finalKeyDetails.required_shares, threshold: finalKeyDetails.threshold, shareDescriptions: finalKeyDetails.share_descriptions, totalShares: finalKeyDetails.total_shares, totalFactors: 0)
}

private mutating func existingUser() async throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import CustomAuth
import TorusUtils
import tssClientSwift
import tkey
#if canImport(curveSecp256k1)
import curveSecp256k1
#endif

import BigInt
import UIKit

Expand Down
16 changes: 13 additions & 3 deletions Tests/mpc-kit-swiftTests/mpc_kit_swiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,17 @@ final class mpc_kit_swiftTests: XCTestCase {
// Defining Test Cases and Test Methods
// https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods

let email = "testiosEmail004"
// let email = "testiosEmail004"
let email = "testios002"
let verifier = "torus-test-health"
let clientId = "torus-test-health"
try await resetMPC(email: email, verifier: verifier, clientId: clientId)
// try await resetMPC(email: email, verifier: verifier, clientId: clientId)

let memoryStorage = MemoryStorage()
var coreKitInstance = MpcCoreKit( web3AuthClientId: clientId, web3AuthNetwork: Web3AuthNetwork.SAPPHIRE_DEVNET, disableHashFactor: false, localStorage: memoryStorage)
let factormetadata = try await coreKitInstance.tkey?.storage_layer_get_metadata(private_key: "a9d1bb9cdea502426ed24e8a1df8f956979942028dff957c4588aeded32daec9")
metalurgical marked this conversation as resolved.
Show resolved Hide resolved

print(factormetadata)

let data = try mockLogin2(email: email)
let token = data
Expand All @@ -132,7 +136,13 @@ final class mpc_kit_swiftTests: XCTestCase {
// let keyDetails = try await coreKitInstance.login(loginProvider: .jwt, verifier: "test", jwtParams: jwtParams.toDictionary())


let keyDetails = try await coreKitInstance.loginWithJwt(verifier: verifier, verifierId: email, idToken: token)
let keyDetails = try? await coreKitInstance.loginWithJwt(verifier: verifier, verifierId: email, idToken: token)
ieow marked this conversation as resolved.
Show resolved Hide resolved
print(keyDetails)
print(try coreKitInstance.getHashKey())
// try await coreKitInstance.inputFactor(factorKey: "2d2c2c68bd80044ef943e3d0769556da97f13594a251201a480c091651098a0e")
let factormetadata1 = try await coreKitInstance.tkey?.storage_layer_get_metadata(private_key: "877d46727a09fcaf90d9b269f2ade70b713da9fe7fe6d781b419b3a9dc50e247")

print(factormetadata1)

let hash = try keccak256(data: Data(hex: "010203040506"))
let signatures = try await coreKitInstance.tssSign(message: hash)
Expand Down
Loading