Skip to content

Commit 2a2d370

Browse files
🔄 synced file(s) with circlefin/modularwallets-ios-sdk-internal (#8)
synced local file(s) with [circlefin/modularwallets-ios-sdk-internal](https://github.com/circlefin/modularwallets-ios-sdk-internal). <details> <summary>Changed files</summary> <ul> <li>synced local directory <code>CircleModularWalletsCore/</code> with remote directory <code>CircleModularWalletsCore/</code></li> </ul> </details> --- This PR was created automatically by the [repo-file-sync-action](https://github.com/BetaHuhn/repo-file-sync-action) workflow run [#12649953883](https://github.com/circlefin/modularwallets-ios-sdk-internal/actions/runs/12649953883)
1 parent 4e68915 commit 2a2d370

File tree

5 files changed

+42
-12
lines changed

5 files changed

+42
-12
lines changed

‎CircleModularWalletsCore/Resources/Info.plist‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plist version="1.0">
44
<dict>
55
<key>CFBundleShortVersionString</key>
6-
<string>1.0.5</string>
6+
<string>1.0.6</string>
77
<key>CFBundleIdentifier</key>
88
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
99
<key>CFBundleName</key>

‎CircleModularWalletsCore/Sources/Helpers/Extensions/Bundle+Extension.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Foundation
2121
#if SWIFT_PACKAGE
2222
extension Bundle {
2323
public enum SDK {
24-
public static let version = "1.0.5"
24+
public static let version = "1.0.6"
2525
}
2626
}
2727
#else

‎CircleModularWalletsCore/Sources/Helpers/WebAuthn/WebAuthnHandler.swift‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,22 @@ extension WebAuthnHandler: ASAuthorizationControllerDelegate {
120120
// The attestationObject contains the user's new public key to store and use for subsequent sign-ins.
121121
let attestationObjectData = asCredentialRegistration.rawAttestationObject
122122
let clientDataJSON = asCredentialRegistration.rawClientDataJSON
123+
var attachment: AuthenticatorAttachment = .platform
124+
if #available(iOS 16.6, *) {
125+
switch asCredentialRegistration.attachment {
126+
case .platform:
127+
attachment = .platform
128+
case .crossPlatform:
129+
attachment = .crossPlatform
130+
@unknown default:
131+
attachment = .platform
132+
}
133+
}
123134

124135
let credential = RegistrationCredential(
125136
id: asCredentialRegistration.credentialID.base64URLEncodedString().asString(),
126137
type: CredentialType.publicKey,
127-
authenticatorAttachment: .platform,
138+
authenticatorAttachment: attachment,
128139
rawID: asCredentialRegistration.credentialID.base64URLEncodedString(),
129140
response: AuthenticatorAttestationResponse(
130141
rawClientDataJSON: clientDataJSON.bytes,
@@ -144,11 +155,22 @@ extension WebAuthnHandler: ASAuthorizationControllerDelegate {
144155
let signature = asCredentialAssertion.signature
145156
let clientDataJSON = asCredentialAssertion.rawClientDataJSON
146157
let authenticatorData = asCredentialAssertion.rawAuthenticatorData
158+
var attachment: AuthenticatorAttachment = .platform
159+
if #available(iOS 16.6, *) {
160+
switch asCredentialAssertion.attachment {
161+
case .platform:
162+
attachment = .platform
163+
case .crossPlatform:
164+
attachment = .crossPlatform
165+
@unknown default:
166+
attachment = .platform
167+
}
168+
}
147169

148170
let credential = AuthenticationCredential(
149171
id: asCredentialAssertion.credentialID.base64URLEncodedString().asString(),
150172
type: CredentialType.publicKey,
151-
authenticatorAttachment: .platform,
173+
authenticatorAttachment: attachment,
152174
rawID: asCredentialAssertion.credentialID.base64URLEncodedString(),
153175
response: AuthenticatorAssertionResponse(
154176
clientDataJSON: clientDataJSON.bytes.base64URLEncodedString(),

‎CircleModularWalletsCore/Sources/Models/Token.swift‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public enum MainnetToken: String {
4545
}
4646

4747
public var name: String {
48-
return "\(Mainnet.chainId)_\(self.rawValue)"
48+
return "Mainnet_\(self.rawValue)"
4949
}
5050
}
5151

@@ -75,7 +75,7 @@ public enum PolygonToken: String {
7575
}
7676

7777
public var name: String {
78-
return "\(Polygon.chainId)_\(self.rawValue)"
78+
return "Polygon_\(self.rawValue)"
7979
}
8080
}
8181

@@ -106,7 +106,7 @@ public enum ArbitrumToken: String {
106106
}
107107

108108
public var name: String {
109-
return "\(Arbitrum.chainId)_\(self.rawValue)"
109+
return "Arbitrum_\(self.rawValue)"
110110
}
111111
}
112112

@@ -118,7 +118,7 @@ public enum SepoliaToken: String {
118118
}
119119

120120
public var name: String {
121-
return "\(Sepolia.chainId)_\(self.rawValue)"
121+
return "Sepolia_\(self.rawValue)"
122122
}
123123
}
124124

@@ -130,7 +130,7 @@ public enum PolygonAmoyToken: String {
130130
}
131131

132132
public var name: String {
133-
return "\(PolygonAmoy.chainId)_\(self.rawValue)"
133+
return "PolygonAmoy_\(self.rawValue)"
134134
}
135135
}
136136

@@ -142,6 +142,6 @@ public enum ArbitrumSepoliaToken: String {
142142
}
143143

144144
public var name: String {
145-
return "\(ArbitrumSepolia.chainId)_\(self.rawValue)"
145+
return "ArbitrumSepolia_\(self.rawValue)"
146146
}
147147
}

‎CircleModularWalletsCore/Sources/Transports/Http/HttpTransport.swift‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ public class HttpTransport: Transport {
5858
extension HttpTransport {
5959

6060
func send<T: Decodable>(_ urlRequest: URLRequest) async throws -> T {
61+
var data: Data = .init(), response: URLResponse?
6162
do {
62-
let (data, response) = try await session.data(for: urlRequest)
63+
(data, response) = try await session.data(for: urlRequest)
6364
try processResponse(data: data, response: response)
6465

6566
if let errorResult = try? decodeData(data: data) as JsonRpcErrorResult {
@@ -72,6 +73,8 @@ extension HttpTransport {
7273
return try decodeData(data: data) as T
7374
}
7475

76+
} catch let error as BaseError {
77+
throw error
7578
} catch let error as HttpError {
7679
var _details: String?
7780
var _cause: Error?
@@ -85,7 +88,12 @@ extension HttpTransport {
8588
_details = "Decoding Failed."
8689
_cause = error
8790
case .unknownError(let statusCode):
88-
_details = "Request failed: \(statusCode)"
91+
if let errorResult = try? decodeData(data: data) as JsonRpcErrorResult {
92+
_details = errorResult.error.message
93+
} else {
94+
let message = String(data: data, encoding: .utf8) ?? ""
95+
_details = "Request failed: \(message)"
96+
}
8997
_statusCode = statusCode
9098
default:
9199
_details = String(describing: error)

0 commit comments

Comments
 (0)