jsonld-signatures
Advanced tools
Comparing version 2.2.1 to 2.2.2
# jsonld-signatures ChangeLog | ||
## 2.2.2 - 2018-03-08 | ||
### Fixed | ||
- Fix bug with explicitly passed `undefined` options. | ||
## 2.2.1 - 2018-03-01 | ||
@@ -4,0 +9,0 @@ |
@@ -96,9 +96,9 @@ /* | ||
// validate common options | ||
if ('creator' in options && typeof options.creator !== 'string') { | ||
if (options.creator !== undefined && typeof options.creator !== 'string') { | ||
throw new TypeError('"options.creator" must be a URL string.'); | ||
} | ||
if ('domain' in options && typeof options.domain !== 'string') { | ||
if (options.domain !== undefined && typeof options.domain !== 'string') { | ||
throw new TypeError('"options.domain" must be a string.'); | ||
} | ||
if ('nonce' in options && typeof options.nonce !== 'string') { | ||
if (options.nonce !== undefined && typeof options.nonce !== 'string') { | ||
throw new TypeError('"options.nonce" must be a string.'); | ||
@@ -132,3 +132,3 @@ } | ||
// set default `now` date if not given in `proof` or `options` | ||
if (!('created' in proof) && !('date' in options)) { | ||
if (proof.created === undefined && options.date === undefined) { | ||
options.date = new Date(); | ||
@@ -138,3 +138,3 @@ } | ||
// ensure date is in string format | ||
if ('date' in options && typeof options.date !== 'string') { | ||
if (options.date !== undefined && typeof options.date !== 'string') { | ||
// TODO: parse non-string date and force to w3c format? | ||
@@ -148,12 +148,12 @@ options.date = util.w3cDate(options.date); | ||
// add API overrides | ||
if ('date' in options) { | ||
if (options.date !== undefined) { | ||
proof.created = options.date; | ||
} | ||
if ('creator' in options) { | ||
if (options.creator !== undefined) { | ||
proof.creator = options.creator; | ||
} | ||
if ('domain' in options) { | ||
if (options.domain !== undefined) { | ||
proof.domain = options.domain; | ||
} | ||
if ('nonce' in options) { | ||
if (options.nonce !== undefined) { | ||
proof.nonce = options.nonce; | ||
@@ -313,3 +313,3 @@ } | ||
// ensure key is not revoked | ||
if ('revoked' in publicKey) { | ||
if (publicKey.revoked !== undefined) { | ||
throw new Error('The document was signed with a key that has been revoked.'); | ||
@@ -316,0 +316,0 @@ } |
@@ -83,9 +83,9 @@ /* | ||
// validate common options | ||
if('creator' in options && typeof options.creator !== 'string') { | ||
if(options.creator !== undefined && typeof options.creator !== 'string') { | ||
throw new TypeError('"options.creator" must be a URL string.'); | ||
} | ||
if('domain' in options && typeof options.domain !== 'string') { | ||
if(options.domain !== undefined && typeof options.domain !== 'string') { | ||
throw new TypeError('"options.domain" must be a string.'); | ||
} | ||
if('nonce' in options && typeof options.nonce !== 'string') { | ||
if(options.nonce !== undefined && typeof options.nonce !== 'string') { | ||
throw new TypeError('"options.nonce" must be a string.'); | ||
@@ -122,3 +122,3 @@ } | ||
// set default `now` date if not given in `proof` or `options` | ||
if(!('created' in proof) && !('date' in options)) { | ||
if(proof.created === undefined && options.date === undefined) { | ||
options.date = new Date(); | ||
@@ -128,3 +128,3 @@ } | ||
// ensure date is in string format | ||
if('date' in options && typeof options.date !== 'string') { | ||
if(options.date !== undefined && typeof options.date !== 'string') { | ||
// TODO: parse non-string date and force to w3c format? | ||
@@ -138,12 +138,12 @@ options.date = util.w3cDate(options.date); | ||
// add API overrides | ||
if('date' in options) { | ||
if(options.date !== undefined) { | ||
proof.created = options.date; | ||
} | ||
if('creator' in options) { | ||
if(options.creator !== undefined) { | ||
proof.creator = options.creator; | ||
} | ||
if('domain' in options) { | ||
if(options.domain !== undefined) { | ||
proof.domain = options.domain; | ||
} | ||
if('nonce' in options) { | ||
if(options.nonce !== undefined) { | ||
proof.nonce = options.nonce; | ||
@@ -281,3 +281,3 @@ } | ||
// ensure key is not revoked | ||
if('revoked' in publicKey) { | ||
if(publicKey.revoked !== undefined) { | ||
throw new Error( | ||
@@ -284,0 +284,0 @@ 'The document was signed with a key that has been revoked.'); |
{ | ||
"name": "jsonld-signatures", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"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
419559