def get_file_encryption_wallet(self): try: account = self.get_account() file_encryption_wallet = wallet.create_wallet("MemoryWallet", account["file_encryption_key"], self.logger) return file_encryption_wallet except NotaryException as e: raise NotaryException(e.error_code, "Error getting file encryption key!")
def __init__(self, config_file, password): ''' constructs needed objects Parameters ---------- password : takes the password of the wallet Returns ------- ''' self.config = NotaryConfiguration(config_file) self.logger = log_handlers.get_logger(self.config) self.ssl_verify_mode = self.config.get_ssl_verify_mode() self.wallet = wallet.create_wallet(self.config.get_wallet_type(), password, self.logger) self.secure_message = SecureMessage(self.wallet) self.notary_server = NotaryServer(self.config) self.address = str(self.wallet.get_bitcoin_address())
import log_handlers import test_data config = configuration.NotaryConfiguration('./notaryconfig.ini') if config.is_remote_testing(): notary_url = config.get_remote_server_url() else: notary_url = config.get_local_server_url() requests.packages.urllib3.disable_warnings() logger = log_handlers.get_logger(config) logger.debug("-------------------------ENVIRONMENT--------------------------") logger.debug("Am I Local: %s " % config.is_local_host()) wallet = wallet.create_wallet(config.get_wallet_type(), config.get_key_id(), logger) secure_message = SecureMessage(wallet) ## Test GET pubkey req_pubkey = requests.get(notary_url + '/api/v1/pubkey', verify=config.get_ssl_verify_mode()) data = req_pubkey.json() other_party_public_key = data['public_key'] print data['public_key'] address = str(wallet.get_bitcoin_address()) ## Test POST account print("\nWallet Public Key Hex %s" % wallet.get_public_key_hex()) print("\nWallet Public Key %s" % wallet.get_public_key()) addrfromhex = P2PKHBitcoinAddress.from_pubkey(
import log_handlers import test_data config = configuration.NotaryConfiguration('./notaryconfig.ini') if config.is_remote_testing(): notary_url = config.get_remote_server_url() else: notary_url = config.get_local_server_url() requests.packages.urllib3.disable_warnings() logger = log_handlers.get_logger(config) logger.debug("-------------------------ENVIRONMENT--------------------------") logger.debug("Am I Local: %s " % config.is_local_host()) wallet = wallet.create_wallet(config.get_wallet_type(), config.get_key_id(),logger) secure_message = SecureMessage(wallet) ## Test GET pubkey pubkey_response = requests.get(notary_url+'/api/v1/pubkey', verify=False) data = pubkey_response.json() other_party_public_key_hex = data['public_key'] print data['public_key'] other_party_public_key_decoded = other_party_public_key_hex.decode("hex") other_party_public_key = CPubKey(other_party_public_key_decoded) other_party_address = P2PKHBitcoinAddress.from_pubkey(other_party_public_key) address = str(wallet.get_bitcoin_address()) ## Test GET challenge response = requests.get(notary_url+'/api/v1/challenge/' + address, verify=False)
import wallet import configuration import log_handlers config = configuration.NotaryConfiguration('./notaryconfig.ini') logger = log_handlers.get_logger(config) # wallet = wallet.create_wallet('PlainWallet', keyId, logger=None) wallet = wallet.create_wallet('ServerWallet', config, logger) # wallet = wallet.create_wallet('ClientWallet', keyId, logger=None) print("Wallet: Bitcoin Address %s " % wallet.get_bitcoin_address()) print("Wallet: Private Key WIF %s " % wallet.get_private_key_wif()) print("Wallet: Public Key Hex %s " % wallet.get_public_key_hex())