API Index

Overview of IdentityWallet SDK API methods

IdentityWallet SDK implements the 3ID protocol, which specifies the methods below. 3ID is used for user identity, encryption, and data authorization.

This page contains the full 3ID API specification, but certain restricted methods are only available to wallets but not to apps. This is for security purposes. These restricted methods will be noted below.

Initialize

new IdentityWallet(config)

Creates an instance of IdentityWallet

Returns: this - An IdentityWallet instance

Param

Type

Description

config

Object

The configuration to be used

config.seed

String

The seed of the identity, 32 hex string

config.authSecret

String

The authSecret to use, 32 hex string

config.ethereumAddress

String

The ethereumAddress of the identity

Auth

identityWallet.authenticate(spaces, opts)

Authenticate to given spaces

Kind: instance method of IdentityWallet Returns: Object - The public keys for the requested spaces of this identity

Param

Type

Description

spaces

Array.<String>

The desired spaces

opts

Object

Optional parameters

opts.authData

Array.<Object>

The authData for this identity

identityWallet.isAuthenticated(spaces)

Check if authenticated to given spaces

Kind: instance method of IdentityWallet Returns: Boolean - True if authenticated

Param

Type

Description

spaces

Array.<String>

The desired spaces

identityWallet.addAuthMethod(authSecret)

Add a new authentication method for this identity.

Note: This restricted method is only available to wallets, but not applications.

Kind: instance method of IdentityWallet

Param

Type

Description

authSecret

String

A 32 byte hex string used as authentication secret

Sign

identityWallet.signClaim(payload, opts)

Sign a verifiable credential. The format of the credential is did-jwt.

Kind: instance method of IdentityWallet Returns: String - The signed claim encoded as a JWT

Param

Type

Description

payload

Object

The payload of the claim

opts

Object

Optional parameters

opts.DID

String

The DID used as the issuer of this claim

opts.space

String

The space used to sign the claim

opts.expiresIn

String

Set an expiry date for the claim as unix timestamp

Encrypt/Decrypt

identityWallet.encrypt(message, space, opts)

Encrypt a message

Kind: instance method of IdentityWallet Returns: Object - The encrypted object (ciphertext and nonce)

Param

Type

Description

message

String

The message to be encrypted

space

String

The space used for encryption

opts

Object

Optional parameters

opts.nonce

String

The nonce used to encrypt the message

opts.blockSize

String

The blockSize used for padding (default 24)

identityWallet.decrypt(encryptedObject, space)

Decrypt a message

Kind: instance method of IdentityWallet Returns: String - The decrypted message

Param

Type

Description

encryptedObject

Object

The encrypted object (ciphertext and nonce)

space

String

The space used for encryption