Skip to content

Commit

Permalink
Moved schemas in the appropriate directories
Browse files Browse the repository at this point in the history
  • Loading branch information
pderose committed Jul 27, 2023
1 parent eb982e5 commit 09f68b6
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 49 deletions.
32 changes: 1 addition & 31 deletions pyeudiw/oauth2/dpop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,13 @@
import logging
import uuid

from pydantic import BaseModel, HttpUrl
from pyeudiw.jwt import JWSHelper
from pyeudiw.jwt.utils import unpad_jwt_payload, unpad_jwt_header
from pyeudiw.tools.utils import iat_now
from typing import Literal

from pyeudiw.oauth2.schema import (DPoPTokenHeaderSchema, DPoPTokenPayloadSchema)

logger = logging.getLogger("pyeudiw.oauth2.dpop")


class DPoPTokenHeaderSchema(BaseModel):
# header
typ: Literal["dpop+jwt"]
alg: Literal[
"RS256",
"RS384",
"RS512",
"ES256",
"ES384",
"ES512",
"PS256",
"PS384",
"PS512",
]
# TODO - dynamic schema loader if EC or RSA
# jwk: JwkSchema


class DPoPTokenPayloadSchema(BaseModel):
# body
jti: str
htm: Literal["GET", "POST", "get", "post"]
htu: HttpUrl
iat: int
ath: str


class DPoPIssuer:
def __init__(self, htu: str, token: str, private_jwk: dict):
self.token = token
Expand Down
29 changes: 29 additions & 0 deletions pyeudiw/oauth2/schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from pydantic import BaseModel, HttpUrl

from typing import Literal

class DPoPTokenHeaderSchema(BaseModel):
# header
typ: Literal["dpop+jwt"]
alg: Literal[
"RS256",
"RS384",
"RS512",
"ES256",
"ES384",
"ES512",
"PS256",
"PS384",
"PS512",
]
# TODO - dynamic schema loader if EC or RSA
# jwk: JwkSchema


class DPoPTokenPayloadSchema(BaseModel):
# body
jti: str
htm: Literal["GET", "POST", "get", "post"]
htu: HttpUrl
iat: int
ath: str
17 changes: 17 additions & 0 deletions pyeudiw/openid4vp/schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from pydantic import BaseModel

class DescriptorSchema(BaseModel):
id: str
path: str
format: str

class PresentationSubmissionSchema(BaseModel):
definition_id: str
id: str
descriptor_map: list[DescriptorSchema]

class ResponseSchema(BaseModel):
state: str
vp_token: str | list[str]
presentation_submission: PresentationSubmissionSchema

2 changes: 1 addition & 1 deletion pyeudiw/satosa/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from pyeudiw.tools.qr_code import QRCode
from pyeudiw.tools.mobile import is_smartphone
from pyeudiw.tools.utils import iat_now
from pyeudiw.schema import Response as ResponseValidator
from pyeudiw.openid4vp.schema import ResponseSchema as ResponseValidator
from pyeudiw.sd_jwt import verify_sd_jwt


Expand Down
17 changes: 0 additions & 17 deletions pyeudiw/schema/__init__.py

This file was deleted.

0 comments on commit 09f68b6

Please sign in to comment.