Проверка и выпекание открытых значков
Некоторое время я пытался создать открытые значки, но пока ни один из них не будет проверять или запекать с помощью онлайн-инструментов.
Я пробовал множество разных комбинаций. Вот тот, который я использую в настоящее время (сайты, удаленные из-за того, что они были подготовительными)
На сайте http://example.org/badge/5ab0d10a6a02f:
{
"@context":"https://w3id.org/openbadges/v1",
"type":"Assertion",
"id":"http://example.org/badge/5ab0d10a6a02f",
"uid":"5ab0d10a6a02f",
"recipient":
{
"type":"email",
"identity":"email@example.org",
"hashed":false
},
"issuedOn":1521564293,
"badge":"http://example.org/badge-class.json",
"verify":
{
"type":"hosted",
"url":"http://example.org/badge-issuer.json"
}
}
На сайте по адресу http://example.org/badge-class.json:
{
"@context": "https://w3id.org/openbadges/v1",
"id": "http://example.org/badge-class.json",
"type": "BadgeClass",
"name": "Badge",
"description": "Description",
"image": "http://example.org/badge.png",
"criteria": "http://example.org/criteria",
"issuer": "http://example.org/badge-issuer.json"
}
и на http://example.org/badge-issuer.json:
{
"@context": "https://w3id.org/openbadges/v1",
"id": "http://example.org/badge-issuer.json",
"type": "Issuer",
"name": "Name",
"url": "http://www.example.org/",
"telephone" : "xxxxxxxxx",
"description" : "description",
"image" : "http://www.example.org/logo.png",
"email" : "email@example.org"
}
После правильного размещения на реальном сайте я попытался проверить и запечь его, но я получаю следующие ошибки:
Для валидаторов:
{
"status": "invalid",
"reason": "Remote assertion must match local assertion",
"error": {
"message": "Remote assertion must match local assertion",
"code": "deep-equal",
"extra": {
"local": {
"@context": "https://w3id.org/openbadges/v1",
"type": "Assertion",
"id": "http://example.org/badge/5ab0d10a6a02f",
"uid": "5ab0d10a6a02f",
"recipient": {
"type": "email",
"identity": "email@example.org",
"hashed": false
},
"issuedOn": 1521564293,
"badge": "http://example.org/badge-class.json",
"verify": {
"type": "hosted",
"url": "http://example.org/badge-issuer.json"
}
},
"hosted": {
"@context": "https://w3id.org/openbadges/v1",
"id": "http://example.org/badge-issuer.json",
"type": "Issuer",
"name": "Name",
"url": "http://example.org/",
"telephone": "xxxxxxxxx",
"description": "description",
"image": "http://example.org/logo.png",
"email": "email@example.org"
}
}
},
"info": {
"raw": {
"input": {
"@context": "https://w3id.org/openbadges/v1",
"type": "Assertion",
"id": "http://example.org/badge/5ab0d10a6a02f",
"uid": "5ab0d10a6a02f",
"recipient": {
"type": "email",
"identity": "email@example.org",
"hashed": false
},
"issuedOn": 1521564293,
"badge": "http://example.org/badge-class.json",
"verify": {
"type": "hosted",
"url": "http://example.org/badge-issuer.json"
}
}
},
"parse": {
"version": "1.1.0",
"type": "hosted",
"scheme": "1.1.0-hosted",
"assertion": {
"@context": "https://w3id.org/openbadges/v1",
"type": "Assertion",
"id": "http://example.org/badge/5ab0d10a6a02f",
"uid": "5ab0d10a6a02f",
"recipient": {
"type": "email",
"identity": "email@example.org",
"hashed": false
},
"issuedOn": 1521564293,
"badge": "http://example.org/badge-class.json",
"verify": {
"type": "hosted",
"url": "http://example.org/badge-issuer.json"
}
}
},
"assertion": {
"@context": "https://w3id.org/openbadges/v1",
"type": "Assertion",
"id": "http://example.org/badge/5ab0d10a6a02f",
"uid": "5ab0d10a6a02f",
"recipient": {
"type": "email",
"identity": "email@example.org",
"hashed": false
},
"issuedOn": 1521564293,
"badge": "http://example.org/badge-class.json",
"verify": {
"type": "hosted",
"url": "http://example.org/badge-issuer.json"
}
},
"guid": "38edfd9e94b1bda73a0283a02425710508e7713dc5eb78a65f93a57b67460324",
"badge": {
"@context": "https://w3id.org/openbadges/v1",
"id": "http://example.org/badge-class.json",
"type": "BadgeClass",
"name": "Badge",
"description": "Description",
"image": "http://example.org/badge.png",
"criteria": "http://example.org/criteria",
"issuer": "http://example.org/badge-issuer.json"
},
"issuer": {
"@context": "https://w3id.org/openbadges/v1",
"id": "http://example.org/badge-issuer.json",
"type": "Issuer",
"name": "Name",
"url": "http://www.example.org/",
"telephone": "xxxxxxxxx",
"description": "description",
"image": "http://www.example.org/logo.png",
"email": "email@example.org"
},
"objects": true,
"recipient": true,
"jsonld_expanded": {
"https://w3id.org/openbadges#badge": [
{
"@id": "http://example.org/badge-class.json"
}
],
"@id": "http://example.org/badge/5ab0d10a6a02f",
"https://w3id.org/openbadges#issueDate": [
{
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
"@value": 1521564293
}
],
"https://w3id.org/openbadges#recipient": [
{
"https://w3id.org/openbadges#hashed": [
{
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
"@value": false
}
],
"https://w3id.org/openbadges#identityHash": [
{
"@value": "email@example.org"
}
],
"@type": [
"http://schema.org/email"
]
}
],
"@type": [
"https://w3id.org/openbadges#Assertion"
],
"https://w3id.org/openbadges#uid": [
{
"@value": "5ab0d10a6a02f"
}
],
"https://w3id.org/openbadges#verify": [
{
"@type": [
"https://w3id.org/openbadges#HostedBadge"
],
"http://schema.org/url": [
{
"@id": "http://example.org/badge-issuer.json"
}
]
}
]
},
"extensions": {},
"extension_properties": true,
"extension_schemas": {},
"unrevoked": "Only required for signed verification",
"signature": "Only required for signed verification"
}
}
Используя пекаря:
Could not parse json: Unexpected token <
Использование API пекаря:
{
"message":"could not get assertion: invalid JSON",
"stack":"Error: could not get assertion: invalid JSON
at makeError (/app/lib/analyze-assertion.js:6:26)
at Request._callback (/app/lib/analyze-assertion.js:31:23)
at Request.self.callback (/app/node_modules/request/request.js:187:22)
at Request.emit (events.js:98:17)
at Request.<anonymous> (/app/node_modules/request/request.js:1126:10)
at Request.emit (events.js:95:17)
at IncomingMessage.<anonymous> (/app/node_modules/request/request.js:1046:12)
at IncomingMessage.g (events.js:180:16)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16",
"code":"parse"
}
Какая часть этого значка вызывает проблемы?
0 ответов
Возможно, последние восемь (8) строк файла подтверждения значка по адресу http://example.org/badge/5ab0d10a6a02f должны быть:
{
...
...
"badge":"http://example.org/badge-class.json",
"issuer":"http://example.org/badge-issuer.json",
"verify":
{
"type":"hosted",
"url":"http://example.org/badge/5ab0d10a6a02f/THIS-BADGE-ASSERTION-FILE.json"
}
}
где THIS-BADGE-ASSERTION-FILE.json
это утверждение значка JSON
файл и это именно тот файл, содержимое которого мы модифицируем. То есть URL-адрес "проверки" должен указывать на утверждение значка JSON
файл (который находится в папке http://example.org/badge/5ab0d10a6a02f/), а не в badge-issuer.json
файл, который является эмитентом значка JSON
файл.