Identity

Perform 3Box identity operations

Identity API methods allows developers to perform various user identity and account functionalities, such as getting the identity (DID) of a user (address), linking new addresses to the DID, and adding new authentication methods to the DID.

Static

Stateful

Static

Box.getConfig(address, opts)

Get the configuration of a 3Box.

Kind: static method of Box Returns: Object - An object containing the 3Box configuration for the given user. The object contains address links and DIDs for spaces.

Param

Type

Description

address

String

The ethereum address, or DID

opts

Object

Optional parameters

opts.profileServer

String

URL of Profile API server

Example:

const config = await Box.getConfig(0x234...)
console.log(config)

Output:

{
"spaces": {
"spaceName1": {
"DID": "did:3:bafyreig4tg..."
},
"spaceName2": {
"DID": "did:3:bafyjfr982d..."
}
},
"links": [{
"type": "ethereum-eoa",
"message": "Create a new 3Box profile...",
"version": 1,
"signature": "0x04501e914651...",
"timestamp": 1563976242
}]
}

Box.idUtils.verifyClaim(claim, opts)

Verify a claim and return its content. See https://github.com/uport-project/did-jwt/ for more details.

Kind: static property of idUtils Returns: Object - The validated claim

Param

Type

Description

claim

String

opts

Object

Optional parameters

opts.audience

string

The DID of the JWT's audience

Box.idUtils.isMuportDID(address)

Check if a string is a muport DID.

Kind: static method of idUtils Returns: * | boolean - If the address is a muport DID

Param

Type

Description

address

String

A string containing a user profile address

Box.idUtils.isClaim(claim, opts)

Check if a string is a valid claim.

Kind: static method of idUtils Returns: Promise.<boolean> - If the parameter is a verifiable claim

Param

Type

Description

claim

String

opts

Object

Optional parameters

opts.audience

string

The DID of the audience of the JWT

Stateful

box.DID

Get the DID of a 3Box.

Kind: instance property of Box Properties

Name

Type

Description

DID

String

the DID of the user

Creates a proof that links an ethereum address to a 3Box account (DID). If given proof, it will simply be added to the root store.

Kind: instance method of Box

Param

Type

Default

Description

[link]

Object

Optional link object with type or proof

[link.type]

String

'ethereum-eoa'

The type of link (default 'ethereum')

[link.proof]

Object

Proof object, should follow spec

box.isAddressLinked([query])

Checks if there is a proof that links an external account to the 3Box account (DID). If no params given and any link exists, this will return true.

Kind: instance method of Box

Param

Type

Description

[query]

Object

Optional object with address and/or type.

[query.type]

String

Does the given type of link exist

[query.address]

String

Is the given adressed linked

Lists address links associated to a 3Box account (DID).

Kind: instance method of Box Returns: Array - An array of link objects

Remove given address link. Returns true if successful.

Kind: instance method of Box

Param

Type

Description

address

String

address that is linked