Ejemplo n.º 1
0
    def from_random():
        """ Initializes the object using a random private_key.
            The private key is generated using the system entropy source.

        Returns:
            MachineAuth: Constructed MachineAuth object.
            Returns None if the auth key is not found in the keyring.
        """
        auth_key = PrivateKey.from_random()
        return MachineAuth(auth_key)
Ejemplo n.º 2
0
    def __init__(self, private_key):
        """ Initialize using the provided private_key.

        Args:
            private_key (PrivateKey/str): Private key to use for initializing \
            the object. This can be a PrivateKey object or a base58 \
            encoded string.

        Returns:
            None:
        """
        if private_key:
            if isinstance(private_key, str):  # base58 encoded string
                self.private_key = PrivateKey.from_b58check(private_key)
            else:
                self.private_key = private_key
            self.public_key = self.private_key.public_key
        else:
            self.private_key = None
            self.public_key = None