Skip to content

Commit d32c3b5

Browse files
author
Athan Massouras
committed
feat: add test for statusMessage feature
Signed-off-by: Athan Massouras <[email protected]>
1 parent d262be4 commit d32c3b5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/test_bitstring_status_list.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,35 @@ def test_status_message():
121121
bitstring[idx] = 2
122122
for idx in bitstring.take_n(50):
123123
bitstring[idx] = 3
124+
125+
encoded_jwt = bitstring.sign_jwt_enveloping(
126+
signer=trivial_enveloping_signer,
127+
alg="ES256",
128+
kid="12",
129+
status_purpose="revocation",
130+
)
131+
132+
status_message = [
133+
{"status":"0x0", "message":"0"},
134+
{"status":"0x1", "message":"1"},
135+
{"status":"0x2", "message":"2"},
136+
{"status":"0x3", "message":"3"},
137+
]
138+
139+
credential_status = {
140+
"id": "https://example.com/credentials/status/3#94567",
141+
"type": "BitstringStatusListEntry",
142+
"statusPurpose": "revocation",
143+
"statusListIndex": "0",
144+
"statusListCredential": "https://example.com/credentials/status/3"
145+
}
146+
147+
verifier = BitstringStatusListVerifier(credential_status)
148+
verifier.verify_jwt(encoded_jwt, verifier=trivial_enveloping_verifier)
149+
150+
for i in range(bitstring.status_list.size):
151+
assert verifier.get_status(i) == {
152+
"status": bitstring[i],
153+
"valid": not bool(bitstring[i]),
154+
"message": str(bitstring[i]),
155+
}

0 commit comments

Comments
 (0)