chore: code format

This commit is contained in:
Vlad Stan 2023-03-23 10:35:45 +02:00
parent 0ffb158769
commit 619e0f05e2
20 changed files with 121 additions and 81 deletions

View file

@ -7,23 +7,23 @@ class Delegation:
delegator_pubkey: str
delegatee_pubkey: str
event_kind: int
duration_secs: int = 30*24*60 # default to 30 days
duration_secs: int = 30 * 24 * 60 # default to 30 days
signature: str = None # set in PrivateKey.sign_delegation
@property
def expires(self) -> int:
return int(time.time()) + self.duration_secs
@property
def conditions(self) -> str:
return f"kind={self.event_kind}&created_at<{self.expires}"
@property
def delegation_token(self) -> str:
return f"nostr:delegation:{self.delegatee_pubkey}:{self.conditions}"
def get_tag(self) -> list[str]:
""" Called by Event """
"""Called by Event"""
return [
"delegation",
self.delegator_pubkey,