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

Dev/robin/9530 end to end scitt #23

Merged
merged 77 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
bc0e5e7
Initial re-org
Oct 31, 2024
335247d
restructured create statement scripts and functions
Oct 31, 2024
cb64941
register statement script working
Oct 31, 2024
a19a4a3
update the create statement tests
Oct 31, 2024
238b837
code: formatting
Oct 31, 2024
1f85761
add ci for every push
Oct 31, 2024
280b19d
linter fixes
Oct 31, 2024
a8bd6c7
ci: linter stuff
Oct 31, 2024
3c09231
temporarily disable the format checks
Oct 31, 2024
b52ba19
ci: grinding
Oct 31, 2024
5d79e28
ci: grinding
Oct 31, 2024
5f98294
ci: grinding
Oct 31, 2024
fef6569
remove python 3.10 from the matrix
Oct 31, 2024
e29a67a
add end to end create, register and verify test
Oct 31, 2024
052adfa
formatting
Oct 31, 2024
9c7918a
ci: env vars
Oct 31, 2024
fe13629
make the e2e subject and issuer more obvious
Oct 31, 2024
de7a6fd
ci: env vars again
Oct 31, 2024
9754c99
ci: demo workflow
Oct 31, 2024
e8db970
ci: registration demo workflow
Oct 31, 2024
6c944fa
ci: registration demo workflow
Oct 31, 2024
fd94e7a
ci: workflow demo
Oct 31, 2024
11b0bd4
ci: workflow demo
Oct 31, 2024
7e9c630
ci: workflow demo
Oct 31, 2024
314c82e
ci: workflow demo
Oct 31, 2024
049cab1
ci: workflow demo
Oct 31, 2024
b2d8254
ci: workflow demo
Nov 1, 2024
ab27020
ci: workflow demo
Nov 1, 2024
0e32392
Update the readme & clean up the manual workflows
Nov 1, 2024
fbd1d3c
rename top level package scitt -> datatrails_scitt_samples
Nov 1, 2024
3ca696a
wheel packaging, ruff replaces pylint etc
Nov 1, 2024
2e37bf3
add wheel explicitly to the dev deps
Nov 1, 2024
fe60166
packaging and package testing
Nov 1, 2024
83019b8
Full end to end test building and installing the package
Nov 1, 2024
4d6cee3
ci: workflow grinding
Nov 1, 2024
8cfbd82
ci: workflow grinding
Nov 1, 2024
a66687f
improve telemetry for failed auth
Nov 1, 2024
145a448
ci: workflow grinding
Nov 1, 2024
8966a32
ci: workflow grinding
Nov 1, 2024
0a7d22c
ci: workflow grinding
Nov 1, 2024
4c95813
ci: workflow grinding
Nov 1, 2024
e4ed9fa
ci: workflow grinding
Nov 1, 2024
14f4aa2
ci: workflow grinding
Nov 1, 2024
7067d58
ci: workflow grinding
Nov 1, 2024
30786c5
ci: workflow grinding
Nov 1, 2024
2cf5ed2
ci: workflow grinding
Nov 1, 2024
571e225
ci: workflow grinding
Nov 1, 2024
563a78d
ci: workflow grinding
Nov 1, 2024
f60aa90
ci: workflow grinding
Nov 1, 2024
56cf8e4
ci: workflow grinding
Nov 1, 2024
da73335
ci: workflow grinding
Nov 1, 2024
2bb47ba
ci: workflow grinding
Nov 1, 2024
1b01ea8
ci: workflow grinding
Nov 1, 2024
6c5c8c9
ci: workflow grinding
Nov 1, 2024
a1c7bd4
ci: workflow grinding
Nov 1, 2024
dbd370e
ci: workflow grinding
Nov 1, 2024
09d7491
ci: workflow grinding
Nov 1, 2024
2ddb983
ci: workflow grinding
Nov 1, 2024
83e27e4
ci: workflow grinding
Nov 1, 2024
5e96869
Add meta-map, update cose-hash-envelope
SteveLasker Nov 1, 2024
a9b1af4
test fixup
SteveLasker Nov 1, 2024
08f501b
ruff fix
SteveLasker Nov 1, 2024
e1d1d05
Test fixup
SteveLasker Nov 2, 2024
5315a82
Test fixup
SteveLasker Nov 2, 2024
8bbcd92
Test fixup
SteveLasker Nov 2, 2024
328e471
Test fixup
SteveLasker Nov 2, 2024
865ecc8
test fixup
SteveLasker Nov 2, 2024
08c6b3a
fixup command lines for the registration-demo
Nov 2, 2024
711d1e2
fix: payload must be encoded to bytes before creating the statement
Nov 2, 2024
c96a979
accomodate the remote signing use case
Nov 2, 2024
af7ab42
Add test to illustrate the remote signing case
Nov 2, 2024
7fee562
ci: re-enable windows
Nov 13, 2024
32faeca
ci: re-disable windows
Nov 13, 2024
f55d110
tmp is incompatible with windows
Nov 13, 2024
6970389
venv/bin is venv/Scripts on windows
Nov 13, 2024
66d378d
venv/bin is venv/Scripts on windows
Nov 13, 2024
c4e426e
spelling
SteveLasker Nov 13, 2024
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
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python Quality Control

on: [push]

jobs:
build:
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12" ]
# reduced matrix for ci
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-dev.txt
shell: bash
- name: Run integrity checks
run: |
pycodestyle --format=pylint scitt unittests
python3 -m pylint scitt unittests
python3 -m black scitt unittests
modified=$(git status -s | wc -l)
if [ $modified -gt 0 ]
then
echo "there are $modified files that must be reformatted"
echo "DISABLED guard due to mismatch with local environment"
# exit 1
fi
python3 -m unittest
shell: bash
- name: Run type-hint checks
if: ${{ matrix.python-version != '3.12' }}
run: |
python3 -m pyright --stats scitt
shell: bash
- uses: pypa/[email protected]
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
# GHSA-wj6h-64fc-37mp - python-ecdsa will not be fixed by maintainers
ignore-vulns: |
GHSA-wj6h-64fc-37mp
inputs: requirements.txt


7 changes: 4 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: ["3.11", "3.12" ]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -28,12 +28,13 @@ jobs:
run: |
pycodestyle --format=pylint scitt unittests
python3 -m pylint scitt unittests
black scitt unittests
python3 -m black scitt unittests
modified=$(git status -s | wc -l)
if [ $modified -gt 0 ]
then
echo "there are $modified files that must be reformatted"
exit 1
echo "DISABLED guard due to mismatch with local environment"
# exit 1
fi
python3 -m unittest
shell: bash
Expand Down
19 changes: 14 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
venv/*
*.csr
*.egg-info
*.pem
*.sig
.env.*
.envrc
.vscode/launch.json
my-signing-key.pem
payload.json
signed-statement.txt
scitt-signing-key.pem
payload.txt
receipt.cbor
scitt-receipt.txt
scitt-signing-key.pem
scitt/artifacts/_manifest/*
my-signing-key.pem
receipt.cbor
signed-statement.cbor
signed-statement.txt
transparent-statement.cbor
venv/*
verified_payload.txt
115 changes: 115 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# NOTICE: If you are familiar with the python eco system you may ignore this file
# Otherwise, it offers some minimal workflow automation using https://taskfile.dev/
version: '3'
vars:
VENV_DIR: scitt
# Put this in the root of the repo for vscode autodection
VENV_DIR: venv

PACKAGE_NAME: scitt

tasks:

install:dev:
desc: Install the package in development mode (in the virtual environment)
deps:
- task: venv
cmds:
- |
set -e
source {{.VENV_DIR}}/bin/activate
python -m pip install -e .

audit:
desc: Audit the code
deps:
- task: venv
cmds:
- |
set -e
source {{.VENV_DIR}}/bin/activate

pip-audit -r requirements.txt

deactivate

check:
desc: Check the style, bug and quality of the code
deps:
- task: venv
cmds:
- |
set -e
source {{.VENV_DIR}}/bin/activate

python3 --version
pycodestyle --format=pylint {{ .PACKAGE_NAME }} unittests
python3 -m pylint {{ .PACKAGE_NAME }} unittests
python3 -m pyright --stats {{ .PACKAGE_NAME }} unittests

deactivate

clean:
desc: Clean git repo
cmds:
- find -name '*,cover' -type f -delete
- git clean -fdX

format:
desc: Format code using black
deps:
- task: venv
cmds:
- |
set -e
source {{ .VENV_DIR }}/bin/activate

pycodestyle --format=pylint scitt unittests
python3 -m black {{ .PACKAGE_NAME }} unittests

deactivate

test:
desc: Run unittests
deps:
- task: venv
cmds:
- |
set -e
source {{ .VENV_DIR }}/bin/activate

python3 -m unittest

deactivate

venv:
desc: Builds python environment
cmds:
- |
set -e
if [ ! -d {{ .VENV_DIR }} ]
then
python3 -m venv {{ .VENV_DIR }}
source {{ .VENV_DIR }}/bin/activate
python3 -m pip install -qq -r requirements.txt
python3 -m pip install -qq -r requirements-dev.txt
deactivate
fi

wheel:
desc: Builds python wheel package
deps:
- task: venv
cmds:
- |
set -e
source {{ .VENV_DIR }}/bin/activate

python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-dev.txt
python3 -m pip install setuptools wheel
python3 -m build --sdist
python3 -m build --wheel

deactivate

6 changes: 4 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#
pycose~=1.0.1
bencode.py~=4.0.0
ecdsa~=0.18.0
jwcrypto~=1.5.0
requests~=2.32.0
pycose~=1.0.1
pycryptodome~=3.20.0
requests>=2.32.0
1 change: 1 addition & 0 deletions scitt/artifacts/thedroid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name": "R2D2"}
44 changes: 44 additions & 0 deletions scitt/cbor_header_labels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""Definitions of all COSE, SCITT, CBOR labels used by these exmaples """

# CWT header label comes from version 4 of the scitt architecture document
# https://www.ietf.org/archive/id/draft-ietf-scitt-architecture-04.html#name-issuer-identity
HEADER_LABEL_CWT = 13

# subject header label comes from version 2 of the scitt architecture document
# https://www.ietf.org/archive/id/draft-birkholz-scitt-architecture-02.html#name-envelope-and-claim-format
HEADER_LABEL_FEED = 392

# Various CWT header labels come from:
# https://www.rfc-editor.org/rfc/rfc8392.html#section-3.1
HEADER_LABEL_CWT_ISSUER = 1
HEADER_LABEL_CWT_SUBJECT = 2

# CWT CNF header labels come from:
# https://datatracker.ietf.org/doc/html/rfc8747#name-confirmation-claim
HEADER_LABEL_CWT_CNF = 8
HEADER_LABEL_CNF_COSE_KEY = 1

# Signed Hash envelope header labels from:
# https://github.com/OR13/draft-steele-cose-hash-envelope/blob/main/draft-steele-cose-hash-envelope.md
# pre-adoption/private use parameters
# https://www.iana.org/assignments/cose/cose.xhtml#header-parameters
HEADER_LABEL_PAYLOAD_HASH_ALGORITHM = -6800
HEADER_LABEL_LOCATION = -6801

# CBOR Object Signing and Encryption (COSE) "typ" (type) Header Parameter
# https://datatracker.ietf.org/doc/rfc9596/
HEADER_LABEL_TYPE = 16
COSE_TYPE = "application/hashed+cose"

# COSE Receipts headers
# https://cose-wg.github.io/draft-ietf-cose-merkle-tree-proofs/draft-ietf-cose-merkle-tree-proofs.html#name-new-entries-to-the-cose-hea
HEADER_LABEL_DID = 391
HEADER_LABEL_COSE_RECEIPTS_VDS = 395
HEADER_LABEL_COSE_RECEIPTS_VDP = 396
HEADER_LABEL_COSE_RECEIPTS_INCLUSION_PROOFS = -1

# MMRIVER headers
# https://robinbryce.github.io/draft-bryce-cose-merkle-mountain-range-proofs/draft-bryce-cose-merkle-mountain-range-proofs.html#name-receipt-of-inclusion
HEADER_LABEL_MMRIVER_VDS_TREE_ALG = 2
HEADER_LABEL_MMRIVER_INCLUSION_PROOF_INDEX = 1
HEADER_LABEL_MMRIVER_INCLUSION_PROOF_PATH = 2
Loading
Loading