From e718c0262869b3d3473db95e8edd9d876d30c9e5 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Fri, 30 Apr 2021 15:32:34 +0200 Subject: [PATCH] Improve property name --- src/claim.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/claim.js b/src/claim.js index 97af3b3..c03c0a4 100644 --- a/src/claim.js +++ b/src/claim.js @@ -29,7 +29,7 @@ const E = require('./enums') * @property {string} fingerprint - The fingerprint to verify the claim against * @property {string} status - The current status of the claim * @property {Array} 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 { /** @@ -41,6 +41,7 @@ class Claim { * const claim = doip.Claim(); * const claim = doip.Claim('dns:domain.tld?type=TXT'); * const claim = doip.Claim('dns:domain.tld?type=TXT', '123abc123abc'); + * const claimAlt = doip.Claim(JSON.stringify(claim)); */ constructor(uri, fingerprint) { // Import JSON @@ -52,7 +53,7 @@ class Claim { this._fingerprint = data.fingerprint this._status = data.status this._matches = data.matches - this._result = data.result + this._verification = data.verification break default: @@ -80,7 +81,7 @@ class Claim { this._fingerprint = fingerprint ? fingerprint : null this._status = E.ClaimStatus.INIT this._matches = null - this._result = null + this._verification = null } get uri() { @@ -102,11 +103,11 @@ class Claim { return this._matches } - get result() { + get verification() { if (this._status !== E.ClaimStatus.VERIFIED) { throw new Error('This claim has not yet been verified') } - return this._result + return this._verification } set uri(uri) { @@ -142,7 +143,7 @@ class Claim { 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") } @@ -250,7 +251,7 @@ class Claim { if (verificationResult.completed) { // Store the result, keep a single match and stop verifying - this._result = verificationResult + this._verification = verificationResult this._matches = [claimData] index = this._matches.length } @@ -291,7 +292,7 @@ class Claim { fingerprint: this._fingerprint, status: this._status, matches: this._matches, - result: this._result, + verification: this._verification, } } }