Skip to content

Commit

Permalink
Support null fields for metadata
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Jaeger-Freeborn <[email protected]>
  • Loading branch information
Gavinok committed Nov 12, 2024
1 parent e79b965 commit 0e557b0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions oidc-controller/api/routers/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,14 @@ async def get_authorize(request: Request, db: Database = Depends(get_db)):
"wallet_deep_link": wallet_deep_link,
"title": (
ver_config.metadata.title
if ver_config.metadata
if ver_config.metadata and ver_config.metadata.title
else "Scan with a Digital Wallet"
),
"claims": (ver_config.metadata.claims if ver_config.metadata else []),
"claims": (
ver_config.metadata.claims
if ver_config.metadata and ver_config.metadata.claims
else []
),
}

# Prepare the template
Expand Down
8 changes: 4 additions & 4 deletions oidc-controller/api/templates/verified_credentials.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
>&#129144; Go back
</a>
<h1 class="mb-3">{{title}}</h1>
</div>
<div v-if="!mobileDevice" class="ml-12" >
<display-claims :claims="claims"/>
<div v-if="!mobileDevice" class="text-start">
<display-claims class="pl-5" :claims="claims"/>
</div>
</div>
<div class="row">
<div
Expand Down Expand Up @@ -195,7 +195,7 @@ <h1 class="mb-3 fw-bolder fs-1">Continue with:</h1>
</script>

<script type="text/x-template" id="display-claims">
<div v-if="claims.length > 0" class="text-start flex-none">
<div v-if="claims.length > 0" class="flex-none">
The proof request will ask you to prove the following:
<ul>
<li v-for="claim in claims">
Expand Down
4 changes: 2 additions & 2 deletions oidc-controller/api/verificationConfigs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class VerificationProofRequest(BaseModel):


class MetaData(BaseModel):
title: str = Field()
claims: list[str] = Field()
title: str | None = Field(default=None)
claims: list[str] | None = Field(default=None)


class VerificationConfigBase(BaseModel):
Expand Down

0 comments on commit 0e557b0

Please sign in to comment.