Skip to content

Commit

Permalink
simple reporting working
Browse files Browse the repository at this point in the history
  • Loading branch information
decentralgabe committed Dec 11, 2024
1 parent dc17108 commit 684a5db
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 169 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ To add a new implementation:
Note: if your implementation does not support a feature, set the value to `false`. This will cause the test runner to
skip tests for that feature.

4. Update `implementations/docker-compose.yml` to include your new service:
4. Update `implementations/compose.yml` to include your new service:

```yaml
services:
Expand Down
9 changes: 6 additions & 3 deletions implementations/implementations.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"independent": {
"features": {
"jose": true,
"cose": true,
"sdjwt": true
"credential_jose": true,
"credential_cose": true,
"credential_sdjwt": true,
"presentation_jose": true,
"presentation_cose": true,
"presentation_sdjwt": true
}
}
}
255 changes: 135 additions & 120 deletions tests/test-mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,20 @@ export const TestError = {
};

// See README.md for details
export const TestMapping = {
export const JOSETestMapping = {
'JWT Basic Credential Issuance': {
'number': 1,
'input_file': 'credential-minimal.json',
'key_file': TestVerificationMethods.p256,
'fn': TestFunction.issue,
'feature': TestFeature.credential_jose,
'issuance_checks': {
'format': 'jwt_compact',
'signature_valid': true,
'signing_key': TestVerificationMethods.p256,
'required_fields': ['type', 'issuer', 'credentialSubject'],
},
'expected_result': TestResult.success,
// 'issuance_checks': {
// 'format': 'jwt_compact',
// 'signature_valid': true,
// 'signing_key': TestVerificationMethods.p256,
// 'required_fields': ['type', 'issuer', 'credentialSubject'],
// },
},

'JWT Complex Credential Issuance': {
Expand All @@ -58,12 +59,13 @@ export const TestMapping = {
'key_file': TestVerificationMethods.p384,
'fn': TestFunction.issue,
'feature': TestFeature.credential_jose,
'issuance_checks': {
'format': 'jwt_compact',
'signature_valid': true,
'signing_key': TestVerificationMethods.p384,
'required_fields': ['type', 'issuer', 'credentialSubject', 'evidence', 'termsOfUse'],
},
'expected_result': TestResult.success,
// 'issuance_checks': {
// 'format': 'jwt_compact',
// 'signature_valid': true,
// 'signing_key': TestVerificationMethods.p384,
// 'required_fields': ['type', 'issuer', 'credentialSubject', 'evidence', 'termsOfUse'],
// },
},

'JWT Basic Presentation Issuance': {
Expand All @@ -72,12 +74,13 @@ export const TestMapping = {
'key_file': TestVerificationMethods.p256,
'fn': TestFunction.issue,
'feature': TestFeature.presentation_jose,
'issuance_checks': {
'format': 'jwt_compact',
'signature_valid': true,
'signing_key': TestVerificationMethods.p256,
'required_fields': ['type', 'verifiableCredential'],
},
'expected_result': TestResult.success,
// 'issuance_checks': {
// 'format': 'jwt_compact',
// 'signature_valid': true,
// 'signing_key': TestVerificationMethods.p256,
// 'required_fields': ['type', 'verifiableCredential'],
// },
},

'JWT Complex Presentation Issuance': {
Expand All @@ -86,12 +89,13 @@ export const TestMapping = {
'key_file': TestVerificationMethods.p521,
'fn': TestFunction.issue,
'feature': TestFeature.presentation_jose,
'issuance_checks': {
'format': 'jwt_compact',
'signature_valid': true,
'signing_key': TestVerificationMethods.p521,
'required_fields': ['type', 'verifiableCredential'],
},
'expected_result': TestResult.success,
// 'issuance_checks': {
// 'format': 'jwt_compact',
// 'signature_valid': true,
// 'signing_key': TestVerificationMethods.p521,
// 'required_fields': ['type', 'verifiableCredential'],
// },
},

'JWT Basic Credential Verification': {
Expand All @@ -100,9 +104,10 @@ export const TestMapping = {
'key_file': TestVerificationMethods.p256,
'fn': TestFunction.verify,
'feature': TestFeature.credential_jose,
'verification_checks': {
'expected_result': TestResult.success,
},
'expected_result': TestResult.success,
// 'verification_checks': {
// 'expected_result': TestResult.success,
// },
},

'JWT Presentation Verification': {
Expand All @@ -111,9 +116,10 @@ export const TestMapping = {
'key_file': TestVerificationMethods.p384,
'fn': TestFunction.verify,
'feature': TestFeature.presentation_jose,
'verification_checks': {
'expected_result': TestResult.success,
},
'expected_result': TestResult.success,
// 'verification_checks': {
// 'expected_result': TestResult.success,
// },
},

'JWT Issuer Match Verification': {
Expand All @@ -122,28 +128,32 @@ export const TestMapping = {
'key_file': TestVerificationMethods.ed25519,
'fn': TestFunction.verify,
'feature': TestFeature.credential_jose,
'verification_checks': {
'expected_result': TestResult.failure,
'expected_error': TestError.INVALID_ISSUER,
},
'expected_result': TestResult.success,
// 'verification_checks': {
// 'expected_result': TestResult.failure,
// 'expected_error': TestError.INVALID_ISSUER,
// },
},
};

export const SDJWTTestMapping = {
'SD-JWT Basic Credential Issuance': {
'number': 9,
'input_file': 'credential-selective.json',
'key_file': TestVerificationMethods.p384,
'fn': TestFunction.issue,
'feature': TestFeature.credential_sdjwt,
'issuance_checks': {
'format': 'sd_jwt',
'signature_valid': true,
'signing_key': TestVerificationMethods.p384,
'required_fields': ['type', 'issuer'],
'selective_disclosure': {
'required': ['type', 'issuer'],
'disclosable': ['credentialSubject.firstName', 'credentialSubject.lastName'],
},
},
'expected_result': TestResult.success,
// 'issuance_checks': {
// 'format': 'sd_jwt',
// 'signature_valid': true,
// 'signing_key': TestVerificationMethods.p384,
// 'required_fields': ['type', 'issuer'],
// 'selective_disclosure': {
// 'required': ['type', 'issuer'],
// 'disclosable': ['credentialSubject.firstName', 'credentialSubject.lastName'],
// },
// },
},

'SD-JWT Complex Credential Issuance': {
Expand All @@ -152,34 +162,38 @@ export const TestMapping = {
'key_file': TestVerificationMethods.p521,
'fn': TestFunction.issue,
'feature': TestFeature.credential_sdjwt,
'issuance_checks': {
'format': 'sd_jwt',
'signature_valid': true,
'signing_key': TestVerificationMethods.p521,
'required_fields': ['type', 'issuer'],
'selective_disclosure': {
'required': ['type', 'issuer'],
'disclosable': [
'credentialSubject.address.street',
'credentialSubject.address.city',
'credentialSubject.phoneNumbers[]',
],
},
},
'expected_result': TestResult.success,
// 'issuance_checks': {
// 'format': 'sd_jwt',
// 'signature_valid': true,
// 'signing_key': TestVerificationMethods.p521,
// 'required_fields': ['type', 'issuer'],
// 'selective_disclosure': {
// 'required': ['type', 'issuer'],
// 'disclosable': [
// 'credentialSubject.address.street',
// 'credentialSubject.address.city',
// 'credentialSubject.phoneNumbers[]',
// ],
// },
// },
},
};

export const COSETestMapping = {
'COSE Basic Credential Issuance': {
'number': 15,
'input_file': 'credential-cose.json',
'key_file': TestVerificationMethods.p256,
'fn': TestFunction.issue,
'feature': TestFeature.credential_cose,
'issuance_checks': {
'format': 'cose_sign1',
'signature_valid': true,
'signing_key': TestVerificationMethods.p256,
'required_fields': ['type', 'issuer', 'credentialSubject'],
},
'expected_result': TestResult.success,
// 'issuance_checks': {
// 'format': 'cose_sign1',
// 'signature_valid': true,
// 'signing_key': TestVerificationMethods.p256,
// 'required_fields': ['type', 'issuer', 'credentialSubject'],
// },
},

'COSE Presentation': {
Expand All @@ -188,61 +202,62 @@ export const TestMapping = {
'key_file': TestVerificationMethods.p384,
'fn': TestFunction.issue,
'feature': TestFeature.presentation_cose,
'issuance_checks': {
'format': 'cose_sign1',
'signature_valid': true,
'signing_key': TestVerificationMethods.p384,
'required_fields': ['type', 'verifiableCredential'],
'encoding_valid': true,
},
},

// Negative test cases
'Invalid JWT Signature': {
'number': 22,
'input_file': 'credential-invalid-signature.json',
'key_file': TestVerificationMethods.p256,
'fn': TestFunction.verify,
'feature': TestFeature.credential_jose,
'verification_checks': {
'expected_result': TestResult.failure,
'expected_error': TestError.INVALID_SIGNATURE,
},
},

'Missing Required JWT Claims': {
'number': 23,
'input_file': 'credential-missing-claims.json',
'key_file': TestVerificationMethods.p384,
'fn': TestFunction.verify,
'feature': TestFeature.credential_jose,
'verification_checks': {
'expected_result': TestResult.failure,
'expected_error': TestError.MISSING_REQUIRED_FIELDS,
},
'expected_result': TestResult.success,
// 'issuance_checks': {
// 'format': 'cose_sign1',
// 'signature_valid': true,
// 'signing_key': TestVerificationMethods.p384,
// 'required_fields': ['type', 'verifiableCredential'],
// 'encoding_valid': true,
// },
},
};

'Invalid SD-JWT Disclosure': {
'number': 24,
'input_file': 'credential-invalid-disclosure.json',
'key_file': TestVerificationMethods.p384,
'fn': TestFunction.verify,
'feature': TestFeature.credential_sdjwt,
'verification_checks': {
'expected_result': TestResult.failure,
'expected_error': TestError.INVALID_DISCLOSURE,
},
},

'Invalid COSE Encoding': {
'number': 25,
'input_file': 'credential-invalid-encoding.json',
'key_file': TestVerificationMethods.p256,
'fn': TestFunction.verify,
'feature': TestFeature.credential_cose,
'verification_checks': {
'expected_result': TestResult.failure,
'expected_error': TestError.INVALID_ENCODING,
},
},
};
// // Negative test cases
// 'Invalid JWT Signature': {
// 'number': 22,
// 'input_file': 'credential-invalid-signature.json',
// 'key_file': TestVerificationMethods.p256,
// 'fn': TestFunction.verify,
// 'feature': TestFeature.credential_jose,
// 'verification_checks': {
// 'expected_result': TestResult.failure,
// 'expected_error': TestError.INVALID_SIGNATURE,
// },
// },
//
// 'Missing Required JWT Claims': {
// 'number': 23,
// 'input_file': 'credential-missing-claims.json',
// 'key_file': TestVerificationMethods.p384,
// 'fn': TestFunction.verify,
// 'feature': TestFeature.credential_jose,
// 'verification_checks': {
// 'expected_result': TestResult.failure,
// 'expected_error': TestError.MISSING_REQUIRED_FIELDS,
// },
// },
//
// 'Invalid SD-JWT Disclosure': {
// 'number': 24,
// 'input_file': 'credential-invalid-disclosure.json',
// 'key_file': TestVerificationMethods.p384,
// 'fn': TestFunction.verify,
// 'feature': TestFeature.credential_sdjwt,
// 'verification_checks': {
// 'expected_result': TestResult.failure,
// 'expected_error': TestError.INVALID_DISCLOSURE,
// },
// },
//
// 'Invalid COSE Encoding': {
// 'number': 25,
// 'input_file': 'credential-invalid-encoding.json',
// 'key_file': TestVerificationMethods.p256,
// 'fn': TestFunction.verify,
// 'feature': TestFeature.credential_cose,
// 'verification_checks': {
// 'expected_result': TestResult.failure,
// 'expected_error': TestError.INVALID_ENCODING,
// },
Loading

0 comments on commit 684a5db

Please sign in to comment.