Skip to content

Commit

Permalink
docs to key_roller
Browse files Browse the repository at this point in the history
  • Loading branch information
palandovalex committed Mar 7, 2024
1 parent 68dbbd8 commit e50a15d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion memgpt/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,20 @@

@dataclass
class MemGPTCredentials:
# key_roller functionality
# key_roller functionality with backward compatability
def __getattribute__(self, prop: str):
# exclude processing of all fields except fields with keys
value = super().__getattribute__(prop)
if value is None or prop not in KEY_NAMES:
return value

# the key field stores comma-separated keys
keys = [key for key in value.split(",")]
# calculating the current key number
number = self._key_num
number = number + 1 if number + 1 < len(keys) else 0
self._key_num = number
# key issuance
if len(keys):
return keys[number]
return None
Expand Down

0 comments on commit e50a15d

Please sign in to comment.