Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename to DataTrails #15

Merged
merged 4 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
shell: bash
- name: Run integrity checks
run: |
pycodestyle --format=pylint rkvst_simplehash unittests
python3 -m pylint rkvst_simplehash unittests
black rkvst_simplehash unittests
pycodestyle --format=pylint datatrails_simplehash unittests
python3 -m pylint datatrails_simplehash unittests
black datatrails_simplehash unittests
modified=$(git status -s | wc -l)
if [ $modified -gt 0 ]
then
Expand All @@ -39,6 +39,6 @@ jobs:
./scripts/unittests.sh
rm -f coverage.xml
rm -rf htmlcov
coverage run --branch --source rkvst_simplehash -m unittest -v
coverage run --branch --source datatrails_simplehash -m unittest -v
shell: bash

2 changes: 1 addition & 1 deletion Dockerfile-builder
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN python3 -m pip install --upgrade pip \
ENV USER=builder
ENV HOME=/home/${USER}
ENV PATH=${HOME}/.local/bin:${PATH}
ENV PYTHONPATH=${HOME}/rkvst_simplehash:${PYTHONPATH}
ENV PYTHONPATH=${HOME}/datatrails_simplehash:${PYTHONPATH}
RUN mkdir -p ${HOME}
WORKDIR ${HOME}

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

MIT License

Copyright (c) 2022 RKVST
Copyright (c) 2023 DataTrails

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
70 changes: 35 additions & 35 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

.. _readme:

RKVST Simplehash in python
============================
DataTrails Simplehash in python
=================================

Prescribed python code that defines the hashing algorithm for DLT Anchoring.

Expand All @@ -25,14 +25,14 @@ Use standard python pip utility:

.. code:: bash

python3 -m pip install rkvst-simplehash
python3 -m pip install datatrails-simplehash

If your version of python3 is too old an error of this type or similar will be emitted:

.. note::

ERROR: Could not find a version that satisfies the requirement rkvst-simplehash (from versions: none)
ERROR: No matching distribution found for rkvst-simplehash
ERROR: Could not find a version that satisfies the requirement datatrails-simplehash (from versions: none)
ERROR: No matching distribution found for datatrails-simplehash

Which Version
===============
Expand All @@ -41,13 +41,13 @@ To Determine which version of the simple hash script to use, i.e. simplehashv1 o
look at the response from the `v1alpha2/blockchain` list api and correlate the version with the `hash_schema_version`
in the `simple_hash_details` section.

Alternatively look for the SimpleHashInfo section in the rkvst app, found on the transaction page
Alternatively look for the SimpleHashInfo section in the datatrails app, found on the transaction page
of a simple hash event, and correlate the version with `schema_version`.

Examples
==========

You can then use the code to recreate the simple hash of a list of SIMPLE_HASH events from RKVST.
You can then use the code to recreate the simple hash of a list of SIMPLE_HASH events from DataTrails.

Importing in own code
------------------------
Expand All @@ -60,7 +60,7 @@ Permissioned Assets V1
"""From a list of events.
"""

from rkvst_simplehash.v1 import (
from datatrails_simplehash.v1 import (
anchor_events,
SimpleHashError,
)
Expand All @@ -72,7 +72,7 @@ Permissioned Assets V1
# if any pending events a SimpleHashPendingEventFound error will be thrown
# if any of the events do not contain the required field then a SimpleHashFieldMissing error will be thrown
api_query = (
"https://app.rkvst.io"
"https://app.datatrails.ai"
"/archivist/v2/assets/-/events"
"?proof_mechanism=SIMPLE_HASH"
"&timestamp_accepted_since=2022-10-07T07:01:34Z"
Expand All @@ -95,7 +95,7 @@ Permissioned Assets V2
"""From a list of events.
"""

from rkvst_simplehash.v2 import (
from datatrails_simplehash.v2 import (
anchor_events,
SimpleHashError,
)
Expand All @@ -107,7 +107,7 @@ Permissioned Assets V2
# if any pending events a SimpleHashPendingEventFound error will be thrown
# if any of the events do not contain the required field then a SimpleHashFieldMissing error will be thrown
api_query = (
"https://app.rkvst.io"
"https://app.datatrails.ai"
"/archivist/v2/assets/-/events"
"?proof_mechanism=SIMPLE_HASH"
"&timestamp_accepted_since=2022-10-07T07:01:34Z"
Expand All @@ -130,7 +130,7 @@ Public Assets V1
"""From a list of events.
"""

from rkvst_simplehash.v1 import (
from datatrails_simplehash.v1 import (
anchor_events,
SimpleHashError,
)
Expand All @@ -139,7 +139,7 @@ Public Assets V1
# if any pending events a SimpleHashPendingEventFound error will be thrown
# if any of the events do not contain the required field then a SimpleHashFieldMissing error will be thrown
api_query = (
"https://app.rkvst.io"
"https://app.datatrails.ai"
"/archivist/v2/publicassets/-/events"
"?proof_mechanism=SIMPLE_HASH"
"&timestamp_accepted_since=2022-10-07T07:01:34Z"
Expand All @@ -162,7 +162,7 @@ Public Assets V2
"""From a list of events.
"""

from rkvst_simplehash.v2 import (
from datatrails_simplehash.v2 import (
anchor_events,
SimpleHashError,
)
Expand All @@ -171,7 +171,7 @@ Public Assets V2
# if any pending events a SimpleHashPendingEventFound error will be thrown
# if any of the events do not contain the required field then a SimpleHashFieldMissing error will be thrown
api_query = (
"https://app.rkvst.io"
"https://app.datatrails.ai"
"/archivist/v2/publicassets/-/events"
"?proof_mechanism=SIMPLE_HASH"
"&timestamp_accepted_since=2022-10-07T07:01:34Z"
Expand Down Expand Up @@ -207,16 +207,16 @@ Using an auth token directly and for permissioned assets
#
python3 -m venv simplehash-venv
source simplehash-venv/bin/activate
python3 -m pip install -q rkvst_simplehash
python3 -m pip install -q datatrails_simplehash

api_query="https://app.rkvst.io"
api_query="https://app.datatrails.ai"
api_query+="/archivist/v2/assets/-/events"
api_query+="?proof_mechanism=SIMPLE_HASH"
api_query+="&timestamp_accepted_since=2022-10-07T07:01:34Z"
api_query+="&timestamp_accepted_before=2022-10-16T13:14:56Z"
api_query+="&order_by=SIMPLEHASHV1"

rkvst_simplehashv1 \
datatrails_simplehashv1 \
--auth-token-file "credentials/token" \
"${api_query}"

Expand All @@ -231,16 +231,16 @@ Or for schema version 2:
#
python3 -m venv simplehash-venv
source simplehash-venv/bin/activate
python3 -m pip install -q rkvst_simplehash
python3 -m pip install -q datatrails_simplehash

api_query="https://app.rkvst.io"
api_query="https://app.datatrails.ai"
api_query+="/archivist/v2/assets/-/events"
api_query+="?proof_mechanism=SIMPLE_HASH"
api_query+="&timestamp_accepted_since=2022-10-07T07:01:34Z"
api_query+="&timestamp_accepted_before=2022-10-16T13:14:56Z"
api_query+="&order_by=SIMPLEHASHV1"

rkvst_simplehashv2 \
datatrails_simplehashv2 \
--auth-token-file "credentials/token" \
"${api_query}"

Expand All @@ -256,17 +256,17 @@ Using a client id and secret and for permissioned assets
#
python3 -m venv simplehash-venv
source simplehash-venv/bin/activate
python3 -m pip install -q rkvst_simplehash
python3 -m pip install -q datatrails_simplehash

api_query="https://app.rkvst.io"
api_query="https://app.datatrails.ai"
api_query+="/archivist/v2/assets/-/events"
api_query+="?proof_mechanism=SIMPLE_HASH"
api_query+="&timestamp_accepted_since=2022-10-07T07:01:34Z"
api_query+="&timestamp_accepted_before=2022-10-16T13:14:56Z"
api_query+="&order_by=SIMPLEHASHV1"

CLIENT_ID=$(cat credentials/client_id)
rkvst_simplehashv1 \
datatrails_simplehashv1 \
--client-id "${CLIENT_ID}" \
--client-secret-file "credentials/client_secret" \
"${api_query}"
Expand All @@ -282,17 +282,17 @@ Or for schema version 2:
#
python3 -m venv simplehash-venv
source simplehash-venv/bin/activate
python3 -m pip install -q rkvst_simplehash
python3 -m pip install -q datatrails_simplehash

api_query="https://app.rkvst.io"
api_query="https://app.datatrails.ai"
api_query+="/archivist/v2/assets/-/events"
api_query+="?proof_mechanism=SIMPLE_HASH"
api_query+="&timestamp_accepted_since=2022-10-07T07:01:34Z"
api_query+="&timestamp_accepted_before=2022-10-16T13:14:56Z"
api_query+="&order_by=SIMPLEHASHV1"

CLIENT_ID=$(cat credentials/client_id)
rkvst_simplehashv2 \
datatrails_simplehashv2 \
--client-id "${CLIENT_ID}" \
--client-secret-file "credentials/client_secret" \
"${api_query}"
Expand All @@ -309,21 +309,21 @@ Querying the public assets (does not require authentication)
#
python3 -m venv simplehash-venv
source simplehash-venv/bin/activate
python3 -m pip install -q rkvst_simplehash
python3 -m pip install -q datatrails_simplehash

start_time = "2022-11-16T00:00:00Z"
end_time = "2022-11-17T00:00:00Z"
rkvst_url = "https://app.rkvst.io"
datatrails_url = "https://app.datatrails.ai"
endpoint = "archivist/v2/publicassets/-/events"

api_query="https://app.rkvst.io"
api_query="https://app.datatrails.ai"
api_query+="/archivist/v2/publicassets/-/events"
api_query+="?proof_mechanism=SIMPLE_HASH"
api_query+="&timestamp_accepted_since=2022-10-07T07:01:34Z"
api_query+="&timestamp_accepted_before=2022-10-16T13:14:56Z"
api_query+="&order_by=SIMPLEHASHV1"

rkvst_simplehashv1 "${api_query}"
datatrails_simplehashv1 "${api_query}"

deactivate
rm -rf simplehash-venv
Expand All @@ -336,21 +336,21 @@ Or for schema version 2:
#
python3 -m venv simplehash-venv
source simplehash-venv/bin/activate
python3 -m pip install -q rkvst_simplehash
python3 -m pip install -q datatrails_simplehash

start_time = "2022-11-16T00:00:00Z"
end_time = "2022-11-17T00:00:00Z"
rkvst_url = "https://app.rkvst.io"
datatrails_url = "https://app.datatrails.ai"
endpoint = "archivist/v2/publicassets/-/events"

api_query="https://app.rkvst.io"
api_query="https://app.datatrails.ai"
api_query+="/archivist/v2/publicassets/-/events"
api_query+="?proof_mechanism=SIMPLE_HASH"
api_query+="&timestamp_accepted_since=2022-10-07T07:01:34Z"
api_query+="&timestamp_accepted_before=2022-10-16T13:14:56Z"
api_query+="&order_by=SIMPLEHASHV1"

rkvst_simplehashv2 "${api_query}"
datatrails_simplehashv2 "${api_query}"

deactivate
rm -rf simplehash-venv
6 changes: 3 additions & 3 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ tasks:
desc: Check the style, bug and quality of the code
cmds:
- ./scripts/builder.sh python3 --version
- ./scripts/builder.sh pycodestyle --format=pylint rkvst_simplehash unittests
- ./scripts/builder.sh python3 -m pylint rkvst_simplehash unittests
- ./scripts/builder.sh pycodestyle --format=pylint datatrails_simplehash unittests
- ./scripts/builder.sh python3 -m pylint datatrails_simplehash unittests

clean:
desc: Clean git repo
Expand All @@ -48,7 +48,7 @@ tasks:
format:
desc: Format code using black
cmds:
- ./scripts/builder.sh black rkvst_simplehash unittests
- ./scripts/builder.sh black datatrails_simplehash unittests

functest:
desc: Functionality testing - requires venv
Expand Down
File renamed without changes.
6 changes: 5 additions & 1 deletion rkvst_simplehash/v2.py → datatrails_simplehash/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,11 @@ def main(): # pragma: no cover
parser.add_argument(
"api_query",
type=str,
help=("the api query string in the asset event response."),
help=(
"the api query string in the blockchain response."
" In quotes. e.g. "
'"https://app.datatrails.ai/archivist/v2/publicassets/-/events?order_by=SIMPLEHASHV2"'
),
)

args = parser.parse_args()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fail_under = 100
enabled = true

[tool.pyright]
include = ["rkvst_simplehash"]
include = ["datatrails_simplehash"]

[tool.pylint.main]
# Analyse import fallback blocks. This can be used to support both Python 2 and 3
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ docker build \
--no-cache \
--build-arg VERSION="$1" \
-f Dockerfile-builder \
-t rkvst-simplehash-python-builder .
-t datatrails-simplehash-python-builder .
2 changes: 1 addition & 1 deletion scripts/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ docker run \
-e TEST_CLIENT_SECRET_FILENAME \
-e TEST_DEBUG \
-e TEST_REFRESH_TOKEN \
rkvst-simplehash-python-builder \
datatrails-simplehash-python-builder \
"$@"
Loading
Loading