diff --git a/src/asp.js b/src/asp.js index 2b33ab1..2c05289 100644 --- a/src/asp.js +++ b/src/asp.js @@ -130,6 +130,8 @@ export async function parseProfileJws (profileJws, uri) { const profileName = payloadJson['http://ariadne.id/name'] /** @type {string} */ const profileDescription = payloadJson['http://ariadne.id/description'] + /** @type {string} */ + const profileThemeColor = payloadJson['http://ariadne.id/color'] /** @type {string[]} */ const profileClaims = payloadJson['http://ariadne.id/claims'] @@ -139,6 +141,9 @@ export async function parseProfileJws (profileJws, uri) { if (profileDescription) { pe.setDescription(profileDescription) } + if (profileThemeColor && /^#([0-9A-F]{3}){1,2}$/i.test(profileThemeColor)) { + pe.themeColor = profileThemeColor + } const profile = new Profile(ProfileType.ASP, uri, [pe]) profile.publicKey.fingerprint = fp diff --git a/src/persona.js b/src/persona.js index 15501d4..cff55de 100644 --- a/src/persona.js +++ b/src/persona.js @@ -60,6 +60,12 @@ export class Persona { * @public */ this.avatarUrl = null + /** + * Theme color + * @type {string | null} + * @public + */ + this.themeColor = null /** * List of identity claims * @type {import('./claim.js').Claim[]} @@ -164,6 +170,7 @@ export class Persona { email: this.email, description: this.description, avatarUrl: this.avatarUrl, + themeColor: this.themeColor, isRevoked: this.isRevoked, claims: this.claims.map(x => x.toJSON()) } @@ -183,6 +190,7 @@ function importJsonPersonaVersion2 (personaObject) { persona.email = personaObject.email persona.description = personaObject.description persona.avatarUrl = personaObject.avatarUrl + persona.themeColor = personaObject.avatarUrl persona.isRevoked = personaObject.isRevoked return persona