-
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.
use vec instead of option, parse pattern filters for credential types
Signed-off-by: Ryan Tate <[email protected]>
- Loading branch information
Showing
3 changed files
with
239 additions
and
8 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
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,88 @@ | ||
{ | ||
"id": "32f54163-7166-48f1-93d8-ff217bdb0653", | ||
"name": "Identity and Qualifications Verification", | ||
"purpose": "We need to verify your identity and qualifications", | ||
"format": { | ||
"jwt_vp": { | ||
"alg": ["EdDSA", "ES256K"] | ||
}, | ||
"jwt_vc": { | ||
"alg": ["EdDSA", "ES256K"] | ||
}, | ||
"ldp_vc": { | ||
"proof_type": ["Ed25519Signature2018", "EcdsaSecp256k1Signature2019"] | ||
}, | ||
"ldp_vp": { | ||
"proof_type": ["Ed25519Signature2018", "EcdsaSecp256k1Signature2019"] | ||
} | ||
}, | ||
"input_descriptors": [ | ||
{ | ||
"id": "combined_credential", | ||
"name": "Identity and Education Credential", | ||
"purpose": "Please provide a credential that includes both identity and educational information", | ||
"constraints": { | ||
"fields": [ | ||
{ | ||
"path": ["$.type", "$.vc.type"], | ||
"filter": { | ||
"type": "array", | ||
"contains": { | ||
"const": "IdentityCredential" | ||
} | ||
} | ||
}, | ||
{ | ||
"path": ["$.type", "$.vc.type"], | ||
"filter": { | ||
"type": "array", | ||
"contains": { | ||
"const": "EducationalCredential" | ||
} | ||
} | ||
}, | ||
{ | ||
"path": ["$.credentialSubject.firstName", "$.vc.credentialSubject.firstName"], | ||
"purpose": "The credential must contain the holder's first name", | ||
"filter": { | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
}, | ||
{ | ||
"path": ["$.credentialSubject.lastName", "$.vc.credentialSubject.lastName"], | ||
"purpose": "The credential must contain the holder's last name", | ||
"filter": { | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
}, | ||
{ | ||
"path": ["$.credentialSubject.dateOfBirth", "$.vc.credentialSubject.dateOfBirth"], | ||
"purpose": "The credential must contain the holder's date of birth", | ||
"filter": { | ||
"type": "string", | ||
"format": "date" | ||
} | ||
}, | ||
{ | ||
"path": ["$.credentialSubject.degree.name", "$.vc.credentialSubject.degree.name"], | ||
"purpose": "The credential must contain the name of an educational degree", | ||
"filter": { | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
}, | ||
{ | ||
"path": ["$.credentialSubject.degree.institution", "$.vc.credentialSubject.degree.institution"], | ||
"purpose": "The credential must contain the name of the educational institution", | ||
"filter": { | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
70 changes: 70 additions & 0 deletions
70
tests/presentation-definition/multi-credential-pattern.json
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 @@ | ||
{ | ||
"id": "32f54163-7166-48f1-93d8-ff217bdb0653", | ||
"name": "Identity Verification", | ||
"purpose": "We need to verify your identity for account creation", | ||
"format": { | ||
"jwt_vp": { | ||
"alg": ["EdDSA", "ES256K"] | ||
}, | ||
"jwt_vc": { | ||
"alg": ["EdDSA", "ES256K"] | ||
}, | ||
"ldp_vc": { | ||
"proof_type": ["Ed25519Signature2018", "EcdsaSecp256k1Signature2019"] | ||
}, | ||
"ldp_vp": { | ||
"proof_type": ["Ed25519Signature2018", "EcdsaSecp256k1Signature2019"] | ||
} | ||
}, | ||
"input_descriptors": [ | ||
{ | ||
"id": "identity_credential", | ||
"name": "Identity Document", | ||
"purpose": "Please provide a government-issued identity document", | ||
"constraints": { | ||
"fields": [ | ||
{ | ||
"path": ["$.type"], | ||
"filter": { | ||
"type": "string", | ||
"pattern": "^(PassportCredential|DriversLicenseCredential|NationalIDCredential)$" | ||
} | ||
}, | ||
{ | ||
"path": ["$.credentialSubject.firstName"], | ||
"purpose": "The credential must contain the holder's first name", | ||
"filter": { | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
}, | ||
{ | ||
"path": ["$.credentialSubject.lastName"], | ||
"purpose": "The credential must contain the holder's last name", | ||
"filter": { | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
}, | ||
{ | ||
"path": ["$.credentialSubject.dateOfBirth"], | ||
"purpose": "The credential must contain the holder's date of birth", | ||
"filter": { | ||
"type": "string", | ||
"format": "date" | ||
} | ||
}, | ||
{ | ||
"path": ["$.issuanceDate"], | ||
"purpose": "The credential must have been issued within the last 5 years", | ||
"filter": { | ||
"type": "string", | ||
"format": "date", | ||
"minimum": "2018-01-01" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |