From 4b1baed798ee5b0256d74bd41a93853097f817f0 Mon Sep 17 00:00:00 2001 From: Filippos Sakellaropoulos Date: Wed, 29 May 2024 00:34:55 +0300 Subject: [PATCH] Document getCborData() returns IssuerSigned --- Sources/eudi-lib-ios-wallet-storage/Document.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/eudi-lib-ios-wallet-storage/Document.swift b/Sources/eudi-lib-ios-wallet-storage/Document.swift index ae18d7a..a09a028 100644 --- a/Sources/eudi-lib-ios-wallet-storage/Document.swift +++ b/Sources/eudi-lib-ios-wallet-storage/Document.swift @@ -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") }