GET Profile Data

Static

Stateful

Static

Box.getProfile(address, opts)

Get all public profile data for a 3Box user.

Kind: static method of Box Returns: Object - a json object with the profile for the given address

Param

Type

Description

address

String

An ethereum address, or DID

opts

Object

Optional parameters

opts.blocklist

function

A function that takes an address and returns true if the user has been blocked

opts.metadata

String

flag to retrieve metadata

opts.addressServer

String

URL of the Address Server

opts.ipfs

Object

A js-ipfs ipfs object

opts.useCacheService

Boolean

Use 3Box API and Cache Service to fetch profile instead of OrbitDB. Default true.

opts.profileServer

String

URL of Profile API server

Example:

const profile = await Box.getProfile('0x12345abcde')
console.log(profile)

Output:

{
name: 'mollie',
emoji: 🤪
}

Box.getProfiles(address, opts)

Get a list of public profiles for a set of addresses.

Kind: static method of Box Returns: Object - a json object with each key an address and value the profile

Param

Type

Description

address

Array

An array of ethereum addresses, or DIDs

opts

Object

Optional parameters

opts.profileServer

String

URL of Profile API server

Box.profileGraphQL(query, opts)

Ask for specific, common user profile fields instead of needing to return the entire profile object.

Kind: static method of Box Returns: Object - a json object with each key an address and value the profile

Param

Type

Description

query

Object

A graphQL query object.

opts

Object

Optional parameters

opts.graphqlServer

String

URL of graphQL 3Box profile service

Box.getVerifiedAccounts(profile)

Verifies social account proofs that are present in the profile.

Kind: static method of Box Returns: Object - An object containing the accounts that have been verified

Param

Type

Description

profile

Object

A user profile object, received from the getProfile function

Example:

const verified = await Box.getVerifiedAccounts(profile)
console.log(verified)

Output:

{
did: "did:muport:Qm...",
github: {
proof: "https://gist.githubusercontent.com/...",
username: "mollie"
}
}

Stateful

box.public.all(opts)

Get all values stored in the public profile, and optionally metadata.

Kind: instance method of KeyValueStore Returns: Array.<(String|{value: String, timestamp: Number})> - the values

Param

Type

Description

opts

Object

optional parameters

opts.metadata

Boolean

return both values and metadata

Example:

const profile = await box.public.all()
console.log(profile)

Output:

{
name: 'mollie',
emoji: 🤪
}

box.private.all(opts)

Get all values stored in the private profile, and optionally metadata.

Kind: instance method of KeyValueStore Returns: Array.<(String|{value: String, timestamp: Number})> - the values

Param

Type

Description

opts

Object

optional parameters

opts.metadata

Boolean

return both values and metadata

Example:

const privateProfile = await box.private.all()
console.log(privateProfile)

Output:

{
}

box.public.get(key, opts)

Get the value of the given key stored in the public profile, and optionally metadata.

Kind: instance method of KeyValueStore Returns: String | Object - the value associated with the key, undefined if there's no such key

Param

Type

Description

key

String

the key

opts

Object

optional parameters

opts.metadata

Boolean

return both value and metadata

Example:

const nickname = await box.public.get('name')

box.private.get(key, opts)

Get the value of the given key stored in the private profile, and optionally metadata.

Kind: instance method of KeyValueStore Returns: String | Object - the value associated with the key, undefined if there's no such key

Param

Type

Description

key

String

the key

opts

Object

optional parameters

opts.metadata

Boolean

return both value and metadata

box.public.getMetadata(key)

Get metadata for for a given key stored in the public profile.

Kind: instance method of KeyValueStore Returns: Metadata - Metadata for the key, undefined if there's no such key

Param

Type

Description

key

String

the key

Example:

const metadata = await box.public.getMetadata('name')
console.log(metadata)

Output:

{
timestamp: 2345...
}

box.private.getMetadata(key)

Get metadata for for a given key stored in the private profile.

Kind: instance method of KeyValueStore Returns: Metadata - Metadata for the key, undefined if there's no such key

Param

Type

Description

key

String

the key

box.public.log

Get an array of underlying log entries in the public profile data store. In linearized order according to their Lamport clocks. Useful for generating a complete history of all operations on store.

Kind: instance property of KeyValueStore Returns: Array.<Object> - Array of ordered log entry objects Example

const log = store.log
const entry = log[0]
console.log(entry)
// { op: 'PUT', key: 'Name', value: 'Botbot', timeStamp: '1538575416068' }

box.private.log

Get an array of underlying log entries in the private profile data store. In linearized order according to their Lamport clocks. Useful for generating a complete history of all operations on store.

Kind: instance property of KeyValueStore Returns: Array.<Object> - Array of ordered log entry objects Example

const log = store.log
const entry = log[0]
console.log(entry)
// { op: 'PUT', key: 'Name', value: 'Botbot', timeStamp: '1538575416068' }