@@ -29,6 +29,10 @@ def __init__(self, node: MoeraNode, client_scope: List[Scope] | None = None, adm
2929 target_node_name : str | None = None ):
3030 """
3131 :param node: node to get cartes from
32+ :param client_scope: permissions to be granted to the carte; if not set, all permissions of the carte's owner
33+ are granted
34+ :param admin_scope: additional administrative permissions (of those granted to the carte's owner by the target
35+ node) to be granted to the carte
3236 """
3337 self ._node = node
3438 self ._client_scope = client_scope if client_scope is not None else ["all" ]
@@ -71,8 +75,22 @@ def to_scope_mask(scope: List[Scope]) -> int:
7175
7276
7377def generate_carte (owner_name : str | None , signing_key : ec .EllipticCurvePrivateKey , beginning : Timestamp | None ,
74- address : str | None = None , ttl : int = 600 , node_name : str | None = None ,
78+ ttl : int = 600 , address : str | None = None , node_name : str | None = None ,
7579 client_scope : List [Scope ] | int = SCOPE_VALUES ["all" ], admin_scope : List [Scope ] | int = 0 ) -> str :
80+ """
81+ Generate a carte with the given parameters and sign it with the provided private signing key.
82+
83+ :param owner_name: name of the node authenticating with the carte
84+ :param signing_key: the private signing key to sign the carte
85+ :param beginning: timestamp of the beginning of the carte's life
86+ :param ttl: length of the carte's life, in seconds
87+ :param address: if set, the carte is valid for authentication from the given IP address only
88+ :param node_name: if set, the carte is valid for authentication on the specified node only
89+ :param client_scope: list of permissions granted to the carte
90+ :param admin_scope: list of additional administrative permissions (of those granted to the carte's owner by
91+ the target node) granted to the carte
92+ :return: the carte
93+ """
7694 if isinstance (client_scope , list ):
7795 client_scope = to_scope_mask (client_scope )
7896 if isinstance (admin_scope , list ):
0 commit comments