|
6 | 6 | from aiohttp import ClientSession |
7 | 7 | import json |
8 | 8 |
|
9 | | -from src.bit_array import BitArray, b64url_decode, b64url_encode, dict_to_b64 |
| 9 | +from src.bit_array import BitArray, b64url_decode, dict_to_b64 |
10 | 10 | from src.bitstring_status_list.issuer import MIN_LIST_LENGTH, StatusListLengthError |
11 | 11 |
|
12 | 12 | class EnvelopingTokenVerifier(Protocol): |
@@ -72,6 +72,7 @@ async def retrieve_list( |
72 | 72 | headers: OPTIONAL. Additional headers for the HTTP request. |
73 | 73 |
|
74 | 74 | min_list_length: OPTIONAL. The minimum list length, recommended to be 131,072 (see S. 6.1) |
| 75 | + |
75 | 76 | Returns: |
76 | 77 | An instance of BitstringStatusListVerifier which has been verified for correctness and |
77 | 78 | integrity. |
@@ -114,6 +115,10 @@ def from_jwt( |
114 | 115 | the proof format of the token (embedded or enveloping) |
115 | 116 |
|
116 | 117 | min_list_length: OPTIONAL. The minimum list length, recommended to be 131,072 (see S. 6.1) |
| 118 | + |
| 119 | + Returns: |
| 120 | + An instance of BitstringStatusListVerifier which has been verified for correctness and |
| 121 | + integrity. |
117 | 122 | """ |
118 | 123 | # Check that message is in valid JWT format |
119 | 124 | if isinstance(token, str): |
@@ -179,6 +184,18 @@ def from_jwt( |
179 | 184 | ) |
180 | 185 |
|
181 | 186 | def get_status(self, idx: Optional[int] = None): |
| 187 | + """ |
| 188 | + Returns the status of an object from the status_list in payload. |
| 189 | +
|
| 190 | + Args: |
| 191 | + index: OPTIONAL. The index of the token's status in the list, along with relevant metadata |
| 192 | + as specified in S. 3.2. If none is provided, the index used will be the index found in |
| 193 | + self.credential_status. |
| 194 | + |
| 195 | + Returns: |
| 196 | + The status of the requested token along with relevant metadata. |
| 197 | + """ |
| 198 | + |
182 | 199 | if idx is None: |
183 | 200 | idx = int(self.credential_status["statusListIndex"]) |
184 | 201 |
|
@@ -225,16 +242,18 @@ def serialize_verifier(self) -> dict: |
225 | 242 | @classmethod |
226 | 243 | def deserialize_verifier(cls, seralized_verifier: dict) -> "BitstringStatusListVerifier": |
227 | 244 | """ |
228 | | - Utility function: deserializes a seralized TokenStatusListVerifier, which must be in the |
229 | | - same format as the return type of seralize_verifier. Returns a TokenStatusListVerifier type |
| 245 | + Utility function: deserializes a seralized BitstringStatusListVerifier, which must be in the |
| 246 | + same format as the return type of seralize_verifier. Returns a BitstringStatusListVerifier type |
230 | 247 | with fields populated and the status list stored as a BitArray. |
| 248 | + |
| 249 | + This function DOES NOT check for correctness or integrity. |
231 | 250 |
|
232 | 251 | Args: |
233 | 252 | serialized_verifier: REQUIRED. Serialized verifier type which must be in the same format |
234 | | - as TokenStatusListVerifier.serialize_verifier. |
| 253 | + as BitstringStatusListVerifier.serialize_verifier. |
235 | 254 |
|
236 | 255 | Returns: |
237 | | - A TokenStatusListVerifier instance with relevant fields populated. |
| 256 | + A BitstringStatusListVerifier instance with relevant fields populated. |
238 | 257 | """ |
239 | 258 |
|
240 | 259 | bits = seralized_verifier["credential_status"].get("statusSize") |
|
0 commit comments