Skip to content

Commit

Permalink
Merge pull request #64 from niscy-eudiw/feature/deferred-issuer-updates
Browse files Browse the repository at this point in the history
[fix] deferred issuer fixes
  • Loading branch information
dtsiflit authored Jul 16, 2024
2 parents 7a401b7 + b58747e commit b926a5d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ public struct CredentialIssuerMetadata: Decodable, Equatable {

public init(deferredCredentialEndpoint: CredentialIssuerEndpoint?) throws {
try self.init(
credentialIssuerIdentifier: .init(""),
credentialIssuerIdentifier: .init(Constants.url),
authorizationServers: [],
credentialEndpoint: .init(string: ""),
credentialEndpoint: .init(string: Constants.url),
batchCredentialEndpoint: nil,
deferredCredentialEndpoint: deferredCredentialEndpoint,
notificationEndpoint: nil,
Expand Down
12 changes: 10 additions & 2 deletions Sources/Issuers/Issuer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,16 @@ public extension Issuer {
config: OpenId4VCIConfig
) throws -> Issuer {
try Issuer(
authorizationServerMetadata: .oauth(.init()),
issuerMetadata: .init(deferredCredentialEndpoint: deferredCredentialEndpoint),
authorizationServerMetadata: .oauth(
.init(
authorizationEndpoint: Constants.url,
tokenEndpoint: Constants.url,
pushedAuthorizationRequestEndpoint: Constants.url
)
),
issuerMetadata: .init(
deferredCredentialEndpoint: deferredCredentialEndpoint
),
config: config,
deferredRequesterPoster: deferredRequesterPoster
)
Expand Down
2 changes: 2 additions & 0 deletions Sources/Utilities/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ public struct Constants {

public static let OPENID_SCOPE = "openid"
public static let TX_CODE_PARAM = "tx_code"

public static let url = "https://a.bc"
}
15 changes: 13 additions & 2 deletions Tests/Issue/IssuanceFlowsTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,18 @@ class IssuanceFlowsTest: XCTestCase {
super.tearDown()
}

func test() throws {

func testDeferredIssuerConstruction() async throws {

let issuer = try Issuer.createDeferredIssuer(
deferredCredentialEndpoint: .init(string: "https://www.example.com"),
deferredRequesterPoster: Poster(),
config: .init(
clientId: .init(),
authFlowRedirectionURI: URL(string: "https://www.example.com")!
)
)

let endPoint = await issuer.issuerMetadata.deferredCredentialEndpoint!.url.absoluteString
XCTAssertEqual(endPoint, "https://www.example.com")
}
}

0 comments on commit b926a5d

Please sign in to comment.