@@ -33,6 +33,9 @@ PublicKeyProvider: TypeAlias = Union[
3333 Callable [[], PublicKey ], Callable [[int ], PublicKey ]
3434]
3535
36+ class Algorithm :
37+ pass
38+
3639class BiscuitBuilder :
3740 # Create a builder from a datalog snippet and optional parameter values
3841 #
@@ -179,7 +182,7 @@ class Biscuit:
179182 @property
180183 def revocation_ids (self ) -> List [str ]: ...
181184
182- class Authorizer :
185+ class AuthorizerBuilder :
183186 # Create a new authorizer from a datalog snippet and optional parameter values
184187 #
185188 # :param source: a datalog snippet
@@ -193,7 +196,7 @@ class Authorizer:
193196 source : Optional [str ] = None ,
194197 parameters : Parameters = None ,
195198 scope_parameters : ScopeParameters = None ,
196- ) -> Authorizer : ...
199+ ) -> AuthorizerBuilder : ...
197200
198201 # Add code to the builder, using the provided parameters.
199202 #
@@ -250,12 +253,43 @@ class Authorizer:
250253 # :type builder: BlockBuilder
251254 def merge_block (self , builder : BlockBuilder ) -> None : ...
252255
256+ # Take a snapshot of the authorizer builder and return it, base64-encoded
257+ #
258+ # :return: a snapshot as a base64-encoded string
259+ # :rtype: str
260+ def base64_snapshot (self ) -> str : ...
261+
262+ # Take a snapshot of the authorizer builder and return it, as raw bytes
263+ #
264+ # :return: a snapshot as raw bytes
265+ # :rtype: bytes
266+ def raw_snapshot (self ) -> bytes : ...
267+
268+ # Build an authorizer builder from a base64-encoded snapshot
269+ #
270+ # :param input: base64-encoded snapshot
271+ # :type input: str
272+ # :return: the authorizer builder
273+ # :rtype: AuthorizerBuilder
274+ @classmethod
275+ def from_base64_snapshot (cls , input : str ) -> AuthorizerBuilder : ...
276+
277+ # Build an authorizer builder from a snapshot's raw bytes
278+ #
279+ # :param input: raw snapshot bytes
280+ # :type input: bytes
281+ # :return: the authorizer builder
282+ # :rtype: AuthorizerBuilder
283+ @classmethod
284+ def from_raw_snapshot (cls , input : bytes ) -> AuthorizerBuilder : ...
285+
253286 # Add a `Biscuit` to this `Authorizer`
254287 #
255288 # :param token: the token to authorize
256289 # :type token: Biscuit
257- def add_token (self , token : Biscuit ) -> None : ...
290+ def build (self , token : Biscuit ) -> Authorizer : ...
258291
292+ class Authorizer :
259293 # Runs the authorization checks and policies
260294 #
261295 # Returns the index of the matching allow policy, or an error containing the matching deny
@@ -405,12 +439,6 @@ class PublicKey:
405439 # :rtype: list
406440 def to_bytes (self ) -> bytes : ...
407441
408- # Serializes a public key to a hexadecimal string
409- #
410- # :return: the public key bytes (hex-encoded)
411- # :rtype: str
412- def to_hex (self ) -> str : ...
413-
414442 # Deserializes a public key from raw bytes
415443 #
416444 # :param data: the raw bytes
@@ -427,7 +455,7 @@ class PublicKey:
427455 # :return: the public key
428456 # :rtype: PublicKey
429457 @classmethod
430- def from_hex (cls , data : str ) -> PublicKey : ...
458+ def __new__ (cls , data : str ) -> PublicKey : ...
431459
432460# ed25519 private key
433461class PrivateKey :
@@ -437,12 +465,6 @@ class PrivateKey:
437465 # :rtype: list
438466 def to_bytes (self ) -> bytes : ...
439467
440- # Serializes a private key to a hexadecimal string
441- #
442- # :return: the private key bytes (hex-encoded)
443- # :rtype: str
444- def to_hex (self ) -> str : ...
445-
446468 # Deserializes a private key from raw bytes
447469 #
448470 # :param data: the raw bytes
@@ -459,7 +481,7 @@ class PrivateKey:
459481 # :return: the private key
460482 # :rtype: PrivateKey
461483 @classmethod
462- def from_hex (cls , data : str ) -> PrivateKey : ...
484+ def __new__ (cls , data : str ) -> PrivateKey : ...
463485
464486# A single datalog Fact
465487#
0 commit comments