-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from OpSecId/pstlouis/fix-statuslist
Pstlouis/fix statuslist
- Loading branch information
Showing
17 changed files
with
727 additions
and
432 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Traceability Controller | ||
TRACEABILITY_CONTROLLER_DOMAIN='' | ||
|
||
# Traction | ||
TRACTION_API_URL='https://traction-sandbox-tenant-proxy.apps.silver.devops.gov.bc.ca' | ||
TRACTION_TENANT_ID='' | ||
TRACTION_API_KEY='' | ||
|
||
# Temporary verifier agent endpoint | ||
# until next release (Aca-py admin v0.11) | ||
VERIFIER_ENDPOINT='http://verifier-agent:8020' | ||
|
||
# Postgres | ||
POSTGRES_URI='postgres://postgres:postgres@postgres:5432' | ||
POSTGRES_USER='postgres' | ||
POSTGRES_PASSWORD='postgres' | ||
|
||
# Letsencrypt | ||
LETSENCRYPT_EMAIL='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
version: '3' | ||
services: | ||
|
||
agent: | ||
image: bcgovimages/aries-cloudagent:py3.9-indy-1.16.0_0.12.0rc2 | ||
ports: | ||
- 8020:8020 | ||
entrypoint: ["aca-py", "start"] | ||
command: [ | ||
'--no-ledger', | ||
'--admin', '0.0.0.0', '8020', | ||
'--admin-insecure-mode', | ||
'--endpoint', 'http://agent:8021', | ||
'--outbound-transport', 'http', | ||
'--inbound-transport', 'http', '0.0.0.0', '8021' | ||
] | ||
|
||
postgres: | ||
image: postgres:16-alpine | ||
ports: | ||
- 5432:5432 | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_USER: ${POSTGRES_USER} | ||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} | ||
|
||
traceability-api: | ||
image: patstlouis91/traceability-controller:interop-0.0.1 | ||
# build: | ||
# context: ./traceability-controller | ||
ports: | ||
- 8000:8000 | ||
entrypoint: ["python", "main.py"] | ||
environment: | ||
POSTGRES_URI: ${POSTGRES_URI} | ||
TRACTION_API_KEY: ${TRACTION_API_KEY} | ||
TRACTION_TENANT_ID: ${TRACTION_TENANT_ID} | ||
TRACTION_API_ENDPOINT: ${TRACTION_API_ENDPOINT} | ||
VERIFIER_ENDPOINT: ${VERIFIER_ENDPOINT} | ||
TRACEABILITY_CONTROLLER_DOMAIN: ${TRACEABILITY_CONTROLLER_DOMAIN} | ||
labels: | ||
- traefik.enable=true | ||
- traefik.http.routers.traceability-api.rule=Host(`${TRACEABILITY_CONTROLLER_DOMAIN}`) | ||
- traefik.http.routers.traceability-api.entrypoints=websecure | ||
- traefik.http.routers.traceability-api.tls.certresolver=myresolver | ||
- traefik.http.services.traceability-api.loadbalancer.server.port=8000 | ||
|
||
traefik: | ||
image: traefik:v2.10 | ||
restart: always | ||
security_opt: | ||
- no-new-privileges:true | ||
command: | ||
- --providers.docker=true | ||
- --providers.docker.exposedbydefault=false | ||
- --entrypoints.websecure.address=:443 | ||
- --certificatesresolvers.myresolver.acme.tlschallenge=true | ||
- --certificatesresolvers.myresolver.acme.email=${LETSENCRYPT_EMAIL} | ||
- --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json | ||
ports: | ||
- 443:443 | ||
volumes: | ||
- letsencrypt:/letsencrypt | ||
- /var/run/docker.sock:/var/run/docker.sock:ro | ||
|
||
volumes: | ||
postgres_data: | ||
letsencrypt: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM python:3.11-slim | ||
|
||
WORKDIR /traceability-controller | ||
|
||
ENV VIRTUAL_ENV=/opt/venv | ||
RUN python3 -m venv $VIRTUAL_ENV | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
|
||
COPY requirements.txt ./ | ||
|
||
RUN pip install --upgrade pip | ||
RUN pip install -r requirements.txt | ||
|
||
COPY app ./app | ||
COPY app config.py main.py ./ | ||
|
||
CMD [ "python", "main.py" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import json | ||
from aries_askar import Store, error | ||
from config import settings | ||
import time | ||
from app.validations import ValidationException | ||
from app.utils import did_from_label | ||
from app.controllers.askar import AskarController | ||
|
||
|
||
|
||
class DidDocumentController: | ||
|
||
def __init__(self, did_label): | ||
self.did_label = did_label | ||
self.id = did_from_label(did_label) | ||
self.context = [ | ||
"https://www.w3.org/ns/did/v1", | ||
"https://w3id.org/security/v2", | ||
"https://w3id.org/traceability/v1" | ||
] | ||
self.verification_method = [] | ||
self.authentication = [] | ||
self.assertion_method = [] | ||
service = { | ||
'id': f'{self.id}#traceability-api', | ||
'type': ["TraceabilityAPI"], | ||
'serviceEndpoint': f'{settings.HTTPS_BASE}/{settings.DID_NAMESPACE}/{did_label}' | ||
} | ||
self.service = [service] | ||
|
||
async def add_verkey(self): | ||
verification_method = { | ||
'id': f'{self.id}#verkey', | ||
'type': 'Ed25519VerificationKey2018', | ||
'controller': self.id, | ||
'publicKeyBase58': await AskarController(self.did_label).fetch('verkey') | ||
} | ||
self.verification_method = [verification_method] | ||
self.authentication = [verification_method['id']] | ||
self.assertion_method = [verification_method['id']] | ||
|
||
def as_json(self): | ||
return { | ||
'@context': self.context, | ||
'id': self.id, | ||
'verificationMethod': self.verification_method, | ||
'authentication': self.authentication, | ||
'assertionMethod': self.assertion_method, | ||
'service': self.service, | ||
} |
Oops, something went wrong.