Skip to content

Commit e6afc34

Browse files
Athan Massourasdbluhm
authored andcommitted
fix: fix docstrings
Signed-off-by: Athan Massouras <athan@indicio.tech>
1 parent 25378c0 commit e6afc34

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

src/bitstring_status_list/verifier.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from aiohttp import ClientSession
77
import json
88

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
1010
from src.bitstring_status_list.issuer import MIN_LIST_LENGTH, StatusListLengthError
1111

1212
class EnvelopingTokenVerifier(Protocol):
@@ -72,6 +72,7 @@ async def retrieve_list(
7272
headers: OPTIONAL. Additional headers for the HTTP request.
7373
7474
min_list_length: OPTIONAL. The minimum list length, recommended to be 131,072 (see S. 6.1)
75+
7576
Returns:
7677
An instance of BitstringStatusListVerifier which has been verified for correctness and
7778
integrity.
@@ -114,6 +115,10 @@ def from_jwt(
114115
the proof format of the token (embedded or enveloping)
115116
116117
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.
117122
"""
118123
# Check that message is in valid JWT format
119124
if isinstance(token, str):
@@ -179,6 +184,18 @@ def from_jwt(
179184
)
180185

181186
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+
182199
if idx is None:
183200
idx = int(self.credential_status["statusListIndex"])
184201

@@ -225,16 +242,18 @@ def serialize_verifier(self) -> dict:
225242
@classmethod
226243
def deserialize_verifier(cls, seralized_verifier: dict) -> "BitstringStatusListVerifier":
227244
"""
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
230247
with fields populated and the status list stored as a BitArray.
248+
249+
This function DOES NOT check for correctness or integrity.
231250
232251
Args:
233252
serialized_verifier: REQUIRED. Serialized verifier type which must be in the same format
234-
as TokenStatusListVerifier.serialize_verifier.
253+
as BitstringStatusListVerifier.serialize_verifier.
235254
236255
Returns:
237-
A TokenStatusListVerifier instance with relevant fields populated.
256+
A BitstringStatusListVerifier instance with relevant fields populated.
238257
"""
239258

240259
bits = seralized_verifier["credential_status"].get("statusSize")

src/token_status_list/verifier.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ def from_jwt(
113113
signer in sign_jwt() in issuer.py.
114114
115115
Returns:
116-
An instance of TokenStatusListVerifier with the relevant fields (headers, payload)
117-
filled out.
116+
An instance of TokenStatusListVerifier which has been verified for correctness and
117+
integrity.
118118
"""
119119

120120
# Check that message is in valid JWT format
@@ -190,7 +190,7 @@ def from_cwt(
190190
191191
Returns:
192192
An instance of TokenStatusListVerifier with the relevant fields (headers, payload)
193-
filled out.
193+
populated.
194194
"""
195195

196196
try:
@@ -253,9 +253,7 @@ def from_cwt(
253253

254254
def get_status(self, idx: int) -> int:
255255
"""
256-
Returns the status of an object from the status_list in payload.
257-
Requies that the payload has already been checked using jwt_verify or cwt_verify.
258-
Caches the status list as a BitArray for ease of future reference.
256+
Returns the status of an object from the status_list in payload.
259257
260258
Args:
261259
index: REQUIRED. The index of the token's status in the list.
@@ -298,6 +296,8 @@ def deserialize_verifier(cls, seralized_verifier: dict) -> "TokenStatusListVerif
298296
same format as the return type of seralize_verifier. Returns a TokenStatusListVerifier type
299297
with fields populated and the status list stored as a BitArray.
300298
299+
This function DOES NOT check for correctness or integrity.
300+
301301
Args:
302302
serialized_verifier: REQUIRED. Serialized verifier type which must be in the same format
303303
as TokenStatusListVerifier.serialize_verifier.

0 commit comments

Comments
 (0)