Skip to content

Commit

Permalink
[INJICERT-299] add Sunbird's credential contexts (#97)
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Vardhan <[email protected]>
  • Loading branch information
vharsh authored Aug 1, 2024
1 parent 8c8adab commit 7f3e4c9
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
4 changes: 2 additions & 2 deletions certify-sunbird-insurance.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ mosip.certify.vciplugin.sunbird-rc.supported-credential-types=LifeInsuranceCrede
##Life Insurance Credential Configurations

mosip.certify.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.static-value-map.issuerId=did:web:api.dev1.mosip.net:identity-service:3e432fe5-bdab-4717-8eaa-a80d79823e58
mosip.certify.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.template-url=${spring_config_url_env}/*/${active_profile_env}/${spring_config_label_env}/life-insurance-credential.json
mosip.certify.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.template-url=${spring_config_url_env}/*/${active_profile_env}/${spring_config_label_env}/life-insurance-credential.vm
mosip.certify.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.registry-get-url=http://demo-registry.sunbird-registry:8081/api/v1/Insurance/
mosip.certify.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.cred-schema-id=did:schema:1db02c37-7cfa-451b-b005-f5361effee0b
mosip.certify.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.cred-schema-version=1.0.0
mosip.certify.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.registry-search-url=http://demo-registry.sunbird-registry:8081/api/v1/Insurance/search

##Insurance Credential Configurations
mosip.certify.vciplugin.sunbird-rc.credential-type.InsuranceCredential.static-value-map.issuerId=did:web:api.dev1.mosip.net:identity-service:3e432fe5-bdab-4717-8eaa-a80d79823e58
mosip.certify.vciplugin.sunbird-rc.credential-type.InsuranceCredential.template-url=${spring_config_url_env}/*/${active_profile_env}/${spring_config_label_env}/insurance-credential.json
mosip.certify.vciplugin.sunbird-rc.credential-type.InsuranceCredential.template-url=${spring_config_url_env}/*/${active_profile_env}/${spring_config_label_env}/insurance-credential.vm
mosip.certify.vciplugin.sunbird-rc.credential-type.InsuranceCredential.registry-get-url=http://demo-registry.sunbird-registry:8081/api/v1/Insurance/
mosip.certify.vciplugin.sunbird-rc.credential-type.InsuranceCredential.cred-schema-id=did:schema:1db02c37-7cfa-451b-b005-f5361effee0b
mosip.certify.vciplugin.sunbird-rc.credential-type.InsuranceCredential.cred-schema-version=1.0.0
Expand Down
32 changes: 32 additions & 0 deletions insurance-credential.vm
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
##Here we are injecting DateTool instance from java velocity library to set the expiry date
#set( $defaultLocale = $date.getLocale() )
#set( $calenderNow = $date.getCalendar() )
#set( $ISO8601DateTimeWithMillisUTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" )
## Adding no. of Days we want to set as expiry,here '5' represent Day and '30' represent no. of days
#set( $expiry =$calenderNow.add(5,30))
#set( $formattedPolicyIssuedOn = $date.toDate($ISO8601DateTimeWithMillisUTC, ${policyIssuedOn}))
#set( $formattedPolicyExpiresOn = $date.toDate($ISO8601DateTimeWithMillisUTC, ${policyExpiresOn}))
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://holashchand.github.io/test_project/insurance-context.json"
],
"type": [
"VerifiableCredential",
"InsuranceCredential"
],
"issuer": "${issuerId}",
"expirationDate": "${date.format($ISO8601DateTimeWithMillisUTC, $calenderNow, $defaultLocale)}",
"credentialSubject": {
"dob": "${dob}",
"gender": "${gender}",
"mobile": "${mobile}",
"benefits": #if($benefits)$benefits#else#set($benefits = '"[]"') $benefits#end,
"fullName": "${fullName}",
"email": "${email}",
"policyIssuedOn": "${date.format('yyyy-MM-dd', $formattedPolicyIssuedOn)}",
"policyExpiresOn": "${date.format('yyyy-MM-dd', $formattedPolicyExpiresOn)}",
"policyName": "${policyName}",
"policyNumber": "${policyNumber}"
}
}
37 changes: 37 additions & 0 deletions life-insurance-credential.vm
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
##Here we are injecting DateTool instance from java velocity library to set the expiry date
#set( $defaultLocale = $date.getLocale() )
#set( $calenderNow = $date.getCalendar() )
#set( $ISO8601DateTimeWithMillisUTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" )
## Adding no. of Days we want to set as expiry, here '5' represent Day and '30' represent no. of days
#set( $expiry =$calenderNow.add(5, 30))
#set( $formattedPolicyIssuedOn = $date.toDate($ISO8601DateTimeWithMillisUTC, ${policyIssuedOn}))
#set( $formattedPolicyExpiresOn = $date.toDate($ISO8601DateTimeWithMillisUTC, ${policyExpiresOn}))
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://holashchand.github.io/test_project/insurance-context.json",
{
"LifeInsuranceCredential": {
"@id":"InsuranceCredential"
}
}
],
"type": [
"VerifiableCredential",
"LifeInsuranceCredential"
],
"issuer": "${issuerId}",
"expirationDate": "${date.format($ISO8601DateTimeWithMillisUTC, $calenderNow, $defaultLocale)}",
"credentialSubject": {
"dob": "${dob}",
"gender": "${gender}",
"mobile": "${mobile}",
"benefits": #if($benefits)$benefits#else#set($benefits = '"[]"') $benefits#end,
"fullName": "${fullName}",
"email": "${email}",
"policyIssuedOn": "${date.format('yyyy-MM-dd', $formattedPolicyIssuedOn)}",
"policyExpiresOn": "${date.format('yyyy-MM-dd', $formattedPolicyExpiresOn)}",
"policyName": "${policyName}",
"policyNumber": "${policyNumber}"
}
}

0 comments on commit 7f3e4c9

Please sign in to comment.