-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import Foundation | ||
|
||
public class WalletProxyClient { | ||
let baseUrl: String | ||
|
||
public init(baseUrl: String) { | ||
self.baseUrl = baseUrl | ||
} | ||
|
||
public func getIdentityProviderInfo() async throws -> [IdentityProviderJson] { | ||
let url = URL(string: "\(baseUrl)/v1/ip_info")! | ||
let (data, _) = try await URLSession.shared.data(from: url) | ||
return try JSONDecoder().decode([IdentityProviderJson].self, from: data) | ||
} | ||
} | ||
|
||
public struct IdentityProviderJson: Decodable { | ||
public var ipInfo: IdentityProvider | ||
public var arsInfos: [String: AnonymityRevoker] | ||
public var metadata: Metadata | ||
|
||
public struct IdentityProvider: Decodable { | ||
public var ipIdentity: UInt32 | ||
public var ipDescription: Description | ||
public var ipCdiVerifyKey: String | ||
public var ipVerifyKey: String | ||
} | ||
|
||
public struct AnonymityRevoker: Decodable { | ||
public var arIdentity: UInt32 | ||
public var arDescription: Description | ||
public var arPublicKey: String | ||
} | ||
|
||
public struct Description: Decodable { | ||
public var name: String | ||
public var description: String | ||
public var url: String | ||
} | ||
|
||
public struct Metadata: Decodable { | ||
public var icon: String | ||
public var issuanceStart: String | ||
public var support: String? | ||
public var recoveryStart: String | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters