Example #1
0
def remove_secret():
    environ[
        "DDDC_CREDENTIAL_ISSUER_CONFIGFILE"
    ] = "/home/travis/build/DECODEproject/dddc-credential-issuer/app/test.ini"
    bc = BaseConfig()
    secret = Path(bc.get("keypair"))
    if secret.is_file():
        secret.unlink()
Example #2
0
import json

from fastapi import Body, HTTPException, APIRouter
from starlette.status import HTTP_404_NOT_FOUND, HTTP_412_PRECONDITION_FAILED

from app.config.config import BaseConfig
from app.database import DBSession
from app.models import AuthorizableAttribute, ValidatedCredentials, Statistics
from app.schema import ValidateAuthorizableAttributeInfoInput
from app.zencontract import ZenContract, CONTRACTS

router = APIRouter()
config = BaseConfig()


def __get_aa(authorizable_attribute_id):
    aa = AuthorizableAttribute.by_aa_id(authorizable_attribute_id)
    if not aa:
        raise HTTPException(status_code=HTTP_404_NOT_FOUND,
                            detail="Authorizable Attribute not found")
    return aa


def __issue_credential(keypair, bsr):
    contract = ZenContract(CONTRACTS.BLIND_SIGN,
                           {"issuer_identifier": config.get("uid")})
    contract.keys(keypair)
    contract.data(bsr)
    return contract.execute()

Example #3
0
import logging

from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declared_attr, declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker

from app.config.config import BaseConfig

config = BaseConfig()

logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger("test")
engine = create_engine(config.get("SQLALCHEMY_DATABASE_URI"),
                       connect_args={"check_same_thread": False})
DBSession = scoped_session(
    sessionmaker(autocommit=False, autoflush=False, bind=engine))


class CustomBase:
    @declared_attr
    def __tablename__(cls):
        return cls.__name__.lower()


Base = declarative_base(cls=CustomBase)
Example #4
0
def test_uid(client):
    config = BaseConfig()
    r = client.get("/uid")
    assert r.json()["credential_issuer_id"]
    assert r.json()["credential_issuer_id"] == config.get("uid")