jsonld-signatures
Advanced tools
Comparing version 2.1.2 to 2.1.3
# jsonld-signatures ChangeLog | ||
## 2.1.3 - 2018-02-21 | ||
### Fixed | ||
- Ensure `proofPurpose` property's objects are framed as | ||
application suites containing references to public keys | ||
not direct public keys. | ||
## 2.1.2 - 2018-02-21 | ||
@@ -4,0 +11,0 @@ |
@@ -108,3 +108,16 @@ /*! | ||
for (let i = 0; i < framedOwners.length; ++i) { | ||
const keys = jsonld.getValues(framedOwners[i], proofPurpose); | ||
let keys; | ||
// direct access to public keys | ||
if (proofPurpose === 'publicKey') { | ||
keys = jsonld.getValues(framedOwners[i], proofPurpose); | ||
} else { | ||
// FIXME: apply known application suite rules and allow for custom | ||
// functions to be passed to handle unknown ones | ||
// indirect access via application suites | ||
keys = jsonld.getValues(framedOwners[i], proofPurpose).map(function (appSuite) { | ||
return appSuite.publicKey; | ||
}); | ||
} | ||
if (keys.some(function (key) { | ||
@@ -203,6 +216,34 @@ return typeof key === 'object' ? key.id === framedKey.id : key === framedKey.id; | ||
'@context': constants.SECURITY_CONTEXT_URL, | ||
'@requireAll': false | ||
}; | ||
if (proofPurpose === 'publicKey') { | ||
// direct access to public keys | ||
frame.publicKey = { '@embed': '@never' }; | ||
} else { | ||
// indirect access to public keys via application suites | ||
frame[proofPurpose] = { | ||
'@embed': '@always', | ||
publicKey: { '@embed': '@never' } | ||
}; | ||
} | ||
const jsonld = _this5.injector.use('jsonld'); | ||
const opts = {}; | ||
if (options.documentLoader) { | ||
opts.documentLoader = options.documentLoader; | ||
} | ||
const framed = yield jsonld.frame(owners, frame, opts); | ||
return framed['@graph']; | ||
})(); | ||
} | ||
_frameAppSuite(owners, proofPurpose, options) { | ||
var _this6 = this; | ||
return _asyncToGenerator(function* () { | ||
const frame = { | ||
'@context': constants.SECURITY_CONTEXT_URL, | ||
'@requireAll': false, | ||
[proofPurpose]: { '@embed': '@never' } | ||
}; | ||
const jsonld = _this5.injector.use('jsonld'); | ||
const jsonld = _this6.injector.use('jsonld'); | ||
const opts = {}; | ||
@@ -209,0 +250,0 @@ if (options.documentLoader) { |
@@ -91,3 +91,15 @@ /*! | ||
for(let i = 0; i < framedOwners.length; ++i) { | ||
const keys = jsonld.getValues(framedOwners[i], proofPurpose); | ||
let keys; | ||
// direct access to public keys | ||
if(proofPurpose === 'publicKey') { | ||
keys = jsonld.getValues(framedOwners[i], proofPurpose); | ||
} else { | ||
// FIXME: apply known application suite rules and allow for custom | ||
// functions to be passed to handle unknown ones | ||
// indirect access via application suites | ||
keys = jsonld.getValues(framedOwners[i], proofPurpose) | ||
.map(appSuite => appSuite.publicKey); | ||
} | ||
if(keys.some(key => typeof key === 'object' ? | ||
@@ -173,2 +185,26 @@ key.id === framedKey.id : key === framedKey.id)) { | ||
'@context': constants.SECURITY_CONTEXT_URL, | ||
'@requireAll': false | ||
}; | ||
if(proofPurpose === 'publicKey') { | ||
// direct access to public keys | ||
frame.publicKey = {'@embed': '@never'}; | ||
} else { | ||
// indirect access to public keys via application suites | ||
frame[proofPurpose] = { | ||
'@embed': '@always', | ||
publicKey: {'@embed': '@never'} | ||
}; | ||
} | ||
const jsonld = this.injector.use('jsonld'); | ||
const opts = {}; | ||
if(options.documentLoader) { | ||
opts.documentLoader = options.documentLoader; | ||
} | ||
const framed = await jsonld.frame(owners, frame, opts); | ||
return framed['@graph']; | ||
} | ||
async _frameAppSuite(owners, proofPurpose, options) { | ||
const frame = { | ||
'@context': constants.SECURITY_CONTEXT_URL, | ||
'@requireAll': false, | ||
@@ -175,0 +211,0 @@ [proofPurpose]: {'@embed': '@never'} |
{ | ||
"name": "jsonld-signatures", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "An implementation of the Linked Data Signatures specifications for JSON-LD in JavaScript.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/digitalbazaar/jsonld-signatures", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
413586
7998