Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VerifiablePresentationResponse with property verifiablePresentation #314

Merged
12 changes: 12 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
env: {
browser: true
},
extends: [
'digitalbazaar',
'digitalbazaar/jsdoc'
],
rules: {
quotes: ['off', 'single', {allowTemplateLiterals: true}],
}
};
54 changes: 27 additions & 27 deletions common.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* ... stolen from Gregg Kellogg of the JSON-LD 1.1 Working Group */
/* ... who stole it from Manu Sporny of the JSON-LD 1.0 Working Group */
/* ... who stole it from Shane McCarron, that beautiful, beautiful man. */
var ccg = {
const ccg = {
// Add as the respecConfig localBiblio variable
// Extend or override global respec references
localBiblio: {
Expand All @@ -17,7 +17,7 @@ var ccg = {
status: "ED",
publisher: "Decentralized Identifier Working Group"
},
"REST": {
REST: {
title: "Architectural Styles and the Design of Network-based Software Architectures",
date: "2000",
href: "http://www.ics.uci.edu/~fielding/pubs/dissertation/",
Expand Down Expand Up @@ -55,7 +55,7 @@ var ccg = {
"HTTP-SIGNATURES": {
aliasOf: "http-signatures"
},
"MACAROONS": {
MACAROONS: {
title: 'Macaroons',
// TODO: create spec
href: 'http://macaroons.io/',
Expand All @@ -69,15 +69,15 @@ var ccg = {
href: 'https://github.com/openbadges/openbadges-specification',
authors: ['Brian Brennan', 'Mike Larsson', 'Chris McAvoy',
'Nate Otto', 'Kerri Lemoie'],
status: 'BA-DRAFT',
publisher: 'Badge Alliance Standard Working Group'
status: 'BA-DRAFT',
publisher: 'Badge Alliance Standard Working Group'
},
'RDF-NORMALIZATION': {
title: 'RDF Dataset Normalization',
href: 'http://json-ld.github.io/normalization/spec/',
authors: ['Dave Longley', 'Manu Sporny'],
status: 'CG-DRAFT',
publisher: 'Credentials W3C Community Group'
status: 'CG-DRAFT',
publisher: 'Credentials W3C Community Group'
},
"LD-PROOFS": {
title: "Linked Data Proofs",
Expand Down Expand Up @@ -108,7 +108,7 @@ var ccg = {
],
status: "Personal View"
},
"HASHLINK": {
HASHLINK: {
title: "Cryptographic Hyperlinks",
date: "December 2018",
href: "https://tools.ietf.org/html/draft-sporny-hashlink-05",
Expand All @@ -118,7 +118,7 @@ var ccg = {
status: "Internet-Draft",
publisher: "IETF"
},
"BASE58": {
BASE58: {
title: "The Base58 Encoding Scheme",
date: "October 2020",
href: "https://tools.ietf.org/html/draft-msporny-base58",
Expand Down Expand Up @@ -167,7 +167,7 @@ var ccg = {
date: "2011",
publisher: "Information and Privacy Commissioner"
},
"MULTIBASE": {
MULTIBASE: {
title: "The Multibase Encoding Scheme",
date: "February 2021",
href: "https://datatracker.ietf.org/doc/html/draft-multiformats-multibase-03",
Expand Down Expand Up @@ -201,20 +201,20 @@ var ccg = {
}
};

require(["core/pubsubhub"], (respecEvents) => {
require(["core/pubsubhub"], respecEvents => {
"use strict";

respecEvents.sub('end-all', (message) => {
respecEvents.sub('end-all', message => {
// remove data-cite on where the citation is to ourselves.
const selfDfns = document.querySelectorAll("dfn[data-cite^='" + respecConfig.shortName.toUpperCase() + "#']");
for (const dfn of selfDfns) {
for(const dfn of selfDfns) {
delete dfn.dataset.cite;
}

// Update data-cite references to ourselves.
const selfRefs = document.querySelectorAll("a[data-cite^='" + respecConfig.shortName.toUpperCase() + "#']");
for (const anchor of selfRefs) {
anchor.href= anchor.dataset.cite.replace(/^.*#/,"#");
for(const anchor of selfRefs) {
anchor.href = anchor.dataset.cite.replace(/^.*#/, "#");
delete anchor.dataset.cite;
}

Expand All @@ -226,30 +226,30 @@ require(["core/pubsubhub"], (respecEvents) => {
// To ensure a definition appears in the Terminology section, use
// and link to it!
// This is triggered by postProcess in the respec config.
function restrictRefs(utils, content, url){
function restrictRefs(utils, content, url) {

// Get set of ids internal dfns referenced in the spec body
const internalDfnLinks = document.querySelectorAll("a.internalDFN");

let internalDfnIds = new Set();
for (const dfnLink of internalDfnLinks) {
const internalDfnIds = new Set();
for(const dfnLink of internalDfnLinks) {
const dfnHref = dfnLink.href.split("#")[1];
internalDfnIds.add(dfnHref);
}

// Remove unused dfns from the termlist
const termlist = document.querySelector(".termlist");
const linkIdsInDfns = [];
for (const child of termlist.querySelectorAll("dfn")){
if (!internalDfnIds.has(child.id)){
let dt = child.closest("dt");
let dd = dt.nextElementSibling;
for(const child of termlist.querySelectorAll("dfn")) {
if(!internalDfnIds.has(child.id)) {
const dt = child.closest("dt");
const dd = dt.nextElementSibling;

// Get internal links from dfns we're going to remove
// because these show up in the dfn-panels later and then
// trigger the local-refs-exist linter (see below)
const linksInDfn = dd.querySelectorAll("a.internalDFN");
for (link of linksInDfn) {
for(link of linksInDfn) {
linkIdsInDfns.push(link.id);
}

Expand All @@ -263,15 +263,15 @@ function restrictRefs(utils, content, url){
// (this seems like a hack, there's probably a better way to hook into respec
// before it gets to this point)
const dfnPanels = document.querySelectorAll(".dfn-panel");
for (const panel of dfnPanels) {
if (!internalDfnIds.has(panel.querySelector(".self-link").href.split("#")[1])){
for(const panel of dfnPanels) {
if(!internalDfnIds.has(panel.querySelector(".self-link").href.split("#")[1])) {
panel.parentNode.removeChild(panel);
}

// Remove references to dfns we removed which link to other dfns
const panelLinks = panel.querySelectorAll("li a");
for (const link of panelLinks) {
if (linkIdsInDfns.includes(link.href.split("#")[1])) {
for(const link of panelLinks) {
if(linkIdsInDfns.includes(link.href.split("#")[1])) {
link.parentNode.removeChild(link);
}
}
Expand Down
16 changes: 11 additions & 5 deletions holder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,14 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/VerifiablePresentation"
$ref: "#/components/schemas/VerifiablePresentationResponse"
responses:
"200":
description: Received data was accepted.
content:
application/json:
schema:
$ref: "#/components/schemas/VerifiablePresentationRequest"
$ref: "#/components/schemas/VerifiablePresentationResponse"
"400":
description: Received data is malformed.
content:
Expand Down Expand Up @@ -437,7 +437,10 @@ components:
options:
$ref: "./components/PresentCredentialOptions.yml#/components/schemas/PresentCredentialOptions"
ProvePresentationResponse:
$ref: "./components/VerifiablePresentation.yml#/components/schemas/VerifiablePresentation"
type: object
properties:
verifiablePresentation:
$ref: "./components/VerifiablePresentation.yml#/components/schemas/VerifiablePresentation"
NotifyPresentationAvailableRequest:
type: object
properties:
Expand Down Expand Up @@ -522,7 +525,10 @@ components:
$ref: "./components/ErrorResponse.yml#/components/schemas/ErrorResponse"
StorePresentationRequest:
$ref: "./components/VerifiablePresentation.yml#/components/schemas/VerifiablePresentation"
VerifiablePresentation:
$ref: "./components/VerifiablePresentation.yml#/components/schemas/VerifiablePresentation"
VerifiablePresentationRequest:
$ref: "./components/VerifiablePresentationRequest.yml#/components/schemas/VerifiablePresentationRequest"
VerifiablePresentationResponse:
type: object
properties:
verifiablePresentation:
$ref: "./components/VerifiablePresentation.yml#/components/schemas/VerifiablePresentation"
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// noop
// noop
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "openapi bundle *.yml --output ./api/bundles/ && openapi join ./api/bundles/*.yml --prefix-tags-with-filename && mv ./openapi.yaml ./api/vc-api.yaml",
"serve": "http-server ./api --cors",
"serveIndex": "http-server . --cors",
"lint": "openapi lint *.yml --extends recommended"
"lint": "openapi lint *.yml --extends recommended",
"eslint": "eslint ."
},
"repository": {
"type": "git",
Expand All @@ -26,6 +27,10 @@
"homepage": "https://github.com/w3c-ccg/vc-api#readme",
"devDependencies": {
"@redocly/cli": "^1.0.0-beta.102",
"eslint": "^8.26.0",
"eslint-config-digitalbazaar": "^4.1.0",
"eslint-plugin-jsdoc": "^39.3.25",
"eslint-plugin-unicorn": "^44.0.2",
"http-server": "^14.1.1"
}
}
Loading