mirror of https://gitlab.com/bashrc2/epicyon
Add fep context
parent
2370e8c99b
commit
626862a3d6
28
context.py
28
context.py
|
@ -25,7 +25,8 @@ VALID_CONTEXTS = (
|
||||||
"*/vc-data-integrity/contexts/multikey/v1.jsonld",
|
"*/vc-data-integrity/contexts/multikey/v1.jsonld",
|
||||||
"https://w3id.org/security/data-integrity/v1",
|
"https://w3id.org/security/data-integrity/v1",
|
||||||
"*/contexts/data-integrity/v1.jsonld",
|
"*/contexts/data-integrity/v1.jsonld",
|
||||||
"*/ns/privacyHeaders"
|
"*/ns/privacyHeaders",
|
||||||
|
"https://w3id.org/fep/*"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,8 +70,19 @@ def _has_valid_context_list(post_json_object: {}) -> bool:
|
||||||
wildcard_found = False
|
wildcard_found = False
|
||||||
for cont in VALID_CONTEXTS:
|
for cont in VALID_CONTEXTS:
|
||||||
if cont.startswith('*'):
|
if cont.startswith('*'):
|
||||||
|
cont = cont.replace('*', '', 1)
|
||||||
|
if not cont.endswith('*'):
|
||||||
|
if url.endswith(cont):
|
||||||
|
wildcard_found = True
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
cont = cont.replace('*', '')
|
||||||
|
if cont in url:
|
||||||
|
wildcard_found = True
|
||||||
|
break
|
||||||
|
elif cont.endswith('*'):
|
||||||
cont = cont.replace('*', '')
|
cont = cont.replace('*', '')
|
||||||
if url.endswith(cont):
|
if cont in url:
|
||||||
wildcard_found = True
|
wildcard_found = True
|
||||||
break
|
break
|
||||||
if not wildcard_found:
|
if not wildcard_found:
|
||||||
|
@ -87,10 +99,20 @@ def _has_valid_context_str(post_json_object: {}) -> bool:
|
||||||
wildcard_found = False
|
wildcard_found = False
|
||||||
for cont in VALID_CONTEXTS:
|
for cont in VALID_CONTEXTS:
|
||||||
if cont.startswith('*'):
|
if cont.startswith('*'):
|
||||||
cont = cont.replace('*', '')
|
cont = cont.replace('*', '', 1)
|
||||||
if url.endswith(cont):
|
if url.endswith(cont):
|
||||||
wildcard_found = True
|
wildcard_found = True
|
||||||
break
|
break
|
||||||
|
if cont.endswith('*'):
|
||||||
|
cont = cont.replace('*', '')
|
||||||
|
if cont in url:
|
||||||
|
wildcard_found = True
|
||||||
|
break
|
||||||
|
elif cont.endswith('*'):
|
||||||
|
cont = cont.replace('*', '')
|
||||||
|
if cont in url:
|
||||||
|
wildcard_found = True
|
||||||
|
break
|
||||||
if not wildcard_found:
|
if not wildcard_found:
|
||||||
print('Unrecognized @context 2: ' + url)
|
print('Unrecognized @context 2: ' + url)
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue