Skip to content

Commit

Permalink
Document getCborData() returns IssuerSigned
Browse files Browse the repository at this point in the history
  • Loading branch information
phisakel committed May 28, 2024
1 parent d76ac48 commit 4b1baed
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Sources/eudi-lib-ios-wallet-storage/Document.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ public struct Document {
public let modifiedAt: Date?

/// get CBOR data and private key from document
public func getCborData() -> (dr: DeviceResponse, dpk: CoseKeyPrivate)? {
public func getCborData() -> (iss: IssuerSigned, dpk: CoseKeyPrivate)? {
switch docDataType {
case .signupResponseJson:
guard let sr = data.decodeJSON(type: SignUpResponse.self), let dr = sr.deviceResponse, let dpk = sr.devicePrivateKey else { return nil }
return (dr,dpk)
guard let sr = data.decodeJSON(type: SignUpResponse.self), let dr = sr.deviceResponse, let iss = dr.documents?.first?.issuerSigned, let dpk = sr.devicePrivateKey else { return nil }
return (iss, dpk)
case .cbor:
guard let dr = DeviceResponse(data: [UInt8](data)), let privateKeyType, let privateKey, let dpk = try? IssueRequest(id: id, privateKeyType: privateKeyType, keyData: privateKey).toCoseKeyPrivate() else { return nil }
return (dr,dpk)
guard let iss = IssuerSigned(data: [UInt8](data)), let privateKeyType, let privateKey, let dpk = try? IssueRequest(id: id, privateKeyType: privateKeyType, keyData: privateKey).toCoseKeyPrivate() else { return nil }
return (iss, dpk)
case .sjwt:
fatalError("Format \(docDataType) not implemented")
}
Expand Down

0 comments on commit 4b1baed

Please sign in to comment.