# Example demo application output
This is the outcome, printed to standard output / the terminal when running the demo application:
```bash=
$ yarn demo
yarn run v1.22.17
warning package.json: No license field
$ ts-node ./src/index.ts
Case 1. A new VC is created from scratch, using this library. Two signatures are added. Both signatures are verifiable. Verification should fail in case VC is modified.
New Verifiable Credential created, contents are:
{
credentialSubject: { email: 'example@mail.com', id: 'did:example:subject' },
'@context': [
'https://www.w3.org/2018/credentials/v1',
{
ProofOfEmailCredential: 'https://identity.jolocom.com/terms/ProofOfEmailCredential',
schema: 'http://schema.org/',
email: 'schema:email'
}
],
id: 'urn:uuid:a6033576-03f3-4ae8-a873-ceecd5464470',
issuer: 'did:jun:EZlrb_Z0P7WORsHIw25ImYLwySB6NdYt1W-iHmIMRevQ',
issuanceDate: '2022-03-31T14:08:00Z',
expirationDate: '2023-03-31T14:08:00Z',
type: [ 'VerifiableCredential', 'ProofOfEmailCredential' ]
}
Proofs associated with the credential:
[
{
proofPurpose: 'assertionMethod',
created: '2022-03-31T14:08:00Z',
type: 'Ed25519Signature2018',
jws: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..8rM3fbQiQBy2jNvpMAfwgBb8KAo0FoVIWUvcFRmxtwMmvqNIgVF5OmgjsahiaHE0BAaK3j6ynQHRsVF9dxIqDw',
verificationMethod: 'did:jun:EZlrb_Z0P7WORsHIw25ImYLwySB6NdYt1W-iHmIMRevQ#DpwH46HwF_EKw4H-JKfVLEBactTObKL7KRdWk4Te4jPE'
},
{
chainSignatureSuite: 'Ed25519Signature2018',
created: '2022-03-31T14:08:00Z',
type: 'ChainedProof2021',
previousProof: {
verificationMethod: 'did:jun:EZlrb_Z0P7WORsHIw25ImYLwySB6NdYt1W-iHmIMRevQ#DpwH46HwF_EKw4H-JKfVLEBactTObKL7KRdWk4Te4jPE',
created: 2022-03-31T14:08:00.928Z,
proofPurpose: 'assertionMethod',
type: 'Ed25519Signature2018'
},
proofPurpose: 'assertionMethod',
proofValue: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..qVAky1iyTASiElc2YBIcLwG3nQj1x99CcUbOTWrn5Tb6FgklJMcy7-2fr2nyOyiIaFHkNZ0zwmgHppXK4rgjBw',
verificationMethod: 'did:jun:EZlrb_Z0P7WORsHIw25ImYLwySB6NdYt1W-iHmIMRevQ#DpwH46HwF_EKw4H-JKfVLEBactTObKL7KRdWk4Te4jPE'
},
{
chainSignatureSuite: 'EcdsaKoblitzSignature2016',
created: '2022-03-31T14:08:00Z',
type: 'ChainedProof2021',
previousProof: {
verificationMethod: 'did:jun:EZlrb_Z0P7WORsHIw25ImYLwySB6NdYt1W-iHmIMRevQ#DpwH46HwF_EKw4H-JKfVLEBactTObKL7KRdWk4Te4jPE',
created: 2022-03-31T14:08:00.928Z,
proofPurpose: 'assertionMethod',
type: 'Ed25519Signature2018'
},
proofPurpose: 'assertionMethod',
proofValue: '2760eb6f4a058018504b45409457b5d587f0a5f9c38d22e63a7429a14a5e2643eeff7c072596dd9c2da81da32d2a99442962a196bbf24983e8c2e4ae9fe5530d',
verificationMethod: 'did:jun:EZlrb_Z0P7WORsHIw25ImYLwySB6NdYt1W-iHmIMRevQ#DpwH46HwF_EKw4H-JKfVLEBactTObKL7KRdWk4Te4jPE'
}
]
Modifying the VC issuer
Case 2. A VC without proofs is received as JSON. Two proofs are added. All signatures are verifiable. Verification should fail in case VC is modified.
Signed Credential with newly added proofs:
{
credentialSubject: {
id: 'did:example:ebfeb1f712ebc6f1c276e12ec21',
degree: {
type: 'BachelorDegree',
name: 'Bachelor of Science in Mechanical Engineering'
}
},
'@context': [
'https://www.w3.org/2018/credentials/v1',
'https://www.w3.org/2018/credentials/examples/v1'
],
id: 'http://example.edu/credentials/3732',
issuer: 'https://example.edu/issuers/14',
issuanceDate: '2010-01-01T19:23:24Z',
type: [ 'VerifiableCredential', 'UniversityDegreeCredential' ]
}
Proofs associated with the credential:
[
{
proofPurpose: 'assertionMethod',
created: '2022-03-31T14:08:01Z',
type: 'Ed25519Signature2018',
jws: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..sRq6JGd4qYjZ2eF51Djc-CF2L_szs2AlF58tW4oMOl71swgvGPeOjZbHWydw4x_VwWGxS2Sa--aHtfX-BvnuBA',
verificationMethod: 'did:jun:EZlrb_Z0P7WORsHIw25ImYLwySB6NdYt1W-iHmIMRevQ#DpwH46HwF_EKw4H-JKfVLEBactTObKL7KRdWk4Te4jPE'
},
{
chainSignatureSuite: 'Ed25519Signature2018',
created: '2022-03-31T14:08:01Z',
type: 'ChainedProof2021',
previousProof: {
verificationMethod: 'did:jun:EZlrb_Z0P7WORsHIw25ImYLwySB6NdYt1W-iHmIMRevQ#DpwH46HwF_EKw4H-JKfVLEBactTObKL7KRdWk4Te4jPE',
created: 2022-03-31T14:08:01.175Z,
proofPurpose: 'assertionMethod',
type: 'Ed25519Signature2018'
},
proofPurpose: 'assertionMethod',
proofValue: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..w3uyqXl9ue1fMg8r4rXSGWoc1d-Ogag37-EbKF44MCfvJZbSKZxwqUvSwgvctAQzB4k21OAUV1E8DCHO6TRwCw',
verificationMethod: 'did:jun:E9owvpwvhd59r32LMajuxqgTUZffqU9qxH4GN3jokf5s#D2UI8qsT_W3L_zHZeMOJt2LzjK-Z2KhBrYKjGEW-q6d8'
}
]
Case 3. A VC with existing proofs is received as JSON, new signatures are added. All signatures are verifiable. Verification should fail in case VC is modified.
Signed Credential with newly added proofs:
{
credentialSubject: { email: 'example@mail.com', id: 'did:example:subject' },
'@context': [
'https://www.w3.org/2018/credentials/v1',
{
ProofOfEmailCredential: 'https://identity.jolocom.com/terms/ProofOfEmailCredential',
schema: 'http://schema.org/',
email: 'schema:email'
}
],
id: 'claimId:e64233e4f71ca107',
issuer: 'did:jun:E9owvpwvhd59r32LMajuxqgTUZffqU9qxH4GN3jokf5s',
issuanceDate: '2022-02-02T10:21:49Z',
expirationDate: '2023-02-02T10:21:49Z',
type: [ 'VerifiableCredential', 'ProofOfEmailCredential' ]
}
Proofs associated with the credential:
[
{
proofPurpose: 'assertionMethod',
created: '2022-02-02T10:21:49Z',
type: 'Ed25519Signature2018',
jws: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..Ky1aNIp24YnPg5qXfoEMdzDgsEc05oPoDV22-tq8_vXDWz6shqOOGCkewCMSf0ZD1C6V5walkOvRZGA7B1QdCQ',
verificationMethod: 'did:jun:E9owvpwvhd59r32LMajuxqgTUZffqU9qxH4GN3jokf5s#D2UI8qsT_W3L_zHZeMOJt2LzjK-Z2KhBrYKjGEW-q6d8'
},
{
chainSignatureSuite: 'Ed25519Signature2018',
created: '2022-03-31T14:08:01Z',
type: 'ChainedProof2021',
previousProof: {
verificationMethod: 'did:jun:E9owvpwvhd59r32LMajuxqgTUZffqU9qxH4GN3jokf5s#D2UI8qsT_W3L_zHZeMOJt2LzjK-Z2KhBrYKjGEW-q6d8',
created: 2022-02-02T10:21:49.000Z,
proofPurpose: 'assertionMethod',
type: 'Ed25519Signature2018'
},
proofPurpose: 'assertionMethod',
proofValue: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..YrxPwbp8LvUEoNzEM1eptu9b7cwZS48mXb_bDwmyzClQxPs2rNDlJ_tm9T4An7Ur1StTaHoUtekXLJyKJ7KBCg',
verificationMethod: 'did:jun:EZlrb_Z0P7WORsHIw25ImYLwySB6NdYt1W-iHmIMRevQ#DpwH46HwF_EKw4H-JKfVLEBactTObKL7KRdWk4Te4jPE'
},
{
chainSignatureSuite: 'Ed25519Signature2018',
created: '2022-03-31T14:08:02Z',
type: 'ChainedProof2021',
previousProof: {
verificationMethod: 'did:jun:EZlrb_Z0P7WORsHIw25ImYLwySB6NdYt1W-iHmIMRevQ#DpwH46HwF_EKw4H-JKfVLEBactTObKL7KRdWk4Te4jPE',
created: 2022-03-31T14:08:01.249Z,
proofPurpose: 'assertionMethod',
type: 'ChainedProof2021'
},
proofPurpose: 'assertionMethod',
proofValue: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..W0BQfsiWg00n_TXIZC-40c4jYzSvVEcBurXDscBTfyp8v6yPxK_V-Y729fCh6AP03JsOLF0l3yAVtG8fkMD-DA',
verificationMethod: 'did:jun:EZlrb_Z0P7WORsHIw25ImYLwySB6NdYt1W-iHmIMRevQ#DpwH46HwF_EKw4H-JKfVLEBactTObKL7KRdWk4Te4jPE'
}
]
Modifying the VC subject field.
Case 4. Data model compliance tests. An example credential is generated using this library. We ensure that when serialized to JSON, the output complies with the data model.
Testing the following normative statements:
@context MUST be present, one or more URIs
"id" property MUST be present, must be a single URI
"type" property MUST be present, first entry must be "VerifiableCredential"
"credentialSubject" property MUST be present, MAY be an object
"issuer" property MUST be present, MUST be a single URI
"issuanceDate" property MUST be present, MUST be a single RFC3339 datetime
"expirationDate" property MUST be present, MUST be a single RFC3339 datetime
Case 5. Data model compliance tests. A set of example VC data structures are parsed from JSON and serialized back. The outputs are compared with the initial test vectors.
Testing: https://github.com/w3c/vc-test-suite/blob/gh-pages/test/vc-data-model-1.0/input/example-009.jsonld
Testing: https://github.com/w3c/vc-test-suite/blob/gh-pages/test/vc-data-model-1.0/input/example-010.jsonld
Testing: https://github.com/w3c/vc-test-suite/blob/gh-pages/test/vc-data-model-1.0/input/example-011.jsonld
Done in 16.32s.
```