Skip to content

Commit c3d81cd

Browse files
authored
Merge pull request #27 from BoiseITGuru/get-account-proof
Added function to retrieve account-proof
2 parents b707e78 + 9a3f738 commit c3d81cd

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

Sources/Config/FCLMetadata.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public extension FCL {
3535
}
3636

3737
public struct AccountProofConfig {
38-
let appIdentifier: String
39-
let nonce: String
38+
public let appIdentifier: String
39+
public let nonce: String
4040

4141
public init(appIdentifier: String, nonce: String = fcl.generateNonce()) {
4242
self.appIdentifier = appIdentifier

Sources/Method/AccountProof.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ import Flow
99
import Foundation
1010

1111
public extension FCL {
12+
func getAccountProof() async throws -> FCLDataResponse {
13+
guard let currentUser = currentUser, currentUser.loggedIn else {
14+
throw Flow.FError.unauthenticated
15+
}
16+
17+
guard let service = serviceOfType(services: currentUser.services, type: .accountProof),
18+
let data = service.data
19+
else {
20+
throw FCLError.invaildService
21+
}
22+
23+
return data
24+
}
25+
1226
func verifyAccountProof(includeDomainTag: Bool = false) async throws -> Bool {
1327
guard let currentUser = currentUser, currentUser.loggedIn else {
1428
throw Flow.FError.unauthenticated

Sources/Models/FCLResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ extension FCL {
223223
}
224224
}
225225

226-
struct FCLDataResponse: Codable {
226+
public struct FCLDataResponse: Codable {
227227
let fType: String
228228
let fVsn: String
229229
let nonce: String?

0 commit comments

Comments
 (0)