Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit f5032ee

Browse files
committed
Updated documentation
1 parent c6693f3 commit f5032ee

File tree

3 files changed

+134
-34
lines changed

3 files changed

+134
-34
lines changed

src/oidcmsg/jwt.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,23 @@ def __init__(self, keyjar, iss='', lifetime=0, sign=True, sign_alg='RS256',
1616
self.keyjar = keyjar
1717

1818
def receiver_keys(self, receiver):
19+
"""
20+
Get all the keys I have for a specific entity
21+
22+
:param receiver: The entity ID
23+
:return: A list of keys
24+
"""
1925
return self.keyjar.get_issuer_keys(receiver)
2026

2127
def receivers_keys(self):
28+
"""
29+
Reorganize all the keys in the key jar into a dictionary disregarding
30+
keybundle dependencies. The keys of the dictionary are the isseur IDs
31+
and the values are all the keys that are connected to a specific
32+
issuer.
33+
34+
:return: A dictionary
35+
"""
2236
res = {}
2337
for owner in self.keyjar.owners():
2438
if owner == '':
@@ -28,5 +42,11 @@ def receivers_keys(self):
2842
return res
2943

3044
def my_keys(self, id=''):
45+
"""
46+
My default issuer/entity ID in the key jar is ''
47+
48+
:param id: An entity ID
49+
:return: A list of keys
50+
"""
3151
return self.keyjar.get_issuer_keys(id)
3252

src/oidcmsg/key_bundle.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,8 @@ def _uptodate(self):
391391
def update(self):
392392
"""
393393
Reload the keys if necessary
394-
This is a forced update, will happen even if cache time has not elapsed
394+
This is a forced update, will happen even if cache time has not elapsed.
395+
395396
Replaced keys will be marked as inactive and not removed.
396397
"""
397398
res = True # An update was successful
@@ -466,7 +467,7 @@ def active_keys(self):
466467

467468
def remove_keys_by_type(self, typ):
468469
"""
469-
Remove keys that are of a specific kind or kind and value.
470+
Remove keys that are of a specific type.
470471
471472
:param typ: Type of key (rsa, ec, oct, ..)
472473
"""
@@ -481,7 +482,7 @@ def jwks(self, private=False):
481482
Create a JWKS
482483
483484
:param private: Whether private key information should be included.
484-
:return: A JWKS representation of the keys in this bundle
485+
:return: A JWKS JSON representation of the keys in this bundle
485486
"""
486487
self._uptodate()
487488
keys = list()
@@ -524,7 +525,7 @@ def __len__(self):
524525

525526
def get_key_with_kid(self, kid):
526527
"""
527-
Return the key that as specific key ID (kid)
528+
Return the key that has a specific key ID (kid)
528529
529530
:param kid: The Key ID
530531
:return: The key or None
@@ -544,8 +545,9 @@ def get_key_with_kid(self, kid):
544545

545546
def kids(self):
546547
"""
547-
Return a list of key IDs. Note that list list may be shorter then
548-
the list of keys.
548+
Return a list of key IDs. Note that this list may be shorter then
549+
the list of keys. The reason might be that there are some keys with
550+
no key ID.
549551
550552
:return: A list of all the key IDs that exists in this bundle
551553
"""
@@ -595,6 +597,11 @@ def __contains__(self, key):
595597
return key in self._keys
596598

597599
def copy(self):
600+
"""
601+
Make deep copy of this KeyBundle
602+
603+
:return: The copy
604+
"""
598605
kb = KeyBundle()
599606
kb._keys = self._keys[:]
600607

0 commit comments

Comments
 (0)