Skip to content
Snippets Groups Projects
Commit f898dcf1 authored by Lyuben Penkovski's avatar Lyuben Penkovski
Browse files

Update example policies because of changes for VC/VP proof functions

parent 0bbdb345
Branches
Tags
No related merge requests found
package example.TrustedConnectionCredentials package example.TrustedConnectionCredentials
default allow = true default allow = true
\ No newline at end of file
package example.createProof
_ := proof.create(input)
package example.createProofVC
_ := add_vc_proof("transit", "key1", input)
package example.createProofVP
_ := add_vp_proof("did:web:example.com", "transit", "key1", input)
...@@ -7,22 +7,22 @@ default expired = false ...@@ -7,22 +7,22 @@ default expired = false
default valid = false default valid = false
trusted { trusted {
m := input.issuer m := input.issuer
m in data.trustlist m in data.trustlist
} }
expired { expired {
exp:= time.parse_ns("2006-01-02T15:04:05Z07:00",input.expirationDate) exp:= time.parse_ns("2006-01-02T15:04:05Z07:00",input.expirationDate)
now:=time.now_ns() now:=time.now_ns()
now>exp now>exp
} }
valid = semanticallyValid(input) valid = semanticallyValid(input)
semanticallyValid(i) = res { semanticallyValid(i) = res {
now:=time.now_ns() now:=time.now_ns()
vac:= data.vaccines[i.credentialSubject.vaccine.vacCode].active == true vac:= data.vaccines[i.credentialSubject.vaccine.vacCode].active == true
vacDate:=time.parse_ns("2006-01-02T15:04:05Z07:00",i.credentialSubject.dateOfVaccination) vacDate:=time.parse_ns("2006-01-02T15:04:05Z07:00",i.credentialSubject.dateOfVaccination)
vacStillValid:=now < (vacDate+15552000000000000) vacStillValid:=now < (vacDate+15552000000000000)
res := vac == vacStillValid res := vac == vacStillValid
} }
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
"did:key:z6MkpxjNepTaD1xo49dEbbW36FguWgsiToxNdhR8YJMnFQoJ", "did:key:z6MkpxjNepTaD1xo49dEbbW36FguWgsiToxNdhR8YJMnFQoJ",
"did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6" "did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6"
] ]
} }
\ No newline at end of file
...@@ -6,4 +6,4 @@ getKeys(i) = res { ...@@ -6,4 +6,4 @@ getKeys(i) = res {
doc1 = did.resolve(data.dids[0]) doc1 = did.resolve(data.dids[0])
doc2 = did.resolve(data.dids[1]) doc2 = did.resolve(data.dids[1])
res := array.concat([doc1.didDocument.verificationMethod[0].publicKeyMultibase], [doc2.didDocument.verificationMethod[0].publicKeyMultibase]) res := array.concat([doc1.didDocument.verificationMethod[0].publicKeyMultibase], [doc2.didDocument.verificationMethod[0].publicKeyMultibase])
} }
\ No newline at end of file
package example.returnDID package example.returnDID
_ := { _ = {
"@context": ["https://www.w3.org/ns/did/v1", "https://w3id.org/security/suites/ed25519-2020/v1"], "@context": ["https://www.w3.org/ns/did/v1", "https://w3id.org/security/suites/jws-2020/v1"],
"id": issuer().did, "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"verificationMethod": keys.getAll() "verificationMethod": verification_methods("did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", "transit")
} }
\ No newline at end of file
package example.selfDescription package example.selfDescription
_ := cache.get(input.key, input.scope, input.namespace) _ := cache.get(input.key, input.scope, input.namespace)
\ No newline at end of file
...@@ -15,6 +15,5 @@ ...@@ -15,6 +15,5 @@
"medicinalProductName": "Pfizer–BioNTech COVID-19 vaccine", "medicinalProductName": "Pfizer–BioNTech COVID-19 vaccine",
"marketingAuthorizationHolder": "Pfizer–BioNTech" "marketingAuthorizationHolder": "Pfizer–BioNTech"
} }
} }
} }
...@@ -7,22 +7,22 @@ default expired = false ...@@ -7,22 +7,22 @@ default expired = false
default valid = false default valid = false
trusted { trusted {
m := input.issuer m := input.issuer
m in data.trustlist m in data.trustlist
} }
expired { expired {
exp:= time.parse_ns("2006-01-02T15:04:05Z07:00",input.expirationDate) exp:= time.parse_ns("2006-01-02T15:04:05Z07:00",input.expirationDate)
now:=time.now_ns() now:=time.now_ns()
now>exp now>exp
} }
valid = semanticallyValid(input) valid = semanticallyValid(input)
semanticallyValid(i) = res { semanticallyValid(i) = res {
now:=time.now_ns() now:=time.now_ns()
vac:= data.vaccines[i.credentialSubject.vaccine.vacCode].active == true vac:= data.vaccines[i.credentialSubject.vaccine.vacCode].active == true
vacDate:=time.parse_ns("2006-01-02T15:04:05Z07:00",i.credentialSubject.dateOfVaccination) vacDate:=time.parse_ns("2006-01-02T15:04:05Z07:00",i.credentialSubject.dateOfVaccination)
vacStillValid:=now < (vacDate+15552000000000000) vacStillValid:=now < (vacDate+15552000000000000)
res := vac == vacStillValid res := vac == vacStillValid
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment