This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61937aa
commit 8245011
Showing
5 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,5 @@ fun Application.module() { | |
history() | ||
account() | ||
nfts() | ||
issuers() | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/id/walt/usecases/issuers/IssuerCredentialDataTransferObject.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package id.walt.usecases.issuers | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class IssuerCredentialDataTransferObject( | ||
val type: String, | ||
val uiEndpoint: String, | ||
val callbackUrl: String, | ||
) |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/id/walt/usecases/issuers/IssuerDataTransferObject.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package id.walt.usecases.issuers | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class IssuerDataTransferObject( | ||
val name: String, | ||
val description: String = "no description", | ||
) |
13 changes: 13 additions & 0 deletions
13
src/main/kotlin/id/walt/usecases/issuers/IssuersUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package id.walt.usecases.issuers | ||
|
||
class IssuersUseCase { | ||
fun list(){ | ||
TODO() | ||
} | ||
|
||
fun supportedCredentials(issuer: String){ | ||
TODO() | ||
} | ||
|
||
|
||
} |
77 changes: 77 additions & 0 deletions
77
src/main/kotlin/id/walt/web/controllers/IssuersController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package id.walt.web.controllers | ||
|
||
import id.walt.usecases.issuers.IssuerCredentialDataTransferObject | ||
import id.walt.usecases.issuers.IssuerDataTransferObject | ||
import io.github.smiley4.ktorswaggerui.dsl.get | ||
import io.github.smiley4.ktorswaggerui.dsl.route | ||
import io.ktor.http.* | ||
import io.ktor.server.application.* | ||
import io.ktor.server.response.* | ||
|
||
fun Application.issuers() = walletRoute { | ||
route("issuers", { | ||
tags = listOf("Issuers") | ||
}) { | ||
get({ | ||
summary = "List issuers" | ||
response { | ||
HttpStatusCode.OK to { | ||
description = "Array of issuer objects" | ||
body<List<IssuerDataTransferObject>>() | ||
} | ||
} | ||
}) { | ||
context.respond(mockIssuersList()) | ||
} | ||
route("{issuer}/credentials", { | ||
request { | ||
pathParameter<String>("issuer") { | ||
description = "The issuer name" | ||
example = "walt.id" | ||
} | ||
} | ||
}) { | ||
get({ | ||
summary = "Show supported credentials for the given issuer" | ||
|
||
response { | ||
HttpStatusCode.OK to { | ||
description = "Array of issuer credential objects" | ||
body<List<IssuerCredentialDataTransferObject>>() | ||
} | ||
} | ||
}) { | ||
context.respond(mockCredentialsList()) | ||
} | ||
} | ||
} | ||
} | ||
|
||
internal fun mockIssuersList() = listOf( | ||
IssuerDataTransferObject( | ||
name = "walt.id", | ||
description = "walt.id issuer portal", | ||
), | ||
IssuerDataTransferObject( | ||
name = "walt-test#cloud", | ||
description = "walt-test.cloud issuer portal", | ||
), | ||
) | ||
|
||
internal fun mockCredentialsList() = listOf( | ||
IssuerCredentialDataTransferObject( | ||
type = "PermanentResidentCard", | ||
uiEndpoint = "https://portal.walt.id", | ||
callbackUrl = "https://wallet.portal.walt.id", | ||
), | ||
IssuerCredentialDataTransferObject( | ||
type = "VerifiableAttestation", | ||
uiEndpoint = "https://portal.walt.id", | ||
callbackUrl = "https://wallet.portal.walt.id", | ||
), | ||
IssuerCredentialDataTransferObject( | ||
type = "OpenBadgeCredential", | ||
uiEndpoint = "https://portal.walt.id", | ||
callbackUrl = "https://wallet.portal.walt.id", | ||
), | ||
) |