Skip to content

Commit

Permalink
Added policy listing endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
waltkb committed Oct 27, 2023
1 parent a4549ff commit 829ac3d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ object PolicyManager {
"webhook"
*/

fun listPolicyDescriptions() = mappedPolicies.mapValues { it.value.description }

fun registerPolicies(vararg policies: VerificationPolicy) {
policies.forEach { policy ->
if (mappedPolicies.containsKey(policy.name))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package id.walt.verifier

import id.walt.credentials.verification.PolicyManager
import id.walt.credentials.verification.models.PolicyRequest
import id.walt.credentials.verification.models.PolicyRequest.Companion.parsePolicyRequests
import id.walt.credentials.verification.policies.JwtSignaturePolicy
Expand Down Expand Up @@ -249,6 +250,13 @@ fun Application.verfierApi() {
call.respond(HttpStatusCode.NotFound)
}
}
get("policy-list", {
tags = listOf("Credential Verification")
summary = "List registered policies"
response { HttpStatusCode.OK to { body<Map<String, String?>>() } }
}) {
call.respond(PolicyManager.listPolicyDescriptions())
}
}
}
}

0 comments on commit 829ac3d

Please sign in to comment.