Skip to content

Commit 579bf5d

Browse files
committed
include the unttaged non-normative example
1 parent 5263800 commit 579bf5d

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

draft-ietf-oauth-status-list.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,11 @@ The following additional rules apply:
463463

464464
1. The CWT MAY contain other claims.
465465

466-
2. The CWT MUST be secured using a cryptographic signature or MAC algorithm. Relying Parties MUST reject CWTs with an invalid signature.
466+
1. The CWT MUST be secured using a cryptographic signature or MAC algorithm. Relying Parties MUST reject CWTs with an invalid signature.
467467

468-
3. Relying Parties MUST reject CWTs that are not valid in all other respects per "CBOR Web Token (CWT)" {{RFC8392}}.
468+
1. Relying Parties MUST reject CWTs that are not valid in all other respects per "CBOR Web Token (CWT)" {{RFC8392}}.
469469

470-
4. Application of additional restrictions and policies are at the discretion of the Relying Party.
470+
1. Application of additional restrictions and policies are at the discretion of the Relying Party.
471471

472472
The following is a non-normative example of a Status List Token in CWT format in Hex:
473473

src/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
git+https://github.com/wbond/oscrypto.git@1547f535001ba568b239b8797465536759c742a3
33
# Normal dependencies
44
jwcrypto==1.5.6
5-
cbor2==5.6.2
6-
cwt==2.7.4
5+
cbor2==5.7.1
6+
cwt==3.2.0
77
py_markdown_table==1.3.0

src/status_token.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import json
2-
from datetime import datetime, timedelta
2+
from datetime import UTC, datetime, timedelta
33
from typing import Dict
44

5-
from cbor2 import dumps
5+
from cbor2 import CBORTag, dumps
66
from cwt import COSE, COSEHeaders, COSEKey, CWTClaims
77
from jwcrypto import jwk, jwt
88

@@ -77,7 +77,7 @@ def get(self, pos: int) -> int:
7777

7878
def buildJWT(
7979
self,
80-
iat: datetime = datetime.utcnow(),
80+
iat: datetime = datetime.now(UTC),
8181
exp: datetime | None = None,
8282
ttl: timedelta | None = None,
8383
optional_claims: Dict | None = None,
@@ -115,7 +115,7 @@ def buildJWT(
115115

116116
def buildCWT(
117117
self,
118-
iat: datetime = datetime.utcnow(),
118+
iat: datetime = datetime.now(UTC),
119119
exp: datetime | None = None,
120120
ttl: timedelta | None = None,
121121
optional_claims: Dict | None = None,
@@ -158,10 +158,12 @@ def buildCWT(
158158
# The sender side:
159159
sender = COSE.new()
160160
encoded = sender.encode(
161-
dumps(claims),
162-
key,
161+
payload=dumps(claims),
162+
key=key,
163163
protected=protected_header,
164164
unprotected=unprotected_header,
165165
)
166166

167+
# removes cose_sign1 tag (only 1 byte long for tag 18)
168+
encoded = encoded[1:]
167169
return encoded

0 commit comments

Comments
 (0)