Skip to content

Commit

Permalink
Remove proof mechanism (#90)
Browse files Browse the repository at this point in the history
Code now uses whatever proof mechanism that is supported by the backend.

AB#9189
  • Loading branch information
eccles authored May 29, 2024
1 parent a6d043e commit d401144
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 27 deletions.
1 change: 0 additions & 1 deletion DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export TEST_ARCHIVIST="https://app.datatrails.ai"
export TEST_AUTHTOKEN_FILENAME=credentials/.auth_token
export TEST_NAMESPACE="unique label"
export TEST_VERBOSE=-v
export TEST_PROOF_MECHANISM="-i SIMPLE_HASH"
```

If TEST_VERBOSE is "-v" debugging output will appear when running the tests.
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,17 @@ export TEST_ARCHIVIST="https://app.datatrails.ai"
export TEST_AUTHTOKEN_FILENAME=credentials/.auth_token
export TEST_NAMESPACE="unique label"
export TEST_VERBOSE=-v
export TEST_PROOF_MECHANISM="--proof-mechanism=SIMPLE_HASH"
```

If TEST_VERBOSE is "-v" debugging output will appear when running the examples. Otherwise leave blank or undefined.

TEST_PROOF_MECHANISM should be "KHIPU" or "SIMPLE_HASH". If unspecified the default is "SIMPLE_HASH"

Windows using Powershell - at the command prompt set values for environment variables:

```bash
$Env:TEST_ARCHIVIST="https://app.datatrails.ai"
$Env:TEST_AUTHTOKEN_FILENAME = '<path of token location>'
$Env:TEST_NAMESPACE = Get-Date -UFormat %s
$Env:TEST_VERBOSE = '-v'
$Env:TEST_PROOF_MECHANISM="--proof-mechanism=SIMPLE_HASH"
```

TEST_NAMESPACE is set to the date and time value in Unix format, thus providing a unique id upon execution.
Expand All @@ -73,7 +69,7 @@ Events are created every execution of an example - currently no check is done if
All examples use a common set of arguments:

```bash
export AUTH="-u $TEST_ARCHIVIST -t $TEST_AUTHTOKEN_FILENAME $TEST_VERBOSE $TEST_PROOF_MECHANISM"
export AUTH="-u $TEST_ARCHIVIST -t $TEST_AUTHTOKEN_FILENAME $TEST_VERBOSE"
export ARGS="$AUTH --namespace $TEST_NAMESPACE"
```

Expand Down
1 change: 0 additions & 1 deletion archivist_samples/sample_scripts/c2pa/c2pa_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from archivist.logger import set_logger
from archivist.archivist import Archivist
from archivist.proof_mechanism import ProofMechanism
from archivist.utils import get_auth

import time
Expand Down
18 changes: 1 addition & 17 deletions archivist_samples/testing/archivist_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from archivist.archivist import Archivist
from archivist.logger import set_logger
from archivist.proof_mechanism import ProofMechanism

LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -72,16 +71,6 @@ def common_parser(description):
default="https://app.datatrails.ai",
help="url of Archivist service",
)
parser.add_argument(
"-p",
"--proof-mechanism",
type=ProofMechanism,
action=EnumAction,
dest="proof_mechanism",
default=ProofMechanism.SIMPLE_HASH,
help="mechanism for proving the evidence for events on the Asset",
)

parser.add_argument(
"-t",
"--auth-token",
Expand All @@ -104,17 +93,12 @@ def endpoint(args):

arch = None
LOGGER.info("Initialising connection to DataTrails...")
fixtures = {
"assets": {
"proof_mechanism": args.proof_mechanism.name,
},
}

if args.auth_token_file:
with open(args.auth_token_file, mode="r", encoding="utf-8") as tokenfile:
authtoken = tokenfile.read().strip()

arch = Archivist(args.url, authtoken, fixtures=fixtures)
arch = Archivist(args.url, authtoken)

if arch is None:
LOGGER.error("Critical error. Aborting.")
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ pyyaml~=6.0.1
# the following lines. Also do similar in the Dockerfile.
# That way one can test an unreleased version of github datatrails-samples.
# NB dont forget to uncomment before merging !!
datatrails-archivist==0.30.0
datatrails-archivist==0.31.0
1 change: 0 additions & 1 deletion scripts/api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ docker run \
-e TEST_NAMESPACE \
-e TEST_SELECTOR \
-e TEST_VERBOSE \
-e TEST_PROOF_MECHANISM \
-e GITHUB_REF \
-e TWINE_USERNAME \
-e TWINE_PASSWORD \
Expand Down
2 changes: 1 addition & 1 deletion scripts/samples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ do
done

export PYTHONWARNINGS="ignore:Unverified HTTPS request"
ARGS="-u $TEST_ARCHIVIST -t $TEST_AUTHTOKEN_FILENAME $TEST_VERBOSE $TEST_PROOF_MECHANISM"
ARGS="-u $TEST_ARCHIVIST -t $TEST_AUTHTOKEN_FILENAME $TEST_VERBOSE"

# namespacing ensures that each run of the tests is independent.
if [ -n "$TEST_NAMESPACE" ]
Expand Down

0 comments on commit d401144

Please sign in to comment.