{"action":"created","comment":{"url":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls/comments/231697804","pull_request_review_id":172718697,"id":231697804,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMTY5NzgwNA==","diff_hunk":"@@ -0,0 +1,154 @@\n+/**\n+ * Linked Data Signatures/Proofs\n+ *\n+ * @author Christopher Lemmer Webber\n+ * @author Ganesh Annan <gannan@digitalbazaar.com>\n+ *\n+ * @license BSD 3-Clause License\n+ * Copyright (c) 2018 Digital Bazaar, Inc.\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or without\n+ * modification, are permitted provided that the following conditions are met:\n+ *\n+ * Redistributions of source code must retain the above copyright notice,\n+ * this list of conditions and the following disclaimer.\n+ *\n+ * Redistributions in binary form must reproduce the above copyright\n+ * notice, this list of conditions and the following disclaimer in the\n+ * documentation and/or other materials provided with the distribution.\n+ *\n+ * Neither the name of the Digital Bazaar, Inc. nor the names of its\n+ * contributors may be used to endorse or promote products derived from\n+ * this software without specific prior written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n+ * IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\n+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\n+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+'use strict';\n+\n+const defaultCaveatRegistry = require('./caveatRegistry');\n+const vocab = require('./vocab');\n+\n+const api = {};\n+module.exports = api;\n+\n+const {\n+  capabilityDelegationUri,\n+  caveatUri,\n+  invocationTargetUri,\n+  invokerUri,\n+  parentCapabilityUri\n+} = vocab;\n+\n+/**\n+ * Retrieves a capability's parent's invoker\n+ *\n+ * @param {Object} capability - the fully expanded JSON-LD document for the\n+ *                              object capability\n+ * @param {Object} documentLoader - a JSON-LD document loader\n+ *\n+ */\n+api.getParentInvoker = async ({capability, documentLoader}) => {\n+  const {document: parentCapability} =\n+    await documentLoader(capability[parentCapabilityUri]);\n+\n+  return parentCapability.invoker;\n+};\n+\n+/**\n+ * Plucks the single element of an array that contains a single item.\n+ *\n+ * @param {Array} array - an array with one item.\n+ */\n+api.getOneOrDie = array => {\n+  if (!Array.isArray(array) || array.length != 1) {\n+    throw new Error('Expected an array of size 1');\n+  }\n+  return array[0];\n+};\n+\n+/**\n+ * Retrieves the invoker from a capability.\n+ *\n+ * @param {Object} capability - the fully expanded JSON-LD document for the\n+ *                              object capability\n+ */\n+api.getInvoker = capability => {\n+  const invoker = capability[invokerUri];\n+  const id = capability['@id'];\n+  if(!invoker || !id) {","path":"lib/utils.js","position":89,"original_position":89,"commit_id":"78f8e56c2dc143c395c6447da87602649bdba7e5","original_commit_id":"78f8e56c2dc143c395c6447da87602649bdba7e5","user":{"login":"mattcollier","id":902041,"node_id":"MDQ6VXNlcjkwMjA0MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/902041?v=4","gravatar_id":"","url":"https://api.github.com/users/mattcollier","html_url":"https://github.com/mattcollier","followers_url":"https://api.github.com/users/mattcollier/followers","following_url":"https://api.github.com/users/mattcollier/following{/other_user}","gists_url":"https://api.github.com/users/mattcollier/gists{/gist_id}","starred_url":"https://api.github.com/users/mattcollier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattcollier/subscriptions","organizations_url":"https://api.github.com/users/mattcollier/orgs","repos_url":"https://api.github.com/users/mattcollier/repos","events_url":"https://api.github.com/users/mattcollier/events{/privacy}","received_events_url":"https://api.github.com/users/mattcollier/received_events","type":"User","site_admin":false},"body":"Not clear to me what is supposed to be happening here.  Are both `invoker` and `id` supposed to be defined?  Should this be \r\n```\r\nif(!invoker && !id)\r\n```","created_at":"2018-11-07T22:12:31Z","updated_at":"2018-11-07T22:31:58Z","html_url":"https://github.com/digitalbazaar/ocapld.js/pull/1#discussion_r231697804","pull_request_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls/comments/231697804"},"html":{"href":"https://github.com/digitalbazaar/ocapld.js/pull/1#discussion_r231697804"},"pull_request":{"href":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls/1","id":228061586,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI4MDYxNTg2","html_url":"https://github.com/digitalbazaar/ocapld.js/pull/1","diff_url":"https://github.com/digitalbazaar/ocapld.js/pull/1.diff","patch_url":"https://github.com/digitalbazaar/ocapld.js/pull/1.patch","issue_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/issues/1","number":1,"state":"open","locked":false,"title":"Refactor","user":{"login":"gannan08","id":13918179,"node_id":"MDQ6VXNlcjEzOTE4MTc5","avatar_url":"https://avatars3.githubusercontent.com/u/13918179?v=4","gravatar_id":"","url":"https://api.github.com/users/gannan08","html_url":"https://github.com/gannan08","followers_url":"https://api.github.com/users/gannan08/followers","following_url":"https://api.github.com/users/gannan08/following{/other_user}","gists_url":"https://api.github.com/users/gannan08/gists{/gist_id}","starred_url":"https://api.github.com/users/gannan08/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gannan08/subscriptions","organizations_url":"https://api.github.com/users/gannan08/orgs","repos_url":"https://api.github.com/users/gannan08/repos","events_url":"https://api.github.com/users/gannan08/events{/privacy}","received_events_url":"https://api.github.com/users/gannan08/received_events","type":"User","site_admin":false},"body":"WIP","created_at":"2018-11-02T21:17:47Z","updated_at":"2018-11-07T22:31:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3c7f69931589d2d431957ea5a7aee6db66c39542","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls/1/commits","review_comments_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls/1/comments","review_comment_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/issues/1/comments","statuses_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/statuses/78f8e56c2dc143c395c6447da87602649bdba7e5","head":{"label":"digitalbazaar:refactor","ref":"refactor","sha":"78f8e56c2dc143c395c6447da87602649bdba7e5","user":{"login":"digitalbazaar","id":167436,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NzQzNg==","avatar_url":"https://avatars3.githubusercontent.com/u/167436?v=4","gravatar_id":"","url":"https://api.github.com/users/digitalbazaar","html_url":"https://github.com/digitalbazaar","followers_url":"https://api.github.com/users/digitalbazaar/followers","following_url":"https://api.github.com/users/digitalbazaar/following{/other_user}","gists_url":"https://api.github.com/users/digitalbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbazaar/subscriptions","organizations_url":"https://api.github.com/users/digitalbazaar/orgs","repos_url":"https://api.github.com/users/digitalbazaar/repos","events_url":"https://api.github.com/users/digitalbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbazaar/received_events","type":"Organization","site_admin":false},"repo":{"id":118816434,"node_id":"MDEwOlJlcG9zaXRvcnkxMTg4MTY0MzQ=","name":"ocapld.js","full_name":"digitalbazaar/ocapld.js","private":false,"owner":{"login":"digitalbazaar","id":167436,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NzQzNg==","avatar_url":"https://avatars3.githubusercontent.com/u/167436?v=4","gravatar_id":"","url":"https://api.github.com/users/digitalbazaar","html_url":"https://github.com/digitalbazaar","followers_url":"https://api.github.com/users/digitalbazaar/followers","following_url":"https://api.github.com/users/digitalbazaar/following{/other_user}","gists_url":"https://api.github.com/users/digitalbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbazaar/subscriptions","organizations_url":"https://api.github.com/users/digitalbazaar/orgs","repos_url":"https://api.github.com/users/digitalbazaar/repos","events_url":"https://api.github.com/users/digitalbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbazaar/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/digitalbazaar/ocapld.js","description":"Linked Data Capabilities reference implementation","fork":false,"url":"https://api.github.com/repos/digitalbazaar/ocapld.js","forks_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/forks","keys_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/teams","hooks_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/hooks","issue_events_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/issues/events{/number}","events_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/events","assignees_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/assignees{/user}","branches_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/branches{/branch}","tags_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/tags","blobs_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/statuses/{sha}","languages_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/languages","stargazers_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/stargazers","contributors_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/contributors","subscribers_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/subscribers","subscription_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/subscription","commits_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/contents/{+path}","compare_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/merges","archive_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/downloads","issues_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/issues{/number}","pulls_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls{/number}","milestones_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/milestones{/number}","notifications_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/labels{/name}","releases_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/releases{/id}","deployments_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/deployments","created_at":"2018-01-24T20:11:36Z","updated_at":"2018-07-03T17:49:19Z","pushed_at":"2018-11-07T22:04:44Z","git_url":"git://github.com/digitalbazaar/ocapld.js.git","ssh_url":"git@github.com:digitalbazaar/ocapld.js.git","clone_url":"https://github.com/digitalbazaar/ocapld.js.git","svn_url":"https://github.com/digitalbazaar/ocapld.js","homepage":null,"size":60,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"digitalbazaar:master","ref":"master","sha":"91f169fec193e09a54a73dc59222230d831075d3","user":{"login":"digitalbazaar","id":167436,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NzQzNg==","avatar_url":"https://avatars3.githubusercontent.com/u/167436?v=4","gravatar_id":"","url":"https://api.github.com/users/digitalbazaar","html_url":"https://github.com/digitalbazaar","followers_url":"https://api.github.com/users/digitalbazaar/followers","following_url":"https://api.github.com/users/digitalbazaar/following{/other_user}","gists_url":"https://api.github.com/users/digitalbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbazaar/subscriptions","organizations_url":"https://api.github.com/users/digitalbazaar/orgs","repos_url":"https://api.github.com/users/digitalbazaar/repos","events_url":"https://api.github.com/users/digitalbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbazaar/received_events","type":"Organization","site_admin":false},"repo":{"id":118816434,"node_id":"MDEwOlJlcG9zaXRvcnkxMTg4MTY0MzQ=","name":"ocapld.js","full_name":"digitalbazaar/ocapld.js","private":false,"owner":{"login":"digitalbazaar","id":167436,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NzQzNg==","avatar_url":"https://avatars3.githubusercontent.com/u/167436?v=4","gravatar_id":"","url":"https://api.github.com/users/digitalbazaar","html_url":"https://github.com/digitalbazaar","followers_url":"https://api.github.com/users/digitalbazaar/followers","following_url":"https://api.github.com/users/digitalbazaar/following{/other_user}","gists_url":"https://api.github.com/users/digitalbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbazaar/subscriptions","organizations_url":"https://api.github.com/users/digitalbazaar/orgs","repos_url":"https://api.github.com/users/digitalbazaar/repos","events_url":"https://api.github.com/users/digitalbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbazaar/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/digitalbazaar/ocapld.js","description":"Linked Data Capabilities reference implementation","fork":false,"url":"https://api.github.com/repos/digitalbazaar/ocapld.js","forks_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/forks","keys_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/teams","hooks_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/hooks","issue_events_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/issues/events{/number}","events_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/events","assignees_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/assignees{/user}","branches_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/branches{/branch}","tags_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/tags","blobs_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/statuses/{sha}","languages_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/languages","stargazers_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/stargazers","contributors_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/contributors","subscribers_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/subscribers","subscription_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/subscription","commits_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/contents/{+path}","compare_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/merges","archive_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/downloads","issues_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/issues{/number}","pulls_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls{/number}","milestones_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/milestones{/number}","notifications_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/labels{/name}","releases_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/releases{/id}","deployments_url":"https://api.github.com/repos/digitalbazaar/ocapld.js/deployments","created_at":"2018-01-24T20:11:36Z","updated_at":"2018-07-03T17:49:19Z","pushed_at":"2018-11-07T22:04:44Z","git_url":"git://github.com/digitalbazaar/ocapld.js.git","ssh_url":"git@github.com:digitalbazaar/ocapld.js.git","clone_url":"https://github.com/digitalbazaar/ocapld.js.git","svn_url":"https://github.com/digitalbazaar/ocapld.js","homepage":null,"size":60,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls/1"},"html":{"href":"https://github.com/digitalbazaar/ocapld.js/pull/1"},"issue":{"href":"https://api.github.com/repos/digitalbazaar/ocapld.js/issues/1"},"comments":{"href":"https://api.github.com/repos/digitalbazaar/ocapld.js/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/digitalbazaar/ocapld.js/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/digitalbazaar/ocapld.js/statuses/78f8e56c2dc143c395c6447da87602649bdba7e5"}},"author_association":"NONE"}}
{"actor":{"display_login":"mattcollier"}}