Merge pull request #49 from imsglc/fix-ob3-tests

Fix ob3 tests
This commit is contained in:
Xavi Aracil 2022-11-17 11:43:48 +01:00 committed by GitHub
commit b2e315ca38
13 changed files with 66 additions and 59 deletions

View File

@ -61,12 +61,12 @@ public class ContextPropertyProbe extends Probe<JsonNode> {
private final static Map<Set<Credential.Type>, List<String>> values = new ImmutableMap.Builder<Set<Credential.Type>, List<String>>() private final static Map<Set<Credential.Type>, List<String>> values = new ImmutableMap.Builder<Set<Credential.Type>, List<String>>()
.put(Set.of(OpenBadgeCredential, AchievementCredential, EndorsementCredential), .put(Set.of(OpenBadgeCredential, AchievementCredential, EndorsementCredential),
List.of("https://www.w3.org/2018/credentials/v1", List.of("https://www.w3.org/2018/credentials/v1",
//"https://imsglobal.github.io/openbadges-specification/context.json")) //dev legacy //"https://purl.imsglobal.org/spec/ob/v3p0/context.json")) //dev legacy
"https://purl.imsglobal.org/spec/ob/v3p0/context.json")) "https://purl.imsglobal.org/spec/ob/v3p0/context.json"))
.put(Set.of(ClrCredential), .put(Set.of(ClrCredential),
List.of("https://www.w3.org/2018/credentials/v1", List.of("https://www.w3.org/2018/credentials/v1",
// "https://dc.imsglobal.org/draft/clr/v2p0/context", //dev legacy // "https://dc.imsglobal.org/draft/clr/v2p0/context", //dev legacy
// "https://imsglobal.github.io/openbadges-specification/context.json")) //dev legacy // "https://purl.imsglobal.org/spec/ob/v3p0/context.json")) //dev legacy
"https://purl.imsglobal.org/spec/clr/v2p0/context.json", "https://purl.imsglobal.org/spec/clr/v2p0/context.json",
"https://purl.imsglobal.org/spec/ob/v3p0/context.json")) "https://purl.imsglobal.org/spec/ob/v3p0/context.json"))

View File

@ -128,7 +128,7 @@ public class EmbeddedProofProbe extends Probe<Credential> {
return error("Verification method does not contain an Ed25519 public key", ctx); return error("Verification method does not contain an Ed25519 public key", ctx);
} }
} catch (Exception e) { } catch (Exception e) {
return fatal("Invalid public key: " + e.getMessage(), ctx); return error("Invalid public key: " + e.getMessage(), ctx);
} }
if (controller != null) { if (controller != null) {

View File

@ -43,7 +43,7 @@ public class CachingDocumentLoader implements DocumentLoader {
.put("https://purl.imsglobal.org/spec/clr/v2p0/context.json",Resources.getResource("contexts/clr-v2p0.json")) .put("https://purl.imsglobal.org/spec/clr/v2p0/context.json",Resources.getResource("contexts/clr-v2p0.json"))
.put("https://purl.imsglobal.org/spec/ob/v3p0/context.json",Resources.getResource("contexts/ob-v3p0.json")) .put("https://purl.imsglobal.org/spec/ob/v3p0/context.json",Resources.getResource("contexts/ob-v3p0.json"))
.put("https://purl.imsglobal.org/spec/ob/v3p0/extensions.json",Resources.getResource("contexts/ob-v3p0-extensions.json")) .put("https://purl.imsglobal.org/spec/ob/v3p0/extensions.json",Resources.getResource("contexts/ob-v3p0-extensions.json"))
.put("https://imsglobal.github.io/openbadges-specification/context.json",Resources.getResource("contexts/obv3x.jsonld")) .put("https://purl.imsglobal.org/spec/ob/v3p0/context.json",Resources.getResource("contexts/obv3x.jsonld"))
.put("https://www.w3.org/ns/did/v1", Resources.getResource("contexts/did-v1.jsonld")) .put("https://www.w3.org/ns/did/v1", Resources.getResource("contexts/did-v1.jsonld"))
.put("https://www.w3.org/ns/odrl.jsonld", Resources.getResource("contexts/odrl.jsonld")) .put("https://www.w3.org/ns/odrl.jsonld", Resources.getResource("contexts/odrl.jsonld"))
.put("https://w3id.org/security/suites/ed25519-2020/v1",Resources.getResource("contexts/security-suites-ed25519-2020-v1.jsonld")) .put("https://w3id.org/security/suites/ed25519-2020/v1",Resources.getResource("contexts/security-suites-ed25519-2020-v1.jsonld"))

View File

@ -1,7 +1,7 @@
{ {
"@context": [ "@context": [
"https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/v1",
"https://imsglobal.github.io/openbadges-specification/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"id": "http://1edtech.edu/credentials/3732", "id": "http://1edtech.edu/credentials/3732",
@ -93,7 +93,7 @@
{ {
"@context": [ "@context": [
"https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/v1",
"https://imsglobal.github.io/openbadges-specification/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"type": [ "type": [
@ -147,7 +147,7 @@
{ {
"@context": [ "@context": [
"https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/v1",
"https://imsglobal.github.io/openbadges-specification/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"type": [ "type": [
@ -253,7 +253,7 @@
{ {
"@context": [ "@context": [
"https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/v1",
"https://imsglobal.github.io/openbadges-specification/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"type": [ "type": [
@ -500,7 +500,7 @@
{ {
"@context": [ "@context": [
"https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/v1",
"https://imsglobal.github.io/openbadges-specification/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"type": [ "type": [
@ -588,7 +588,7 @@
{ {
"@context": [ "@context": [
"https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/v1",
"https://imsglobal.github.io/openbadges-specification/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"type": [ "type": [

View File

@ -1,6 +1,6 @@
{ {
"@context": [ "@context": [
"https://imsglobal.github.io/openbadges-specification/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"id": "http://example.edu/credentials/3732", "id": "http://example.edu/credentials/3732",

View File

@ -1,37 +1,48 @@
{ {
"@context": [ "@context": [
"https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/v1",
"https://imsglobal.github.io/openbadges-specification/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"id": "http://example.edu/credentials/3732", "id": "http://example.com/credentials/3527",
"type": [ "type": [
"VerifiableCredential", "VerifiableCredential",
"OpenBadgeCredential" "OpenBadgeCredential"
], ],
"issuer": { "issuer": {
"id": "https://example.edu/issuers/565049", "id": "https://example.com/issuers/876543",
"type": [ "type": [
"Profile" "Profile"
], ],
"name": "Example University" "name": "Example Corp"
}, },
"issuanceDate": "2010-01-01T00:00:00Z", "issuanceDate": "2010-01-01T00:00:00Z",
"expirationDate": "2020-01-20T00:00:00Z", "expirationDate": "2010-01-01T00:00:00Z",
"name": "Example University Degree", "name": "Teamwork Badge",
"credentialSubject": { "credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21", "id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"type": [ "type": [
"AchievementSubject" "AchievementSubject"
] ],
"achievement": {
"id": "https://example.com/achievements/21st-century-skills/teamwork",
"type": [
"Achievement"
],
"criteria": {
"narrative": "Team members are nominated for this badge by their peers and recognized upon review by Example Corp management."
},
"description": "This badge recognizes the development of the capacity to collaborate within a group environment.",
"name": "Teamwork"
}
}, },
"proof": [ "proof": [
{ {
"type": "Ed25519Signature2020", "type": "Ed25519Signature2020",
"created": "2022-06-28T16:28:36Z", "created": "2022-11-16T18:54:22Z",
"verificationMethod": "did:key:z6MkkUD3J14nkYzn46QeuaVSnp7dF85QJKwKvJvfsjx79aXj", "verificationMethod": "https://example.com/issuers/876543#z6MknNHHrBzPytzu6CUBP9Lg7fg4KSBjzimc2Frh693YbMiv",
"proofPurpose": "assertionMethod", "proofPurpose": "assertionMethod",
"proofValue": "z3MUt2ZuU8Byqivxh6GphEM65AFYyNaGYibm97xLTafM7uGufZQLKvJR8itZwxKskvtFM3CUty46v26DZidMNoQnM" "proofValue": "z5gJZKchSJEYPGeq6bsqiLKuxT6mXqAovPbqYX66CB7u9CSNFdV41vHtysjHFiitvoyhfPxsaZnWftrZZZW2txPQK"
} }
] ]
} }

View File

@ -1,7 +1,7 @@
{ {
"@context": [ "@context": [
"https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/v1",
"https://imsglobal.github.io/openbadges-specification/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"id": "http://example.edu/credentials/3732", "id": "http://example.edu/credentials/3732",

View File

@ -1,7 +1,7 @@
{ {
"@context": [ "@context": [
"https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/v1",
"https://imsglobal.github.io/openbadges-specification/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"id": "http://example.edu/credentials/3732", "id": "http://example.edu/credentials/3732",

View File

@ -1,7 +1,7 @@
{ {
"@context": [ "@context": [
"https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/v1",
"https://imsglobal.github.io/openbadges-specification/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"id": "http://example.edu/credentials/3732", "id": "http://example.edu/credentials/3732",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -7,48 +7,46 @@
"@context": [ "@context": [
"https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/v1",
"https://purl.imsglobal.org/spec/ob/v3p0/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://purl.imsglobal.org/spec/ob/v3p0/extensions.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"id": "urn:uuid:280c19b6-9680-4a37-ba84-e38b1a4e4584", "id": "http://example.com/credentials/3527",
"type": [ "type": [
"VerifiableCredential", "VerifiableCredential",
"AchievementCredential" "OpenBadgeCredential"
], ],
"issuer": { "issuer": {
"id": "https://example.com/issuers/876543",
"type": [ "type": [
"Profile" "Profile"
], ],
"name": "Andy F. Miller", "name": "Example Corp"
"id": "urn:uuid:6f2e33e5-7a29-4155-840a-59483ba10164"
}, },
"issuanceDate": "2022-11-10T07:38:00-08:00", "issuanceDate": "2010-01-01T00:00:00Z",
"name": "test 1", "name": "Teamwork Badge",
"credentialSubject": { "credentialSubject": {
"id": "urn:uuid:6f2e33e5-7a29-4155-840a-59483ba10164", "id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"type": [ "type": [
"AchievementSubject" "AchievementSubject"
], ],
"achievement": { "achievement": {
"id": "urn:uuid:35258e6f-4c05-4215-8ada-38a5a5b80510", "id": "https://example.com/achievements/21st-century-skills/teamwork",
"type": [ "type": [
"Achievement" "Achievement"
], ],
"achievementType": "Achievement",
"name": "test 1",
"description": "This is a test achievement",
"criteria": { "criteria": {
"narrative": "There is no criteria" "narrative": "Team members are nominated for this badge by their peers and recognized upon review by Example Corp management."
} },
"description": "This badge recognizes the development of the capacity to collaborate within a group environment.",
"name": "Teamwork"
} }
}, },
"proof": [ "proof": [
{ {
"type": "Ed25519Signature2020", "type": "Ed25519Signature2020",
"created": "2022-11-10T19:36:07Z", "created": "2022-11-16T18:54:22Z",
"verificationMethod": "https://example.com/issuers/876543#z6MknNHHrBzPytzu6CUBP9Lg7fg4KSBjzimc2Frh693YbMiv",
"proofPurpose": "assertionMethod", "proofPurpose": "assertionMethod",
"verificationMethod": "z6Mkt5PKegVQUpjQjoeiqkFa1HqpvMvehiLJuPMJcqX9hxM5", "proofValue": "z5gJZKchSJEYPGeq6bsqiLKuxT6mXqAovPbqYX66CB7u9CSNFdV41vHtysjHFiitvoyhfPxsaZnWftrZZZW2txPQK"
"proofValue": "z4xh7M5Xpo4hU2bDU6dtQZgnuJCtJUhYCsMPBbCnhAvdnugDidH8anMJ6ayt7vR74iL5mhgJgTDQnNHoYrCnhARVD"
} }
] ]
} }

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -1,7 +1,7 @@
{ {
"@context": [ "@context": [
"https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/v1",
"https://imsglobal.github.io/openbadges-specification/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"id": "http://example.edu/credentials/3732", "id": "http://example.edu/credentials/3732",

View File

@ -2,48 +2,46 @@
"@context": [ "@context": [
"https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/v1",
"https://purl.imsglobal.org/spec/ob/v3p0/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://purl.imsglobal.org/spec/ob/v3p0/extensions.json",
"https://w3id.org/security/suites/ed25519-2020/v1" "https://w3id.org/security/suites/ed25519-2020/v1"
], ],
"id": "urn:uuid:280c19b6-9680-4a37-ba84-e38b1a4e4584", "id": "http://example.com/credentials/3527",
"type": [ "type": [
"VerifiableCredential", "VerifiableCredential",
"AchievementCredential" "OpenBadgeCredential"
], ],
"issuer": { "issuer": {
"id": "https://example.com/issuers/876543",
"type": [ "type": [
"Profile" "Profile"
], ],
"name": "Andy F. Miller", "name": "Example Corp"
"id": "urn:uuid:6f2e33e5-7a29-4155-840a-59483ba10164"
}, },
"issuanceDate": "2022-11-10T07:38:00-08:00", "issuanceDate": "2010-01-01T00:00:00Z",
"name": "test 1", "name": "Teamwork Badge",
"credentialSubject": { "credentialSubject": {
"id": "urn:uuid:6f2e33e5-7a29-4155-840a-59483ba10164", "id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"type": [ "type": [
"AchievementSubject" "AchievementSubject"
], ],
"achievement": { "achievement": {
"id": "urn:uuid:35258e6f-4c05-4215-8ada-38a5a5b80510", "id": "https://example.com/achievements/21st-century-skills/teamwork",
"type": [ "type": [
"Achievement" "Achievement"
], ],
"achievementType": "Achievement",
"name": "test 1",
"description": "This is a test achievement",
"criteria": { "criteria": {
"narrative": "There is no criteria" "narrative": "Team members are nominated for this badge by their peers and recognized upon review by Example Corp management."
} },
"description": "This badge recognizes the development of the capacity to collaborate within a group environment.",
"name": "Teamwork"
} }
}, },
"proof": [ "proof": [
{ {
"type": "Ed25519Signature2020", "type": "Ed25519Signature2020",
"created": "2022-11-10T19:36:07Z", "created": "2022-11-16T18:54:22Z",
"verificationMethod": "https://example.com/issuers/876543#z6MknNHHrBzPytzu6CUBP9Lg7fg4KSBjzimc2Frh693YbMiv",
"proofPurpose": "assertionMethod", "proofPurpose": "assertionMethod",
"verificationMethod": "z6Mkt5PKegVQUpjQjoeiqkFa1HqpvMvehiLJuPMJcqX9hxM5", "proofValue": "z5gJZKchSJEYPGeq6bsqiLKuxT6mXqAovPbqYX66CB7u9CSNFdV41vHtysjHFiitvoyhfPxsaZnWftrZZZW2txPQK"
"proofValue": "z4xh7M5Xpo4hU2bDU6dtQZgnuJCtJUhYCsMPBbCnhAvdnugDidH8anMJ6ayt7vR74iL5mhgJgTDQnNHoYrCnhARVD"
} }
] ]
} }