Skip to content

Commit 1bd812b

Browse files
John Hartleyeccles
authored andcommitted
Rename storage integrity to proof mechanism
Problem: Upstream the storage integrity option was renamed t proof mechanism with more options. Solution: Change name and enumerated values correspondingly Signed-off-by: Paul Hewlett <phewlett76@gmail.com>
1 parent 3666fe2 commit 1bd812b

16 files changed

Lines changed: 145 additions & 106 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ htmlcov/
1313
.eggs/
1414
.task/
1515
*.pyi
16-
.vscode
16+
.vscode

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ One can then use the examples code to create assets (see examples directory):
2626
2727
from archivist.archivist import Archivist
2828
from archivist.errors import ArchivistError
29-
from archivist.storage_integrity import StorageIntegrity
29+
from archivist.proof_mechanism import ProofMechanism
3030
3131
# Oauth2 token that grants access
3232
with open(".auth_token", mode='r') as tokenfile:
@@ -57,11 +57,11 @@ One can then use the examples code to create assets (see examples directory):
5757
}
5858
#
5959
# store asset on the DLT or not. If DLT is not enabled for the user an error will occur if
60-
# StorageIntegrity.LEDGER is specified. If unspecified then TENANT_STORAGE is used
60+
# ProofMechanism.KHIPU is specified. If unspecified then SIMPLE_HASH is used
6161
# i.e. not stored on the DLT...
62-
# storage_integrity = StorageIntegrity.TENANT_STORAGE
62+
# proof_mechanism = ProofMechanism.KHIPU
6363
props = {
64-
"storage_integrity": StorageIntegrity.LEDGER.name,
64+
"proof_mechanism": ProofMechanism.KHIPU.name,
6565
}
6666
6767
# The first argument is the properties of the asset

archivist/archivist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
IAM subjects and IAM access policies.
1212
1313
Instantiation of this class encapsulates the URL and authentication
14-
parameters (the max_time paramater is optional):
14+
parameters (the max_time parameter is optional):
1515
1616
.. code-block:: python
1717

archivist/assets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def create(
132132
Creates asset with defined properties and attributes.
133133
134134
Args:
135-
props (dict): Properties - usually only the storage_integrity setting
135+
props (dict): Properties - usually only the proof_mechanism setting
136136
attrs (dict): attributes of created asset.
137137
confirm (bool): if True wait for asset to be confirmed.
138138

archivist/parser.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from .archivist import Archivist
1414
from .logger import set_logger
15-
from .storage_integrity import StorageIntegrity
15+
from .proof_mechanism import ProofMechanism
1616

1717
LOGGER = logging.getLogger(__name__)
1818

@@ -70,13 +70,13 @@ def common_parser(description):
7070
help="location of Archivist service",
7171
)
7272
parser.add_argument(
73-
"-i",
74-
"--storage-integrity",
75-
type=StorageIntegrity,
73+
"-p",
74+
"--proof-mechanism",
75+
type=ProofMechanism,
7676
action=EnumAction,
77-
dest="storage_integrity",
78-
default=StorageIntegrity.TENANT_STORAGE,
79-
help="Assets will be created on the ledger or on tenant storage",
77+
dest="proof_mechanism",
78+
default=ProofMechanism.SIMPLE_HASH,
79+
help="mechanism for proving the evidence for events on the Asset",
8080
)
8181

8282
security = parser.add_mutually_exclusive_group(required=True)
@@ -114,7 +114,7 @@ def endpoint(args):
114114
LOGGER.info("Initialising connection to Jitsuin Archivist...")
115115
fixtures = {
116116
"assets": {
117-
"storage_integrity": args.storage_integrity.name,
117+
"proof_mechanism": args.proof_mechanism.name,
118118
},
119119
}
120120

archivist/proof_mechanism.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Archivist Proof Mechanism
2+
3+
Enumerated type that allows user to select the proof_mechanism option when
4+
creating an asset.
5+
6+
"""
7+
8+
from enum import Enum
9+
10+
11+
class ProofMechanism(Enum):
12+
"""Enumerate proof mechanism options"""
13+
14+
#: Assets and events are proven using Jitsuin Khipus on the ledger
15+
KHIPU = 1
16+
#: Assets and events are proven using a hash of the originator's evidence
17+
SIMPLE_HASH = 2

archivist/storage_integrity.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

docs/fixtures.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ and locations.
1212
1313
from archivist.archivist import Archivist
1414
from archivist.errors import ArchivistError
15-
from archivist.storage_integrity import StorageIntegrity
15+
from archivist.proof_mechanism import ProofMechanism
1616
1717
# Oauth2 token that grants access
1818
with open(".auth_token", mode='r') as tokenfile:
@@ -24,7 +24,7 @@ and locations.
2424
auth=authtoken,
2525
fixtures = {
2626
"assets": {
27-
"storage_integrity": StorageIntegrity.LEDGER.name,
27+
"proof_mechanism": ProofMechanism.KHIPU.name,
2828
}
2929
},
3030
)

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Jitsuin Archivist
99
.. include:: ../README.rst
1010

1111
.. toctree::
12+
:hidden:
1213
:maxdepth: 2
1314
:caption: Contents:
1415

@@ -25,7 +26,7 @@ Jitsuin Archivist
2526

2627
timestamp
2728
errors
28-
storage_integrity
29+
proof_mechanism
2930

3031
Indices and tables
3132
==================

docs/proof_mechanism.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
.. _proof_mechanism:
3+
4+
Proof Mechanism
5+
---------------
6+
7+
8+
.. automodule:: archivist.proof_mechanism
9+
:members:
10+

0 commit comments

Comments
 (0)