Fix instantiating a new claim with object data

This commit is contained in:
Yarmo Mackenbach 2021-04-30 12:27:13 +02:00
parent 780d4d0c69
commit fa5af3ab2d
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1

View file

@ -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