Improve property name

This commit is contained in:
Yarmo Mackenbach 2021-04-30 15:32:34 +02:00
parent b643815fee
commit e718c02628
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1

View file

@ -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<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 {
/**
@ -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,
}
}
}