From fa5af3ab2d680f028ddec613eaf48f852275e91f Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Fri, 30 Apr 2021 12:27:13 +0200 Subject: [PATCH] Fix instantiating a new claim with object data --- src/claim.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/claim.js b/src/claim.js index 67845a9..feed485 100644 --- a/src/claim.js +++ b/src/claim.js @@ -35,7 +35,7 @@ class Claim { /** * Initialize a Claim object * @constructor - * @param {string} [uri] - The URI of the identity claim + * @param {string|object} [uri] - The URI of the identity claim or a JSONified Claim instance * @param {string} [fingerprint] - The fingerprint of the OpenPGP key * @example * const claim = doip.Claim(); @@ -45,6 +45,7 @@ class Claim { constructor(uri, fingerprint) { // Import JSON if (typeof uri === 'object' && 'claimVersion' in uri) { + const data = uri switch (data.claimVersion) { case 1: this._uri = data.uri