Skip to content

Commit

Permalink
Change file names to be in sync with VC ids
Browse files Browse the repository at this point in the history
Signed-off-by: Anja Strunk <[email protected]>
  • Loading branch information
anjastrunk committed Oct 16, 2024
1 parent ba2a008 commit a6040d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
DATA_FILE_FORMAT = "json-ld"

VC_NAME_LOOKUP = {
"lp": "Legal Person",
"legal_person": "Legal Person",
"lrn": "Legal Registration Number",
"tandc": "Gaia-X Terms and Conditions",
"cs_csp": "GXDCH Compliance Service",
"cs_so": "GXDCH Compliance Service",
"csp_compliance": "GXDCH Compliance Service",
"so_compliance": "GXDCH Compliance Service",
"so": "Service Offering",
"vmso": "Virtual Machine Service Offering",
}
Expand Down Expand Up @@ -233,7 +233,6 @@ def create_vmso_vcs(conf: Config, cloud: str, csp_vcs: List[dict], timeout: int
@return: A list of Gaia-X Credentials describing given OpenStack cloud.
"""

print("vsmo called")
csp = conf.get_value([const.CONFIG_CSP])
# iaas = conf.get_value([const.CONFIG_IAAS]) not yet used, as Gaia-X "abuses" id attribute of Verifiable Credentials
cred_settings = conf.get_value([const.CONFIG_CRED])
Expand All @@ -249,7 +248,7 @@ def create_vmso_vcs(conf: Config, cloud: str, csp_vcs: List[dict], timeout: int
vmso_vc = {
'@context': [const.VC_CONTEXT, const.JWS_CONTEXT, const.REG_CONTEXT],
'type': "VerifiableCredential",
'id': cred_settings[const.CONFIG_CRED_BASE_CRED_URL] + "/vmo.json",
'id': cred_settings[const.CONFIG_CRED_BASE_CRED_URL] + "/vmso.json",
'issuer': csp['did'],
'issuanceDate': str(datetime.now(tz=timezone.utc).isoformat()),
'credentialSubject': json.loads(json.dumps(vm_offering, default=json_ld.to_json_ld)),
Expand All @@ -271,7 +270,7 @@ def create_vmso_vcs(conf: Config, cloud: str, csp_vcs: List[dict], timeout: int
"type": "gx:ServiceOffering",
"id": cred_settings[const.CONFIG_CRED_BASE_CRED_URL] + "/so.json#subject", # iaas['did'],
"gx:providedBy": {
'id': csp_vcs['lp']['credentialSubject']['id']
'id': csp_vcs['legal_person']['credentialSubject']['id']
},
"gx:termsAndConditions": [
{'gx:URL': s_tac.url, 'gx:hash': s_tac.hash}
Expand All @@ -293,12 +292,12 @@ def create_vmso_vcs(conf: Config, cloud: str, csp_vcs: List[dict], timeout: int

# Request Gaia-X Compliance Credential for Service Offering
logging.info('Request VC of type "gx:compliance" for Service Offering at GXDCH Compliance Service...')
vp = credentials.convert_to_vp(creds=[csp_vcs['tandc'], csp_vcs['lrn'], csp_vcs['lp'], so_vc_signed])
vp = credentials.convert_to_vp(creds=[csp_vcs['tandc'], csp_vcs['lrn'], csp_vcs['legal_person'], so_vc_signed])
comp_vc = compliance.request_compliance_vc(vp,
cred_settings[const.CONFIG_CRED_BASE_CRED_URL] + "/so_compliance.json")

logging.info('ok')
return {'so': so_vc, 'cs_so': json.loads(comp_vc), 'vmso': vmso_vc_signed, 'vp_so': vp}
return {'so': so_vc, 'so_compliance': json.loads(comp_vc), 'vmso': vmso_vc_signed, 'vp_so': vp}


def _get_timestamp():
Expand Down
2 changes: 1 addition & 1 deletion generator/discovery/csp_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def generate(self) -> dict:
vp = credentials.convert_to_vp(creds=[tandc_vc, lrn_vc, lp_vc])
cs_vc = self.compliance.request_compliance_vc(vp, self.cred_base_url + "/csp_compliance.json")
logging.info('ok')
return {'tandc': tandc_vc, 'lrn': lrn_vc, 'lp': lp_vc, 'cs_csp': json.loads(cs_vc), 'vp_csp': vp}
return {'tandc': tandc_vc, 'lrn': lrn_vc, 'legal_person': lp_vc, 'csp_compliance': json.loads(cs_vc), 'vp_csp': vp}

def _sign_gaia_x_terms_and_conditions(self) -> dict:
"""
Expand Down

0 comments on commit a6040d9

Please sign in to comment.