Esempio n. 1
0
    def generate_account(self, name):
        seed, pubkey = generate_pair()
        address = Address(pubkey).bech32()

        pem_file = f"{name}_{address}.pem"
        pem_file = path.join(self.folder, pem_file)
        pem.write(pem_file, seed, pubkey, name=f"{name}:{address}")
Esempio n. 2
0
    def test_generate_pair_pem(self):
        seed, pubkey = generate_pair()
        pem_file = Path(self.testdata_out, "foo.pem")
        pem.write(pem_file, seed, pubkey)
        parsed_seed, parsed_pubkey = pem.parse(pem_file)

        self.assertEqual(seed, parsed_seed)
        self.assertEqual(pubkey, parsed_pubkey)
Esempio n. 3
0
def generate_pem(args):
    pem_file = args.pem
    mnemonic = args.mnemonic

    seed, pubkey = wallet.generate_pair()
    if mnemonic:
        seed, pubkey = wallet.derive_keys(mnemonic)

    address = Address(pubkey)
    pem.write(pem_file, seed, pubkey, name=address.bech32())
    logger.info(f"Created PEM file [{pem_file}] for [{address.bech32()}]")
Esempio n. 4
0
def generate_pem(args: Any):
    pem_file = args.pem
    mnemonic = args.mnemonic
    index = args.index

    seed, pubkey = wallet.generate_pair()
    if mnemonic:
        mnemonic = input("Enter mnemonic:\n")
        mnemonic = mnemonic.strip()
        seed, pubkey = wallet.derive_keys(mnemonic, index)

    address = Address(pubkey)
    pem.write(pem_file, seed, pubkey, name=address.bech32())
    logger.info(f"Created PEM file [{pem_file}] for [{address.bech32()}]")