Skip to content

Commit

Permalink
Merge pull request #126 from ArcBlock/add_rolle_type
Browse files Browse the repository at this point in the history
chore: add role type passkey
  • Loading branch information
CreatFish authored Jan 21, 2025
2 parents a86694b + 0397fa6 commit 1fa5b22
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ github_url: https://github.com/ArcBlock/arcblock-ios-sdk
github_file_prefix: https://github.com/ArcBlock/arcblock-ios-sdk/tree/master
exclude:
- ArcBlockSDK/ABSDKCoreKit/Network/ABSDKPagination.swift
module_version: 0.11.47
module_version: 0.11.48
2 changes: 1 addition & 1 deletion ArcBlockSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'ArcBlockSDK'
s.version = '0.11.47'
s.version = '0.11.48'
s.summary = 'Used to integrate iOS apps with ArcBlock Platform.'

# This description is used to generate tags and improve search results.
Expand Down
4 changes: 3 additions & 1 deletion ArcBlockSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -1080,6 +1080,7 @@
DEFINES_MODULE = YES;
EXCLUDED_ARCHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 14.6;
};
name = Debug;
};
Expand All @@ -1089,6 +1090,7 @@
DEFINES_MODULE = YES;
EXCLUDED_ARCHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 14.6;
};
name = Release;
};
Expand Down
2 changes: 2 additions & 0 deletions ArcBlockSDK/ABSDKCoreKit/ABSDKWalletKit/TxHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ public class TxHelper {
signature = MCrypto.Signer.M_SECP256K1.sign(message: message, privateKey: privateKey)
case .ethereum:
signature = MCrypto.Signer.ETHEREUM.sign(message: message, privateKey: privateKey)
case .passkey:
signature = nil
}

return signature
Expand Down
27 changes: 27 additions & 0 deletions ArcBlockSDK/ABSDKCoreKit/DidHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public enum RoleType: Int8 {
case factory = 18
case rollup = 19
case storage = 20
case profile = 21
case passkey = 22
case any = 63

public static func roleTypeWithName(_ name: String) -> RoleType {
Expand Down Expand Up @@ -93,6 +95,10 @@ public enum RoleType: Int8 {
return .rollup
case "storage":
return .storage
case "profile":
return .profile
case "passkey":
return .passkey
default:
return .any
}
Expand Down Expand Up @@ -142,6 +148,10 @@ public enum RoleType: Int8 {
return "rollup"
case .storage:
return "storage"
case .profile:
return "profile"
case .passkey:
return "passkey"
case .any:
return "any"
}
Expand All @@ -152,6 +162,7 @@ public enum KeyType: Int8 {
case ed25519 = 0
case secp256k1 = 1
case ethereum = 2
case passkey = 3

// childSeed to PublicKey
public func privateKeyToPublicKey(privateKey: Data) -> Data? {
Expand All @@ -162,6 +173,8 @@ public enum KeyType: Int8 {
return MCrypto.Signer.M_SECP256K1.privateKeyToPublicKey(privateKey: privateKey)
case .ethereum:
return MCrypto.Signer.ETHEREUM.privateKeyToPublicKey(privateKey: privateKey)
case .passkey:
return nil
}
}

Expand All @@ -173,6 +186,8 @@ public enum KeyType: Int8 {
return MCrypto.Signer.M_SECP256K1.keypair()
case .ethereum:
return MCrypto.Signer.ETHEREUM.keypair()
case .passkey:
return (nil, nil)
}
}

Expand All @@ -184,6 +199,8 @@ public enum KeyType: Int8 {
return (MCrypto.Signer.M_SECP256K1.privateKeyToPublicKey(privateKey: privateKey) , privateKey)
case .ethereum:
return (MCrypto.Signer.ETHEREUM.privateKeyToPublicKey(privateKey: privateKey) , privateKey)
case .passkey:
return (nil, nil)
}
}

Expand All @@ -196,6 +213,8 @@ public enum KeyType: Int8 {
return .ed25519
case "ethereum" :
return .ethereum
case "passkey":
return .passkey
default:
return .ed25519
}
Expand All @@ -209,6 +228,8 @@ public enum KeyType: Int8 {
return "secp256k1"
case .ethereum:
return "ethereum"
case .passkey:
return "passkey"
}
}
}
Expand Down Expand Up @@ -313,6 +334,8 @@ public struct DidType: Equatable {
return MCrypto.Signer.M_SECP256K1.sign(message: message, privateKey: privateKey)
case .ethereum:
return MCrypto.Signer.ETHEREUM.sign(message: message, privateKey: privateKey)
case .passkey:
return nil
}
}

Expand All @@ -324,6 +347,8 @@ public struct DidType: Equatable {
return MCrypto.Signer.M_SECP256K1.verify(message: message, signature: signature, publicKey: publicKey)
case .ethereum:
return MCrypto.Signer.ETHEREUM.verify(message: message, signature: signature, publicKey: publicKey)
case .passkey:
return false
}
}

Expand All @@ -335,6 +360,8 @@ public struct DidType: Equatable {
return MCrypto.Signer.M_SECP256K1.privateKeyToPublicKey(privateKey: privateKey)
case .ethereum:
return MCrypto.Signer.ETHEREUM.privateKeyToPublicKey(privateKey: privateKey)
case .passkey:
return nil
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.11.48 (January 21, 2025)
- support passkey type

## 0.11.47 (June 14, 2024)
- fix format

Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.47
0.11.48

0 comments on commit 1fa5b22

Please sign in to comment.