Beispiel #1
0
def init_test_keystore() -> KeyStore:
    """
    Keystore for the tests
    """

    alice_25519_enc_private_key = \
        b'\xde\xa2\xc1\x0b\xd1\xf7\x13\xf8J\xa4:\xa4\xb6\xfa\xbd\xd5\xc9' + \
        b'\x8a\xd9\xb6\xb4\xc4\xc4I\x88\xa4\xd9\xe2\xee\x9e\x9a\xff'
    alice_25519_enc_public_key = \
        b'\x1eO"\n\xdaWnU+\xf5\xaa\x8a#\xd2*\xd3\x11\x9fc\xe52 \xd8^\xbc-' + \
        b'\xb6\xf1\xeej\xf41'

    bob_25519_enc_private_key = \
        b'\xd3\xf0\x8f ,\x1d#\xdc\xac,\x93\xbd\xd0\xd9\xed\x8c\x92\x822' + \
        b'\xef\xd6\x97^\x86\xf7\xe4/\x85\xb6\x10\xe6o'
    bob_25519_enc_public_key = \
        b't\xc5{5j\xb5\x8a\xd3n\xb3\xab9\xe8s^13\xba\xa2\x91x\xb01(\xf9' + \
        b'\xbb\xf9@r_\x91}'

    charlie_25519_enc_private_key = b'zH\xb66q\x97\x0bO\xcb\xb9q\x9b\xbd-1`I' + \
        b'\xae\x00-\x11\xb9\xed}\x18\x9f\xf6\x8dr\xaa\xd4R'
    charlie_25519_enc_public_key = \
        b'u\xe7\x88\x9c\xbfE(\xf8\x99\xca<\xa8[<\xa2\x88m\xad\rN"\xf0}' + \
        b'\xec\xfcB\x89\xe6\x96\xcf\x19U'

    # Alice credentials in the zeth abstraction
    alice_ownership = gen_ownership_keypair()
    alice_encryption = EncryptionKeyPair(
        decode_encryption_secret_key(alice_25519_enc_private_key),
        decode_encryption_public_key(alice_25519_enc_public_key))

    # Bob credentials in the zeth abstraction
    bob_ownership = gen_ownership_keypair()
    bob_encryption = EncryptionKeyPair(
        decode_encryption_secret_key(bob_25519_enc_private_key),
        decode_encryption_public_key(bob_25519_enc_public_key))

    # Charlie credentials in the zeth abstraction
    charlie_ownership = gen_ownership_keypair()
    charlie_encryption = EncryptionKeyPair(
        decode_encryption_secret_key(charlie_25519_enc_private_key),
        decode_encryption_public_key(charlie_25519_enc_public_key))

    return {
        "Alice":
        ZethAddress.from_key_pairs(alice_ownership, alice_encryption),
        "Bob":
        ZethAddress.from_key_pairs(bob_ownership, bob_encryption),
        "Charlie":
        ZethAddress.from_key_pairs(charlie_ownership, charlie_encryption),
    }
Beispiel #2
0
def load_zeth_address(username: str) -> ZethAddress:
    """
    Load a ZethAddress secret from a file, and the associated public address,
    and return as a ZethAddress.
    """
    return ZethAddress.from_secret_public(load_zeth_address_secret(username),
                                          load_zeth_address_public(username))
Beispiel #3
0
def load_zeth_address(ctx: ClientConfig) -> ZethAddress:
    """
    Load a ZethAddress secret from a file, and the associated public address,
    and return as a ZethAddress.
    """
    return ZethAddress.from_secret_public(
        load_zeth_address_secret(ctx),
        load_zeth_address_public(ctx))
Beispiel #4
0
 def deposit(self,
             mk_trees: List[MerkleTree],
             zeth_address: ZethAddress,
             sender_eth_address: str,
             eth_amount: EtherValue,
             outputs: Optional[List[Tuple[ZethAddressPub,
                                          EtherValue]]] = None,
             tx_value: Optional[EtherValue] = None) -> str:
     if not outputs or len(outputs) == 0:
         outputs = [(zeth_address.addr_pk, eth_amount)]
     return self.joinsplit(
         mk_trees,
         sender_ownership_keypair=zeth_address.ownership_keypair(),
         sender_eth_address=sender_eth_address,
         inputs=[],
         outputs=outputs,
         v_in=eth_amount,
         v_out=EtherValue(0),
         tx_value=tx_value)