Skip to content

Commit

Permalink
start to fix example (not ended -> first test)
Browse files Browse the repository at this point in the history
  • Loading branch information
floppy31 committed Dec 7, 2017
1 parent c82a5d8 commit 7b4bc3e
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion duniterpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


__author__ = 'Caner Candan & inso & vit'
__version__ = '0.42.1'

This comment has been minimized.

Copy link
@Insoleet

Insoleet Dec 7, 2017

Contributor

Where does this diff comes from ? Master branch and your branch are both on 0.42.2... ?

__version__ = '0.42.2'
__nonsense__ = 'duniter'

from . import api, documents, key
2 changes: 1 addition & 1 deletion duniterpy/api/bma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

__all__ = ['api']

PROTOCOL_VERSION = 2

This comment has been minimized.

Copy link
@Insoleet

Insoleet Dec 7, 2017

Contributor

Same as above.. ?

PROTOCOL_VERSION = 10

import logging

Expand Down
2 changes: 1 addition & 1 deletion duniterpy/key/signing_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions examples/create_and_publish_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# 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 duniter.org 10901"

# Your unique identifier in the Web of Trust
UID = "MyIdentity"
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions examples/request_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# 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"

################################################

Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions examples/save_revoke_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# 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,
Expand All @@ -32,7 +32,7 @@
AIOHTTP_SESSION = aiohttp.ClientSession()

# Current protocole version
PROTOCOL_VERSION = 2
PROTOCOL_VERSION = 10

async def get_identity_document(connection, currency, pubkey):
"""
Expand Down Expand Up @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions examples/send_certification.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# 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"

################################################

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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): ")
Expand Down
5 changes: 3 additions & 2 deletions examples/send_membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# 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"


################################################

Expand Down Expand Up @@ -96,7 +97,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)
Expand Down
4 changes: 2 additions & 2 deletions examples/send_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# 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"


################################################
Expand Down Expand Up @@ -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): ")
Expand Down

1 comment on commit 7b4bc3e

@Insoleet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request, everything seems correct. There are weird diff lines that I can't explain thought...

Please sign in to comment.