diff --git a/duniterpy/key/signing_key.py b/duniterpy/key/signing_key.py index 04be55b5d2bc1850bdfcc79771728c01c967d46a..3c0e4c2363c2edd8f43cc4b4ff27978372d28879 100644 --- a/duniterpy/key/signing_key.py +++ b/duniterpy/key/signing_key.py @@ -26,7 +26,7 @@ def _ensure_bytes(data): class SigningKey(libnacl.sign.Signer): - def __init__(self, salt, password, scrypt_params): + def __init__(self, salt, password, scrypt_params=ScryptParams(4096,16,1)): salt = _ensure_bytes(salt) password = _ensure_bytes(password) seed = scrypt(password, salt, diff --git a/examples/create_and_publish_identity.py b/examples/create_and_publish_identity.py index 597f12b4fd95148131324f319c226c630a2f6566..fd1082d7c802bcde3e589fbda288d92b87f078ba 100644 --- a/examples/create_and_publish_identity.py +++ b/examples/create_and_publish_identity.py @@ -12,7 +12,7 @@ from duniterpy.key import SigningKey # You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] # or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] # Here we use the BASIC_MERKLED_API -BMA_ENDPOINT = "BASIC_MERKLED_API cgeek.fr 9330" +BMA_ENDPOINT = "BASIC_MERKLED_API g1.duniter.org 10901" # Your unique identifier in the Web of Trust UID = "MyIdentity" @@ -43,7 +43,7 @@ def get_identity_document(current_block, uid, salt, password): # create identity document identity = Identity( - version=2, + version=10, currency=current_block['currency'], pubkey=key.pubkey, uid=uid, @@ -56,13 +56,14 @@ def get_identity_document(current_block, uid, salt, password): return identity + async def main(): """ Main code """ # connection handler from BMA endpoint - connection = BMAEndpoint.from_inline(BMA_ENDPOINT).conn_handler(AIOHTTP_SESSION) + connection = next(BMAEndpoint.from_inline(BMA_ENDPOINT).conn_handler(AIOHTTP_SESSION)) # capture current block to get version and currency and blockstamp current_block = await bma.blockchain.current(connection) diff --git a/examples/request_data.py b/examples/request_data.py index 4817e57eddb22fe81450f28b2177c21acfc898bf..5e3df5abe749a4180fad6fae4226bb0f6840ea96 100644 --- a/examples/request_data.py +++ b/examples/request_data.py @@ -8,7 +8,7 @@ from duniterpy.documents import BMAEndpoint # You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] # or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] # Here we use the BASIC_MERKLED_API -BMA_ENDPOINT = "BASIC_MERKLED_API cgeek.fr 9330" +BMA_ENDPOINT = "BASIC_MERKLED_API g1.duniter.org 10901" ################################################ @@ -21,7 +21,7 @@ async def main(): Main code """ # connection handler from BMA endpoint - connection = BMAEndpoint.from_inline(BMA_ENDPOINT).conn_handler(AIOHTTP_SESSION) + connection = next(BMAEndpoint.from_inline(BMA_ENDPOINT).conn_handler(AIOHTTP_SESSION)) # Get the node summary infos response = await bma.node.summary(connection) diff --git a/examples/save_revoke_document.py b/examples/save_revoke_document.py index aa156debe2c1de215330bbb3b64a6cf92bafa4a8..a8e309ba70d0098021462140d0b68344cc139993 100644 --- a/examples/save_revoke_document.py +++ b/examples/save_revoke_document.py @@ -21,7 +21,7 @@ else: # You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] # or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] # Here we use the BASIC_MERKLED_API -BMA_ENDPOINT = "BASIC_MERKLED_API cgeek.fr 9330" +BMA_ENDPOINT = "BASIC_MERKLED_API g1.duniter.org 10901" # WARNING : Hide this file in a safe and secure place # If one day you forget your credentials, @@ -31,8 +31,8 @@ REVOKE_DOCUMENT_FILE_PATH = os.path.join(home_path, "duniter_account_revoke_docu ################################################ AIOHTTP_SESSION = aiohttp.ClientSession() -# Current protocole version -PROTOCOL_VERSION = 2 +# Current protocol version +PROTOCOL_VERSION = 10 async def get_identity_document(connection, currency, pubkey): """ @@ -112,7 +112,7 @@ async def main(): exit(0) # connection handler from BMA endpoint - connection = BMAEndpoint.from_inline(BMA_ENDPOINT).conn_handler(AIOHTTP_SESSION) + connection = next(BMAEndpoint.from_inline(BMA_ENDPOINT).conn_handler(AIOHTTP_SESSION)) # capture current block to get currency name current_block = await bma.blockchain.current(connection) diff --git a/examples/send_certification.py b/examples/send_certification.py index b200c6ce6eed091e7b18208f61de08616c5b8e16..59a15cb6cf5fdd24159436ba656edb3275cc533c 100644 --- a/examples/send_certification.py +++ b/examples/send_certification.py @@ -11,7 +11,7 @@ from duniterpy.key import SigningKey # You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] # or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] # Here we use the BASIC_MERKLED_API -BMA_ENDPOINT = "BASIC_MERKLED_API cgeek.fr 9330" +BMA_ENDPOINT = "BASIC_MERKLED_API g1.duniter.org 10901" ################################################ @@ -49,7 +49,7 @@ async def get_identity_document(connection, current_block, pubkey): # return self-certification document return Identity( - version=2, + version=10, currency=current_block['currency'], pubkey=pubkey, uid=uid, @@ -72,7 +72,7 @@ def get_certification_document(current_block, self_cert_document, from_pubkey, s """ # construct Certification Document certification = Certification( - version=2, + version=10, currency=current_block['currency'], pubkey_from=from_pubkey, pubkey_to=self_cert_document.pubkey, @@ -90,7 +90,7 @@ async def main(): Main code """ # connection handler from BMA endpoint - connection = BMAEndpoint.from_inline(BMA_ENDPOINT).conn_handler(AIOHTTP_SESSION) + connection = next(BMAEndpoint.from_inline(BMA_ENDPOINT).conn_handler(AIOHTTP_SESSION)) # prompt hidden user entry salt = getpass.getpass("Enter your passphrase (salt): ") diff --git a/examples/send_membership.py b/examples/send_membership.py index f4e9f9673232c46647c3eb5d406b71c0ffc4fae7..a2ee6813737e33a9d7f8f12620a4731eef590d85 100644 --- a/examples/send_membership.py +++ b/examples/send_membership.py @@ -12,7 +12,7 @@ from duniterpy.key import SigningKey # You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] # or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] # Here we use the BASIC_MERKLED_API -BMA_ENDPOINT = "BASIC_MERKLED_API cgeek.fr 9330" +BMA_ENDPOINT = "BASIC_MERKLED_API g1.duniter.org 10901" ################################################ @@ -96,7 +96,7 @@ async def main(): Main code """ # connection handler from BMA endpoint - connection = BMAEndpoint.from_inline(BMA_ENDPOINT).conn_handler(AIOHTTP_SESSION) + connection = next(BMAEndpoint.from_inline(BMA_ENDPOINT).conn_handler(AIOHTTP_SESSION)) # capture current block to get version and currency and blockstamp current_block = await bma.blockchain.current(connection) diff --git a/examples/send_transaction.py b/examples/send_transaction.py index 172491efd740d2bbb8e9d4deedd9e2288c3b17e4..778527d9475733fd613bc31e133a2f5794224372 100644 --- a/examples/send_transaction.py +++ b/examples/send_transaction.py @@ -13,7 +13,7 @@ from duniterpy.key import SigningKey # You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] # or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] # Here we use the BASIC_MERKLED_API -BMA_ENDPOINT = "BASIC_MERKLED_API cgeek.fr 9330" +BMA_ENDPOINT = "BASIC_MERKLED_API g1.duniter.org 10901" ################################################ @@ -94,7 +94,7 @@ async def main(): Main code """ # connection handler from BMA endpoint - connection = BMAEndpoint.from_inline(BMA_ENDPOINT).conn_handler(AIOHTTP_SESSION) + connection = next(BMAEndpoint.from_inline(BMA_ENDPOINT).conn_handler(AIOHTTP_SESSION)) # prompt hidden user entry salt = getpass.getpass("Enter your passphrase (salt): ")