Constructor
new Persona(name, claims)
- Source:
Example
const claim = Claim('https://alice.tld', '123');
const pers = Persona('Alice', 'About Alice', [claim]);
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name of the persona |
claims |
Array.<Claim> | Claims of the persona |
Classes
Members
avatarUrl :string|null
- Description:
URL to an avatar image
- Source:
URL to an avatar image
Type:
- string | null
claims :Array.<Claim>
- Description:
List of identity claims
- Source:
List of identity claims
Type:
- Array.<Claim>
description :string|null
- Description:
Description to be displayed on the profile page
- Source:
Description to be displayed on the profile page
Type:
- string | null
email :string|null
- Description:
Email address of the persona
- Source:
Email address of the persona
Type:
- string | null
identifier :string|null
- Description:
Identifier of the persona
- Source:
Identifier of the persona
Type:
- string | null
isRevoked :boolean
- Description:
Has the persona been revoked
- Source:
Has the persona been revoked
Type:
- boolean
name :string
- Description:
Name to be displayed on the profile page
- Source:
Name to be displayed on the profile page
Type:
- string
themeColor :string|null
- Description:
Theme color
- Source:
Theme color
Type:
- string | null
Methods
addClaim(claim)
- Description:
Add a claim
- Source:
Parameters:
Name | Type | Description |
---|---|---|
claim |
Claim | Claim to add |
revoke()
- Description:
Revoke the persona
- Source:
setAvatarUrl(avatarUrl)
- Description:
Set the URL to the persona's avatar
- Source:
Parameters:
Name | Type | Description |
---|---|---|
avatarUrl |
string | URL to the persona's avatar |
setDescription(description)
- Description:
Set the persona's description
- Source:
Parameters:
Name | Type | Description |
---|---|---|
description |
string | Description of the persona |
setEmailAddress(email)
- Description:
Set the persona's email address
- Source:
Parameters:
Name | Type | Description |
---|---|---|
email |
string | Email address of the persona |
setIdentifier(identifier)
- Description:
Set the persona's identifier
- Source:
Parameters:
Name | Type | Description |
---|---|---|
identifier |
string | Identifier of the persona |
toJSON() → {object}
- Description:
Get a JSON representation of the persona
- Source:
Returns:
JSON representation of the persona
- Type
- object
(static) fromJSON(personaObject, profileVersion) → {Persona|Error}
- Description:
Parse a JSON object and convert it into a persona
- Source:
Example
doip.Persona.fromJSON(JSON.stringify(persona), 2);
Parameters:
Name | Type | Description |
---|---|---|
personaObject |
object | JSON representation of a persona |
profileVersion |
number | Version of the Profile containing the persona |
Returns:
Parsed persona
- Type
- Persona | Error