(self, alg_id, alg_obj)
Registers a new Algorithm for use when creating and verifying tokens.
Registers a new Algorithm for use when creating and verifying tokens.
Registers a new Algorithm for use when creating and verifying tokens .
def register_algorithm(self, alg_id, alg_obj):
        """
        Registers a new Algorithm for use when creating and verifying tokens.
        """
        if alg_id in self._algorithms:
            raise ValueError("Algorithm already has a handler.")

        if not isinstance(alg_obj, Algorithm):
            raise TypeError("Object is not of type `Algorithm`")

        self._algorithms[alg_id] = alg_obj
        self._valid_algs.add(alg_id)
def register_algorithm ( self , alg_id , alg_obj ) : if alg_id in self . _algorithms : raise ValueError ( "Algorithm already has a handler." ) if not isinstance ( alg_obj , Algorithm ) : raise TypeError ( "Object is not of type `Algorithm`" ) self . _algorithms [ alg_id ] = alg_obj self . _valid_algs . add ( alg_id )