Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: VP format #215

Merged
merged 6 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions example/satosa/pyeudiw_backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ name: OpenID4VP
config:

ui:
static_storage_url: "https://localhost:9999"
static_storage_url: "https://localhost"
template_folder: "templates" # project root
qrcode_template: "qr_code.html"
error_template: "error.html"
error_url: "https://localhost:9999/error_page.html"
error_url: "https://localhost/error_page.html"

endpoints:
pre_request: '/pre-request'
Expand Down Expand Up @@ -197,7 +197,10 @@ config:
subject_type: pairwise

vp_formats:
jwt_vp_json:
alg:
- EdDSA
- ES256K
vc+sd-jwt:
sd-jwt_alg_values:
- ES256
- ES384
kb-jwt_alg_values:
- ES256
- ES384
4 changes: 2 additions & 2 deletions pyeudiw/federation/schemas/wallet_relying_party.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any, List
from pyeudiw.jwk.schemas.jwk import JwksSchema
from pydantic import BaseModel, HttpUrl, PositiveInt
from pyeudiw.openid4vp.schemas import VPFormat
from pyeudiw.openid4vp.schemas.vp_formats import VpFormats
from pyeudiw.presentation_exchange.schemas.oid4vc_presentation_definition import PresentationDefinition


Expand Down Expand Up @@ -63,4 +63,4 @@ class WalletRelyingParty(BaseModel):
id_token_signed_response_alg: List[SigningAlgValuesSupported]
default_acr_values: List[AcrValuesSupported]
default_max_age: PositiveInt
vp_formats: VPFormat
vp_formats: VpFormats
13 changes: 0 additions & 13 deletions pyeudiw/openid4vp/schemas/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +0,0 @@
from enum import Enum
from typing import List
from pydantic import BaseModel

class VPSigningAlgResponseSupported(str, Enum):
eddsa = "EdDSA"
es256k = "ES256K"

class VPAlgorithmSchema(BaseModel):
alg: List[VPSigningAlgResponseSupported]

class VPFormat(BaseModel):
jwt_vp_json: VPAlgorithmSchema
21 changes: 21 additions & 0 deletions pyeudiw/openid4vp/schemas/vp_formats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from enum import Enum
from typing import List
from pydantic import BaseModel, Field


class Algorithms(Enum):
es256 = "ES256"
es384 = "ES384"
es512 = "ES512"
rs256 = "RS256"
rs384 = "RS384"
rs512 = "RS512"


class VcSdJwt(BaseModel):
sd_jwt_alg_values: List[Algorithms] = Field([], alias='sd-jwt_alg_values')
kb_jwt_alg_values: List[Algorithms] = Field([], alias='kb-jwt_alg_values')


class VpFormats(BaseModel):
vc_sd_jwt: VcSdJwt = Field(..., alias='vc+sd-jwt')
13 changes: 8 additions & 5 deletions pyeudiw/tests/federation/schemas/test_entity_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@
"https://www.spid.gov.it/SpidL2",
"https://www.spid.gov.it/SpidL3"
],

"vp_formats": {
"jwt_vp_json": {
"alg": [
"EdDSA",
"ES256K"
"vc+sd-jwt": {
"sd-jwt_alg_values": [
"ES256",
"ES384"
],
"kb-jwt_alg_values": [
"ES256",
"ES384"
]
}
},
Expand Down
13 changes: 10 additions & 3 deletions pyeudiw/tests/federation/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,16 @@
'id_token_encrypted_response_enc': ["A128CBC-HS256"],
'id_token_signed_response_alg': ["ES256"],
'default_max_age': 5000,
'vp_formats': {
'jwt_vp_json': {
'alg': ["EdDSA"]
"vp_formats": {
"vc+sd-jwt": {
"sd-jwt_alg_values": [
"ES256",
"ES384"
],
"kb-jwt_alg_values": [
"ES256",
"ES384"
]
}
},
'policy_uri': ''
Expand Down
12 changes: 8 additions & 4 deletions pyeudiw/tests/openid4vp/schemas/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,14 @@ def test_entity_config_payload():
"https://www.spid.gov.it/SpidL3"
],
"vp_formats": {
"jwt_vp_json": {
"alg": [
"EdDSA",
"ES256K"
"vc+sd-jwt": {
"sd-jwt_alg_values": [
"ES256",
"ES384"
],
"kb-jwt_alg_values": [
"ES256",
"ES384"
]
}
},
Expand Down
12 changes: 8 additions & 4 deletions pyeudiw/tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,14 @@
"require_auth_time": True,
"subject_type": "pairwise",
"vp_formats": {
"jwt_vp_json": {
"alg": [
"EdDSA",
"ES256K"
"vc+sd-jwt": {
"sd-jwt_alg_values": [
"ES256",
"ES384"
],
"kb-jwt_alg_values": [
"ES256",
"ES384"
]
}
}
Expand Down
Loading