Skip to content

Commit 5263800

Browse files
committed
Revert "311 cbor tag (#316)"
This reverts commit bb5a467.
1 parent 54aa299 commit 5263800

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

draft-ietf-oauth-status-list.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ The following is a non-normative example of a Status List Token in JWT format:
445445

446446
## Status List Token in CWT Format {#status-list-token-cwt}
447447

448-
The Status List Token MUST be encoded as a "CBOR Web Token (CWT)" according to {{RFC8392}}. The Status List Token MUST not be tagged with the tags defined in section 6 of {{RFC8392}} or in section 2 of {{RFC9052}}.
448+
The Status List Token MUST be encoded as a "CBOR Web Token (CWT)" according to {{RFC8392}}.
449449

450450
The following content applies to the protected header of the CWT:
451451

@@ -463,11 +463,11 @@ The following additional rules apply:
463463

464464
1. The CWT MAY contain other claims.
465465

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

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

470-
1. Application of additional restrictions and policies are at the discretion of the Relying Party.
470+
4. 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.7.1
6-
cwt==3.2.0
5+
cbor2==5.6.2
6+
cwt==2.7.4
77
py_markdown_table==1.3.0

src/status_token.py

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

5-
from cbor2 import CBORTag, dumps
5+
from cbor2 import 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.now(UTC),
80+
iat: datetime = datetime.utcnow(),
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.now(UTC),
118+
iat: datetime = datetime.utcnow(),
119119
exp: datetime | None = None,
120120
ttl: timedelta | None = None,
121121
optional_claims: Dict | None = None,
@@ -158,12 +158,10 @@ def buildCWT(
158158
# The sender side:
159159
sender = COSE.new()
160160
encoded = sender.encode(
161-
payload=dumps(claims),
162-
key=key,
161+
dumps(claims),
162+
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:]
169167
return encoded

0 commit comments

Comments
 (0)