Verida Documentation
  • Welcome
  • Network Overview
  • Start Building
  • Verida Wallet
  • Whitepapers
  • Glossary
  • Protocol
    • Core concepts
      • Design Principles
      • Decentralized Identity
      • Confidential Databases
      • Confidential Compute
      • Accounts and Identity
      • Data Storage
      • Application Contexts
      • Messaging
      • Schemas
      • Data Sharing
    • Client SDK
      • Getting Started
      • How It Works
      • Authentication
      • Data
      • Queries
      • Permissions
      • Messaging
      • Account Profiles
      • Events
      • Command Line Tools
      • Configuration
      • React Native
      • Advanced
    • Verida Connect SDK
      • Getting Started
      • WebUser
      • WalletConnect Support
      • Authentication Server
    • Blockchain Bridge
    • Run a Node
      • Database Node
        • Setup
        • Operations
        • FAQ
      • Compute Node
    • Verida Networks
  • Extensions
    • Credentials
      • Verifiable Credentials Developer SDK
      • cheqd Credential Service
      • Privado ID (fmr Polygon ID)
      • zkPass credentials
      • Reclaim Protocol credential
    • Verida URIs
    • Vue Components
Powered by GitBook
On this page
  • Open any profile​
  • Open and modify the current user's profile​
  • Advanced​
  • Open an external profile without authentication​

Was this helpful?

  1. Protocol
  2. Client SDK

Account Profiles

PreviousMessagingNextEvents

Last updated 8 months ago

Was this helpful?

A Verida Account maintains a public profile for every application context. The default basicProfile currently contains:

  • name - Name of the account

  • country - Country where the account owner lives

  • description - Text description / bio of the Verida account

  • avatar.uri - The URI of an avatar image. This is currently encoded as a URI that contains a base64 representation of the image. (In the future other ways of storing an image will be supported, beyond a uri)

The schema can be found here:

All properties are optional except for name.

This public profile is a datastore that anyone can read from, but only the owner can write to.

In order to make working with profiles easier, there are some helper methods in the Verida SDK that simplify fetching and updating a profile. These are documented below.

Open any profile

Open the public profile for any Verida Account and context combination using an instance of the client object.

For example, open a user’s public profile created in the Verida: Vault mobile application:

const did = 'did:vda:polyamoy:0x6B2a1bE81ee770cbB4648801e343E135e8D2Aa6F';
const profileConnection = await client.openPublicProfile(did, 'Verida: Vault', 'basicProfile');
const publicProfile = await profileConnection.getMany()

console.log('Account name', publicProfile.name)
console.log('Account country', publicProfile.country)

// Example showing how to inject the avatar into a <img id="avatar-img"> tag
const elm = document.getElementById("#avatar-img")
elm.src = publicProfile.avatar.uri

It’s also possible to open an external profile for the current context:

const did = 'did:vda:polyamoy:0x6B2a1bE81ee770cbB4648801e343E135e8D2Aa6F';
const externalProfile = await context.openProfile('public', did);

Open the user's context profile:


const userProfile = await context.openProfile('basicProfile');

// Modify the profile properties
const avatarUri = 'data:image/png;base64,iVBOR...'; //  Data URL of base64-encoded image
await userProfile.set('avatar', { uri: avatarUri, });
await userProfile.set('name', 'Stevie');

// Read the profile properties
const name = await userProfile.get('name');
console.log(name); // -> Stevie
const profileData = await userProfile.getMany();
console.log(profileData); // -> { name: 'Stevie', avatar: { uri: 'data:image/png;base64,iVBOR...' }, ...}

// Delete a profile property
await userProfile.delete('name');

// Listen for profile changes
const listener = await userProfile.listen(function (row) {
 console.log(`${row.key} = ${row.value}`);
});

listener.cancel();

Open an external profile for using an instance of the client object directly from the @verida/client-ts package

For example, open a user’s public profile created in the Verida: Vault mobile application:

import { Client } from '@verida/client-ts';
import { Network } from '@verida/types';

const did = 'did:vda:polyamoy:0x6B2a1bE81ee770cbB4648801e343E135e8D2Aa6F';

const client = new Client({
  network: Network.BANKSIA,
});

const profileInstance = await client.openPublicProfile(
 did,
 'Verida: Vault',
 'basicProfile'
);

const profile  = await profileInstance.getMany({}, {});

}

Note: Change Network.BANKSIA to Network.MYRTLE if loading a Myrtle profile.

This can be tried out in your browser .

Open and modify the current user's profile

Learn more about Data URL .

Advanced

Open an external profile without authentication

https://common.schemas.verida.io/profile/basicProfile/latest/schema.json
​
here
​
here
​
​