jsonld-signatures
Advanced tools
Comparing version 2.3.0 to 2.3.1
# jsonld-signatures ChangeLog | ||
## 2.3.1 - 2018-09-05 | ||
### Changed | ||
- Optimize `LinkedDataSignature` `createVerifyData` to remove | ||
one round of compaction and one round of expansion. This | ||
eliminates a total of four rounds (2x compaction, 2x expansion) | ||
for sign+verify processes as `createVerifyData` is used | ||
in both `sign` and `verify`. | ||
## 2.3.0 - 2018-03-20 | ||
@@ -4,0 +13,0 @@ |
@@ -9,3 +9,4 @@ /* | ||
SECURITY_CONTEXT_V1_URL: 'https://w3id.org/security/v1', | ||
SECURITY_CONTEXT_V2_URL: 'https://w3id.org/security/v2' | ||
SECURITY_CONTEXT_V2_URL: 'https://w3id.org/security/v2', | ||
SECURITY_PROOF_URL: 'https://w3id.org/security#proof' | ||
}; |
@@ -6,2 +6,4 @@ /* | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
@@ -34,3 +36,4 @@ | ||
format: 'application/n-quads', | ||
expansionMap: options.expansionMap | ||
expansionMap: options.expansionMap, | ||
skipExpansion: options.skipExpansion === true | ||
}; | ||
@@ -51,3 +54,2 @@ if (options.documentLoader) { | ||
// the top-level object and thus framing is unnecessary? | ||
const jsonld = _this2.injector.use('jsonld'); | ||
@@ -58,4 +60,9 @@ const opts = { expansionMap: options.expansionMap }; | ||
} | ||
const compacted = yield jsonld.compact(input, constants.SECURITY_CONTEXT_URL, opts); | ||
var _ref = yield jsonld.expand(input, opts), | ||
_ref2 = _slicedToArray(_ref, 1), | ||
_ref2$ = _ref2[0]; | ||
const expanded = _ref2$ === undefined ? {} : _ref2$; | ||
// TODO: will need to preserve `proof` when chained signature | ||
@@ -65,4 +72,5 @@ // option is used and implemented in the future | ||
// delete the existing proofs(s) prior to canonicalization | ||
delete compacted.proof; | ||
delete expanded[constants.SECURITY_PROOF_URL]; | ||
// ensure signature values are removed from proof node | ||
@@ -73,3 +81,4 @@ const proof = yield _this2.sanitizeProofNode(options.proof, options); | ||
const c14nProofOptions = yield _this2.canonize(proof, options); | ||
const c14nDocument = yield _this2.canonize(compacted, options); | ||
const canonizeOptions = Object.assign({}, options, { skipExpansion: true }); | ||
const c14nDocument = yield _this2.canonize(expanded, canonizeOptions); | ||
return { | ||
@@ -76,0 +85,0 @@ data: _this2._sha256(c14nProofOptions).getBytes() + _this2._sha256(c14nDocument).getBytes(), |
@@ -9,3 +9,4 @@ /* | ||
SECURITY_CONTEXT_V1_URL: 'https://w3id.org/security/v1', | ||
SECURITY_CONTEXT_V2_URL: 'https://w3id.org/security/v2' | ||
SECURITY_CONTEXT_V2_URL: 'https://w3id.org/security/v2', | ||
SECURITY_PROOF_URL: 'https://w3id.org/security#proof' | ||
}; |
@@ -28,3 +28,4 @@ /* | ||
format: 'application/n-quads', | ||
expansionMap: options.expansionMap | ||
expansionMap: options.expansionMap, | ||
skipExpansion: options.skipExpansion === true | ||
}; | ||
@@ -41,3 +42,2 @@ if(options.documentLoader) { | ||
// the top-level object and thus framing is unnecessary? | ||
const jsonld = this.injector.use('jsonld'); | ||
@@ -48,4 +48,3 @@ const opts = {expansionMap: options.expansionMap}; | ||
} | ||
const compacted = await jsonld.compact( | ||
input, constants.SECURITY_CONTEXT_URL, opts); | ||
const [expanded = {}] = await jsonld.expand(input, opts); | ||
@@ -56,3 +55,3 @@ // TODO: will need to preserve `proof` when chained signature | ||
// delete the existing proofs(s) prior to canonicalization | ||
delete compacted.proof; | ||
delete expanded[constants.SECURITY_PROOF_URL]; | ||
@@ -64,3 +63,4 @@ // ensure signature values are removed from proof node | ||
const c14nProofOptions = await this.canonize(proof, options); | ||
const c14nDocument = await this.canonize(compacted, options); | ||
const canonizeOptions = Object.assign({}, options, {skipExpansion: true}); | ||
const c14nDocument = await this.canonize(expanded, canonizeOptions); | ||
return { | ||
@@ -67,0 +67,0 @@ data: this._sha256(c14nProofOptions).getBytes() + |
{ | ||
"name": "jsonld-signatures", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "An implementation of the Linked Data Signatures specifications for JSON-LD in JavaScript.", | ||
@@ -38,3 +38,3 @@ "homepage": "https://github.com/digitalbazaar/jsonld-signatures", | ||
"chloride": "^2.2.8", | ||
"jsonld": "^1.0.1", | ||
"jsonld": "^1.1.0", | ||
"node-forge": "^0.7.4", | ||
@@ -41,0 +41,0 @@ "semver": "^5.5.0" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
425868
8192
Updatedjsonld@^1.1.0