From 2fea6eb5f5df03da472572faa75beac07ee413b1 Mon Sep 17 00:00:00 2001 From: "Josep Milan K.A" Date: Tue, 17 Sep 2024 11:52:43 +0530 Subject: [PATCH] Fix #49: Issuer config update --- .../Model/IssuerWellKnownConfiguration.swift | 46 ++++++------------- ...IssuerWellKnownConfigurationResponse.swift | 20 ++++++-- 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/Sources/eudiWalletOidcIos/Model/IssuerWellKnownConfiguration.swift b/Sources/eudiWalletOidcIos/Model/IssuerWellKnownConfiguration.swift index 97c1a58..38d2b8f 100644 --- a/Sources/eudiWalletOidcIos/Model/IssuerWellKnownConfiguration.swift +++ b/Sources/eudiWalletOidcIos/Model/IssuerWellKnownConfiguration.swift @@ -4,16 +4,15 @@ // // Created by Mumthasir mohammed on 08/03/24. // - import Foundation // MARK: - IssuerWellKnownConfiguration -public struct Display{ +public struct Display: Codable{ public let name: String? public let location: String? public let locale: String? public let description: String? - public var cover, logo: DisplayCover? + public var bgImage, logo, cover: DisplayCover? public var backgroundColor, textColor: String? init(from: DisplayResponse) { @@ -21,23 +20,25 @@ public struct Display{ location = from.location locale = from.locale description = from.description - cover = from.cover == nil ? nil : DisplayCover(from: from.cover!) + bgImage = from.bgImage == nil ? nil : DisplayCover(from: from.bgImage!) logo = from.logo == nil ? nil : DisplayCover(from: from.logo!) + cover = from.cover == nil ? nil : DisplayCover(from: from.cover!) backgroundColor = from.backgroundColor textColor = from.textColor } - public init(mName: String, mLocation:String, mLocale: String?, mDescription: String, mCover: DisplayCover?, mLogo: DisplayCover?, mBackgroundColor: String?, mTextColor: String?) { + public init(mName: String?, mLocation:String?, mLocale: String?, mDescription: String?, mCover: DisplayCover?, mLogo: DisplayCover?, mBackgroundColor: String?, mTextColor: String?) { name = mName location = mLocation locale = mLocale description = mDescription - cover = mCover + bgImage = mCover logo = mLogo backgroundColor = mBackgroundColor textColor = mTextColor } } + public struct TrustFrameworkInIssuer { public let name: String? public let type: String? @@ -51,21 +52,6 @@ public struct TrustFrameworkInIssuer { display = from.display == nil ? nil : Display(from: from.display!) } } -//struct CredentialsSupported: Codable { -// let format: String? -// let types: [String]? -// let trustFramework: TrustFrameworkInIssuer? -// let display: DisplayOrArray? -//} -// -//// MARK: - CredentialsSupportedObject -//struct CredentialsSupportedObjectType: Codable { -// var credentialsSupported: CredentialSupportedObject? -// -// enum CodingKeys: String, CodingKey { -// case credentialsSupported = "credentials_supported" -// } -//} // MARK: - CredentialObj public struct CredentialSupportedObject { @@ -95,7 +81,6 @@ public struct CredentialSupportedObject { } } } - } public struct DisplayElement { @@ -118,10 +103,6 @@ public struct IssuerCredentialDefinition { } } -//enum Format: String, Codable { -// case jwtVc = "jwt_vc" -//} - // MARK: - DataSharing public struct DataSharing { public var format, scope: String? @@ -160,22 +141,24 @@ public struct CredentialsSupportedObjectDisplay { } // MARK: - Cover -public struct DisplayCover{ - public var url: String? +public struct DisplayCover: Codable { + public var uri: String? public var altText: String? + public var url: String? init(from: DisplayCoverResponse) { - url = from.url + uri = from.uri altText = from.altText + url = from.url } public init(mUrl: String?, mAltText: String?) { - url = mUrl + uri = mUrl altText = mAltText + url = mUrl } } - public struct IssuerWellKnownConfiguration { public let credentialIssuer: String? public let authorizationServer: String? @@ -234,4 +217,3 @@ public struct IssuerWellKnownConfiguration { credentialsSupported = nil } } - diff --git a/Sources/eudiWalletOidcIos/Model/IssuerWellKnownConfigurationResponse.swift b/Sources/eudiWalletOidcIos/Model/IssuerWellKnownConfigurationResponse.swift index b8f7201..f890e2c 100644 --- a/Sources/eudiWalletOidcIos/Model/IssuerWellKnownConfigurationResponse.swift +++ b/Sources/eudiWalletOidcIos/Model/IssuerWellKnownConfigurationResponse.swift @@ -8,13 +8,25 @@ import Foundation // MARK: - IssuerWellKnownConfiguration -struct DisplayResponse: Codable { +public struct DisplayResponse: Codable { let name: String? let location: String? let locale: String? let description: String? - var cover, logo: DisplayCoverResponse? + var cover, logo, bgImage: DisplayCoverResponse? var backgroundColor, textColor: String? + + enum CodingKeys: String, CodingKey { + case name = "name" + case location = "location" + case locale = "locale" + case description = "display" + case cover = "cover" + case logo = "logo" + case bgImage = "background_image" + case backgroundColor = "background_color" + case textColor = "text_color" + } } struct TrustFrameworkInIssuerResponse: Codable { let name: String? @@ -143,10 +155,12 @@ struct IssuerCredentialDefinitionResponse: Codable { // MARK: - Cover struct DisplayCoverResponse: Codable { var url: String? + var uri: String? var altText: String? enum CodingKeys: String, CodingKey { case url + case uri case altText = "alt_text" } } @@ -200,5 +214,3 @@ public struct IssuerWellKnownConfigurationResponse: Codable { } } } - -