mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-23 06:59:29 -07:00
Fix instantiating a new claim with object data
This commit is contained in:
parent
780d4d0c69
commit
fa5af3ab2d
1 changed files with 2 additions and 1 deletions
|
@ -35,7 +35,7 @@ class Claim {
|
||||||
/**
|
/**
|
||||||
* Initialize a Claim object
|
* Initialize a Claim object
|
||||||
* @constructor
|
* @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
|
* @param {string} [fingerprint] - The fingerprint of the OpenPGP key
|
||||||
* @example
|
* @example
|
||||||
* const claim = doip.Claim();
|
* const claim = doip.Claim();
|
||||||
|
@ -45,6 +45,7 @@ class Claim {
|
||||||
constructor(uri, fingerprint) {
|
constructor(uri, fingerprint) {
|
||||||
// Import JSON
|
// Import JSON
|
||||||
if (typeof uri === 'object' && 'claimVersion' in uri) {
|
if (typeof uri === 'object' && 'claimVersion' in uri) {
|
||||||
|
const data = uri
|
||||||
switch (data.claimVersion) {
|
switch (data.claimVersion) {
|
||||||
case 1:
|
case 1:
|
||||||
this._uri = data.uri
|
this._uri = data.uri
|
||||||
|
|
Loading…
Reference in a new issue