Skip to content

Commit 914ec80

Browse files
committed
Update docs
1 parent 5555158 commit 914ec80

File tree

7 files changed

+65
-50
lines changed

7 files changed

+65
-50
lines changed

docs/requirements.txt

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
alabaster==0.7.12; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
2-
atomicwrites==1.4.0; python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.4.0"
2+
asn1crypto==1.5.1; python_version >= "3.6"
3+
atomicwrites==1.4.1; python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.4.0"
34
attrs==21.4.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
4-
babel==2.10.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
5-
black==22.3.0; python_full_version >= "3.6.2"
6-
blockfrost-python==0.4.4; python_version >= "3.7" and python_version < "4"
5+
babel==2.10.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
6+
black==22.6.0; python_full_version >= "3.6.2"
7+
blockfrost-python==0.5.1; python_version >= "3.7" and python_version < "4"
78
cbor2==5.4.3; python_version >= "3.7"
8-
certifi==2022.5.18.1; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
9-
cffi==1.15.0; python_version >= "3.6"
10-
charset-normalizer==2.0.12; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
9+
certifi==2022.6.15; python_version >= "3.7" and python_version < "4"
10+
certvalidator==0.11.1; python_version >= "3.6"
11+
cffi==1.15.1; python_version >= "3.6"
12+
charset-normalizer==2.1.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
1113
click==8.1.3; python_version >= "3.7" and python_full_version >= "3.6.2"
12-
colorama==0.4.4; sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.6.2" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6") and platform_system == "Windows"
13-
coverage==6.4.1; python_version >= "3.7"
14+
colorama==0.4.5; sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.6.2" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6") and platform_system == "Windows"
15+
cose==0.9.dev8; python_version >= "3.6"
16+
coverage==6.4.2; python_version >= "3.7"
17+
cryptography==37.0.4; python_version >= "3.6"
1418
decorator==5.1.1; python_version >= "3.5"
1519
docutils==0.17.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
20+
ecdsa==0.18.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6"
1621
execnet==1.9.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
1722
flake8==4.0.1; python_version >= "3.6"
18-
flask==2.1.2; python_version >= "3.7"
19-
idna==3.3; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
20-
imagesize==1.3.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
23+
flask==2.1.3; python_version >= "3.7"
24+
idna==3.3; python_version >= "3.7" and python_version < "4"
25+
imagesize==1.4.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
2126
importlib-metadata==4.2.0; python_version < "3.8" and python_version >= "3.7" and python_full_version >= "3.6.2"
2227
iniconfig==1.1.1; python_version >= "3.7"
2328
isort==5.10.1; python_full_version >= "3.6.1" and python_version < "4.0"
@@ -26,10 +31,12 @@ jinja2==3.1.2; python_version >= "3.7" and python_full_version < "3.0.0" or pyth
2631
markupsafe==2.1.1; python_version >= "3.7"
2732
mccabe==0.6.1; python_version >= "3.6"
2833
mypy-extensions==0.4.3; python_full_version >= "3.6.2"
34+
oscrypto==1.3.0; python_version >= "3.6"
2935
packaging==21.3; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
3036
pathspec==0.9.0; python_full_version >= "3.6.2"
3137
platformdirs==2.5.2; python_version >= "3.7" and python_full_version >= "3.6.2"
3238
pluggy==1.0.0; python_version >= "3.7"
39+
pprintpp==0.4.0
3340
py==1.11.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
3441
pycodestyle==2.8.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
3542
pycparser==2.21; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
@@ -42,8 +49,9 @@ pytest-forked==1.4.0; python_version >= "3.6"
4249
pytest-xdist==2.5.0; python_version >= "3.6"
4350
pytest==7.1.2; python_version >= "3.7"
4451
pytz==2022.1; python_version >= "3.6"
45-
requests==2.27.1; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
52+
requests==2.28.1; python_version >= "3.7" and python_version < "4" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6")
4653
retry==0.9.2
54+
six==1.16.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6"
4755
snowballstemmer==2.2.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
4856
sphinx-copybutton==0.5.0; python_version >= "3.6"
4957
sphinx-rtd-theme==1.0.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
@@ -54,11 +62,11 @@ sphinxcontrib-htmlhelp==2.0.0; python_version >= "3.6" and python_full_version <
5462
sphinxcontrib-jsmath==1.0.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
5563
sphinxcontrib-qthelp==1.0.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
5664
sphinxcontrib-serializinghtml==1.1.5; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
57-
tomli==2.0.1; python_version < "3.11" and python_full_version >= "3.6.2" and python_version >= "3.7"
58-
typed-ast==1.5.3; python_version < "3.8" and implementation_name == "cpython" and python_full_version >= "3.6.2" and python_version >= "3.6"
65+
tomli==2.0.1; python_full_version <= "3.11.0a6" and python_full_version >= "3.6.2" and python_version >= "3.7"
66+
typed-ast==1.5.4; python_version < "3.8" and implementation_name == "cpython" and python_full_version >= "3.6.2" and python_version >= "3.6"
5967
typeguard==2.13.3; python_full_version >= "3.5.3"
60-
typing-extensions==4.2.0; python_version < "3.8" and python_full_version >= "3.6.2" and python_version >= "3.7"
61-
urllib3==1.26.9; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.7"
62-
websocket-client==1.3.2; python_version >= "3.7"
63-
werkzeug==2.1.2; python_version >= "3.7"
64-
zipp==3.8.0; python_version < "3.8" and python_version >= "3.7"
68+
typing-extensions==4.3.0; python_version < "3.8" and python_full_version >= "3.6.2" and python_version >= "3.7"
69+
urllib3==1.26.10; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.7"
70+
websocket-client==1.3.3; python_version >= "3.7"
71+
werkzeug==2.2.0; python_version >= "3.7"
72+
zipp==3.8.1; python_version < "3.8" and python_version >= "3.7"

docs/source/api/pycardano.cip.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CIP
2+
=====================
3+
4+
.. automodule:: pycardano.cip.cip8
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ making it a light-weight library that is easy and fast to set up in all kinds of
3434
api/pycardano.address
3535
api/pycardano.backend.base
3636
api/pycardano.certificate
37+
api/pycardano.cip
3738
api/pycardano.coinselection
3839
api/pycardano.exception
3940
api/pycardano.hash

pycardano/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .address import *
44
from .backend import *
55
from .certificate import *
6+
from .cip import *
67
from .coinselection import *
78
from .exception import *
89
from .hash import *

pycardano/cip/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# flake8: noqa
2+
3+
from .cip8 import *

pycardano/cip/cip8.py

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,26 @@
1818
)
1919
from pycardano.network import Network
2020

21+
__all__ = ["sign", "verify"]
22+
2123

2224
def sign(
2325
message: str,
2426
signing_key: SigningKey,
2527
attach_cose_key: bool = False,
2628
network: Network = Network.MAINNET,
2729
) -> Union[str, dict]:
28-
"""
29-
Sign an arbitrary message with a payment key following CIP-0008.
30-
Parameters:
31-
message (str): Message to be signed
32-
signing_key (pycardano.key.SigningKey): Key which is used to sign the message
33-
attach_cose_key (bool): Whether or not to attach the Cose key to the output
34-
Returns:
35-
signed_message (str, dict): a hex-encoded string containing the signed message and verification key.
36-
In the case of attach_cose_key=True, a dict containing the signed message and Cose key.
30+
"""Sign an arbitrary message with a payment key following CIP-0008.
31+
32+
Args:
33+
message (str): Message to be signed
34+
signing_key (SigningKey): Key which is used to sign the message
35+
attach_cose_key (bool): Whether or not to attach the Cose key to the output
36+
network (Network): Network to use for the address generation
37+
38+
Returns:
39+
Union[str, dict]: A hex-encoded string containing the signed message and verification key.
40+
In the case of attach_cose_key=True, a dict containing the signed message and Cose key.
3741
"""
3842

3943
# derive the verification key
@@ -91,18 +95,18 @@ def sign(
9195
def verify(
9296
signed_message: Union[str, dict], attach_cose_key: Optional[bool] = None
9397
) -> dict:
94-
"""
95-
Verify the signature of a COSESign1 message and decode its contents following CIP-0008.
98+
"""Verify the signature of a COSESign1 message and decode its contents following CIP-0008.
9699
Supports messages signed by browser wallets or `Message.sign()`.
97-
Parameters:
98-
signed_message (str, dict): Message to be verified
99-
attach_cose_key (bool, optional): Whether or not the Cose key is included with the signed_message.
100-
This method will try to determine this automatically if not specified.
101-
Usually if `signed_message` is a dict, this should be true.
102-
Returns:
103-
verified (dict): a dict containing whether or not the message is verified, the message contents,
104-
and an Address which was used to sign the message.
105100
101+
Args:
102+
signed_message (Union[str, dict]): Message to be verified
103+
attach_cose_key (Optional[bool]): Whether or not the Cose key is included with the signed_message.
104+
This method will try to determine this automatically if not specified.
105+
Usually if `signed_message` is a dict, this should be true.
106+
107+
Returns:
108+
dict: A dict containing whether or not the message is verified, the message contents,
109+
and an Address which was used to sign the message.
106110
"""
107111

108112
if attach_cose_key is None:

pycardano/utils.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,8 @@
99
from nacl.hash import blake2b
1010

1111
from pycardano.backend.base import ChainContext
12-
from pycardano.hash import (
13-
SCRIPT_DATA_HASH_SIZE,
14-
SCRIPT_HASH_SIZE,
15-
ScriptDataHash,
16-
)
17-
from pycardano.plutus import (
18-
COST_MODELS,
19-
CostModels,
20-
Datum,
21-
Redeemer,
22-
)
12+
from pycardano.hash import SCRIPT_DATA_HASH_SIZE, SCRIPT_HASH_SIZE, ScriptDataHash
13+
from pycardano.plutus import COST_MODELS, CostModels, Datum, Redeemer
2314
from pycardano.serialization import default_encoder
2415
from pycardano.transaction import MultiAsset, TransactionOutput, Value
2516

0 commit comments

Comments
 (0)