forked from Mirrors/doipjs
Release 0.12.3
This commit is contained in:
parent
304e25fed0
commit
2a502f2a42
4 changed files with 35 additions and 20 deletions
|
@ -6,10 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.12.3] - 2021-04-30
|
||||||
|
## Fixed
|
||||||
|
- Ensure an output for the Claim's verification process
|
||||||
|
- Adaptive proxy policy now uses the fallback fetcher for generic access proofs
|
||||||
|
- Refactor bad property names
|
||||||
|
|
||||||
## [0.12.2] - 2021-04-30
|
## [0.12.2] - 2021-04-30
|
||||||
## Fixed
|
## Fixed
|
||||||
- Fix Claim constructor handling of object data
|
- Fix Claim constructor handling of object data
|
||||||
- Refactor bad properties names
|
- Refactor bad property names
|
||||||
|
|
||||||
## [0.12.1] - 2021-04-26
|
## [0.12.1] - 2021-04-26
|
||||||
## Fixed
|
## Fixed
|
||||||
|
|
43
dist/doip.js
vendored
43
dist/doip.js
vendored
|
@ -7515,7 +7515,7 @@ module.exports.default = exports.default;
|
||||||
},{"./util/assertString":107}],113:[function(require,module,exports){
|
},{"./util/assertString":107}],113:[function(require,module,exports){
|
||||||
module.exports={
|
module.exports={
|
||||||
"name": "doipjs",
|
"name": "doipjs",
|
||||||
"version": "0.12.1",
|
"version": "0.12.2",
|
||||||
"description": "Decentralized OpenPGP Identity Proofs library in Node.js",
|
"description": "Decentralized OpenPGP Identity Proofs library in Node.js",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -7619,7 +7619,7 @@ const E = require('./enums')
|
||||||
* @property {string} fingerprint - The fingerprint to verify the claim against
|
* @property {string} fingerprint - The fingerprint to verify the claim against
|
||||||
* @property {string} status - The current status of the claim
|
* @property {string} status - The current status of the claim
|
||||||
* @property {Array<object>} matches - The claim definitions matched against the URI
|
* @property {Array<object>} matches - The claim definitions matched against the URI
|
||||||
* @property {object} result - The result of the verification process
|
* @property {object} verification - The result of the verification process
|
||||||
*/
|
*/
|
||||||
class Claim {
|
class Claim {
|
||||||
/**
|
/**
|
||||||
|
@ -7631,6 +7631,7 @@ class Claim {
|
||||||
* const claim = doip.Claim();
|
* const claim = doip.Claim();
|
||||||
* const claim = doip.Claim('dns:domain.tld?type=TXT');
|
* const claim = doip.Claim('dns:domain.tld?type=TXT');
|
||||||
* const claim = doip.Claim('dns:domain.tld?type=TXT', '123abc123abc');
|
* const claim = doip.Claim('dns:domain.tld?type=TXT', '123abc123abc');
|
||||||
|
* const claimAlt = doip.Claim(JSON.stringify(claim));
|
||||||
*/
|
*/
|
||||||
constructor(uri, fingerprint) {
|
constructor(uri, fingerprint) {
|
||||||
// Import JSON
|
// Import JSON
|
||||||
|
@ -7642,7 +7643,7 @@ class Claim {
|
||||||
this._fingerprint = data.fingerprint
|
this._fingerprint = data.fingerprint
|
||||||
this._status = data.status
|
this._status = data.status
|
||||||
this._matches = data.matches
|
this._matches = data.matches
|
||||||
this._result = data.result
|
this._verification = data.verification
|
||||||
break
|
break
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -7670,7 +7671,7 @@ class Claim {
|
||||||
this._fingerprint = fingerprint ? fingerprint : null
|
this._fingerprint = fingerprint ? fingerprint : null
|
||||||
this._status = E.ClaimStatus.INIT
|
this._status = E.ClaimStatus.INIT
|
||||||
this._matches = null
|
this._matches = null
|
||||||
this._result = null
|
this._verification = null
|
||||||
}
|
}
|
||||||
|
|
||||||
get uri() {
|
get uri() {
|
||||||
|
@ -7692,11 +7693,11 @@ class Claim {
|
||||||
return this._matches
|
return this._matches
|
||||||
}
|
}
|
||||||
|
|
||||||
get result() {
|
get verification() {
|
||||||
if (this._status !== E.ClaimStatus.VERIFIED) {
|
if (this._status !== E.ClaimStatus.VERIFIED) {
|
||||||
throw new Error('This claim has not yet been verified')
|
throw new Error('This claim has not yet been verified')
|
||||||
}
|
}
|
||||||
return this._result
|
return this._verification
|
||||||
}
|
}
|
||||||
|
|
||||||
set uri(uri) {
|
set uri(uri) {
|
||||||
|
@ -7732,7 +7733,7 @@ class Claim {
|
||||||
throw new Error("Cannot change a claim's matches")
|
throw new Error("Cannot change a claim's matches")
|
||||||
}
|
}
|
||||||
|
|
||||||
set result(anything) {
|
set verification(anything) {
|
||||||
throw new Error("Cannot change a claim's verification result")
|
throw new Error("Cannot change a claim's verification result")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7802,7 +7803,7 @@ class Claim {
|
||||||
for (let index = 0; index < this._matches.length; index++) {
|
for (let index = 0; index < this._matches.length; index++) {
|
||||||
const claimData = this._matches[index]
|
const claimData = this._matches[index]
|
||||||
|
|
||||||
let verificationResult,
|
let verificationResult = null,
|
||||||
proofData = null,
|
proofData = null,
|
||||||
proofFetchError
|
proofFetchError
|
||||||
|
|
||||||
|
@ -7824,28 +7825,36 @@ class Claim {
|
||||||
viaProxy: proofData.viaProxy,
|
viaProxy: proofData.viaProxy,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.isAmbiguous()) {
|
|
||||||
// Assume a wrong match and continue
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Consider the proof completed but with a negative result
|
// Consider the proof completed but with a negative result
|
||||||
verificationResult = {
|
verificationResult = verificationResult ? verificationResult : {
|
||||||
result: false,
|
result: false,
|
||||||
completed: true,
|
completed: true,
|
||||||
proof: {},
|
proof: {},
|
||||||
errors: [proofFetchError],
|
errors: [proofFetchError],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.isAmbiguous()) {
|
||||||
|
// Assume a wrong match and continue
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verificationResult.completed) {
|
if (verificationResult.completed) {
|
||||||
// Store the result, keep a single match and stop verifying
|
// Store the result, keep a single match and stop verifying
|
||||||
this._result = verificationResult
|
this._verification = verificationResult
|
||||||
this._matches = [claimData]
|
this._matches = [claimData]
|
||||||
index = this._matches.length
|
index = this._matches.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fail safe verification result
|
||||||
|
verificationResult = verificationResult ? verificationResult : {
|
||||||
|
result: false,
|
||||||
|
completed: true,
|
||||||
|
proof: {},
|
||||||
|
errors: ['Unknown error'],
|
||||||
|
}
|
||||||
|
|
||||||
this._status = E.ClaimStatus.VERIFIED
|
this._status = E.ClaimStatus.VERIFIED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7881,7 +7890,7 @@ class Claim {
|
||||||
fingerprint: this._fingerprint,
|
fingerprint: this._fingerprint,
|
||||||
status: this._status,
|
status: this._status,
|
||||||
matches: this._matches,
|
matches: this._matches,
|
||||||
result: this._result,
|
verification: this._verification,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10539,7 +10548,7 @@ const handleBrowserRequests = (data, opts) => {
|
||||||
case E.ProxyPolicy.ADAPTIVE:
|
case E.ProxyPolicy.ADAPTIVE:
|
||||||
switch (data.proof.request.access) {
|
switch (data.proof.request.access) {
|
||||||
case E.ProofAccess.GENERIC:
|
case E.ProofAccess.GENERIC:
|
||||||
return createDefaultRequestPromise(data, opts)
|
return createFallbackRequestPromise(data, opts)
|
||||||
break
|
break
|
||||||
case E.ProofAccess.NOCORS:
|
case E.ProofAccess.NOCORS:
|
||||||
return createProxyRequestPromise(data, opts)
|
return createProxyRequestPromise(data, opts)
|
||||||
|
|
2
dist/doip.min.js
vendored
2
dist/doip.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "doipjs",
|
"name": "doipjs",
|
||||||
"version": "0.12.2",
|
"version": "0.12.3",
|
||||||
"description": "Decentralized OpenPGP Identity Proofs library in Node.js",
|
"description": "Decentralized OpenPGP Identity Proofs library in Node.js",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
Loading…
Reference in a new issue