Skip to content

Commit

Permalink
🔄 synced file(s) with circlefin/modularwallets-ios-sdk-internal (#8)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
circle-github-action-bot authored Jan 7, 2025
1 parent 4e68915 commit 2a2d370
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CircleModularWalletsCore/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleShortVersionString</key>
<string>1.0.5</string>
<string>1.0.6</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleName</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Foundation
#if SWIFT_PACKAGE
extension Bundle {
public enum SDK {
public static let version = "1.0.5"
public static let version = "1.0.6"
}
}
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,22 @@ extension WebAuthnHandler: ASAuthorizationControllerDelegate {
// The attestationObject contains the user's new public key to store and use for subsequent sign-ins.
let attestationObjectData = asCredentialRegistration.rawAttestationObject
let clientDataJSON = asCredentialRegistration.rawClientDataJSON
var attachment: AuthenticatorAttachment = .platform
if #available(iOS 16.6, *) {
switch asCredentialRegistration.attachment {
case .platform:
attachment = .platform
case .crossPlatform:
attachment = .crossPlatform
@unknown default:
attachment = .platform
}
}

let credential = RegistrationCredential(
id: asCredentialRegistration.credentialID.base64URLEncodedString().asString(),
type: CredentialType.publicKey,
authenticatorAttachment: .platform,
authenticatorAttachment: attachment,
rawID: asCredentialRegistration.credentialID.base64URLEncodedString(),
response: AuthenticatorAttestationResponse(
rawClientDataJSON: clientDataJSON.bytes,
Expand All @@ -144,11 +155,22 @@ extension WebAuthnHandler: ASAuthorizationControllerDelegate {
let signature = asCredentialAssertion.signature
let clientDataJSON = asCredentialAssertion.rawClientDataJSON
let authenticatorData = asCredentialAssertion.rawAuthenticatorData
var attachment: AuthenticatorAttachment = .platform
if #available(iOS 16.6, *) {
switch asCredentialAssertion.attachment {
case .platform:
attachment = .platform
case .crossPlatform:
attachment = .crossPlatform
@unknown default:
attachment = .platform
}
}

let credential = AuthenticationCredential(
id: asCredentialAssertion.credentialID.base64URLEncodedString().asString(),
type: CredentialType.publicKey,
authenticatorAttachment: .platform,
authenticatorAttachment: attachment,
rawID: asCredentialAssertion.credentialID.base64URLEncodedString(),
response: AuthenticatorAssertionResponse(
clientDataJSON: clientDataJSON.bytes.base64URLEncodedString(),
Expand Down
12 changes: 6 additions & 6 deletions CircleModularWalletsCore/Sources/Models/Token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public enum MainnetToken: String {
}

public var name: String {
return "\(Mainnet.chainId)_\(self.rawValue)"
return "Mainnet_\(self.rawValue)"
}
}

Expand Down Expand Up @@ -75,7 +75,7 @@ public enum PolygonToken: String {
}

public var name: String {
return "\(Polygon.chainId)_\(self.rawValue)"
return "Polygon_\(self.rawValue)"
}
}

Expand Down Expand Up @@ -106,7 +106,7 @@ public enum ArbitrumToken: String {
}

public var name: String {
return "\(Arbitrum.chainId)_\(self.rawValue)"
return "Arbitrum_\(self.rawValue)"
}
}

Expand All @@ -118,7 +118,7 @@ public enum SepoliaToken: String {
}

public var name: String {
return "\(Sepolia.chainId)_\(self.rawValue)"
return "Sepolia_\(self.rawValue)"
}
}

Expand All @@ -130,7 +130,7 @@ public enum PolygonAmoyToken: String {
}

public var name: String {
return "\(PolygonAmoy.chainId)_\(self.rawValue)"
return "PolygonAmoy_\(self.rawValue)"
}
}

Expand All @@ -142,6 +142,6 @@ public enum ArbitrumSepoliaToken: String {
}

public var name: String {
return "\(ArbitrumSepolia.chainId)_\(self.rawValue)"
return "ArbitrumSepolia_\(self.rawValue)"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ public class HttpTransport: Transport {
extension HttpTransport {

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

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

} catch let error as BaseError {
throw error
} catch let error as HttpError {
var _details: String?
var _cause: Error?
Expand All @@ -85,7 +88,12 @@ extension HttpTransport {
_details = "Decoding Failed."
_cause = error
case .unknownError(let statusCode):
_details = "Request failed: \(statusCode)"
if let errorResult = try? decodeData(data: data) as JsonRpcErrorResult {
_details = errorResult.error.message
} else {
let message = String(data: data, encoding: .utf8) ?? ""
_details = "Request failed: \(message)"
}
_statusCode = statusCode
default:
_details = String(describing: error)
Expand Down

0 comments on commit 2a2d370

Please sign in to comment.