4.4.1 • Published 6 months ago

@verida/vda-did v4.4.1

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

VDA DID

Provides a client side library for creating, updating and deleting Verida DID's that match the Verida DID specification.

You may consider using @verida/did-client.

Installation

yarn add @verida/vda-did @verida/did-document ethers

Usage

Create a DID

import { DIDDocument } from '@verida/did-document'
import { VdaDid } from '@verida/vda-did'
import { ethers } from 'ethers'

const wallet = ethers.Wallet.createRandom()
const DID_PRIVATE_KEY = wallet.privateKey
const DID_ADDRESS = wallet.address
const DID = `did:vda:testnet:${DID_ADDRESS}`
const DID_PK = wallet.publicKey

// Choose at least three endpoints from the Acacia testnet
// https://developers.verida.network/docs/infrastructure/networks
// (This will soon be decentralized and made available on-chain)
const ENDPOINTS = [
    `https://node1-euw6.gcp.devnet.verida.tech/did/${DID}`,
    `https://node2-euw6.gcp.devnet.verida.tech/did/${DID}`,
    `https://node3-euw6.gcp.devnet.verida.tech/did/${DID}`
]

const VDA_DID_CONFIG = {
    identifier: DID,
    signKey: DID_PRIVATE_KEY,
    callType: 'web3',
    web3Options: {

    }
}

const veridaApi = new VdaDid(VDA_DID_CONFIG)

const doc = new DIDDocument(DID, DID_PK)
doc.signProof(wallet.privateKey)

const publishedEndpoints = await veridaApi.create(doc, ENDPOINTS)
console.log(publishedEndpoints)

Update a DID

veridaApi.update(didDocument, controllerPrivateKey)

Note: controllerPrivateKey is optional and only needs to be specified if the DID Document controller is being changed.

Delete a DID

Deletes the DID configured in the constructor of this VdaDid instance.

veridaApi.delete()

Configuration

const veridaApi = new VdaDid(config: VdaDidConfigurationOptions) supports the following configuration:

export interface VdaDidConfigurationOptions {
    // DID (ie: did:vda:testnet:0x...)
    identifier: string;
    // Private key of the controller
    signKey: string;
    chainNameOrId?: 'testnet' | 'mainnet';
    callType: 'gasless' | 'web3';
    web3Options: VeridaWeb3TransactionOptions;
}

Where:

export interface Web3SelfTransactionConfig extends Web3GasConfiguration {
    // Blockchain (Polygon) private key for writing DID references
    privateKey?: string;
    // Blockchain RPC_URL (defaults to a common Polygon RPC_URL)
    rpcUrl?: string;
}
4.4.1

6 months ago

4.4.0

7 months ago

4.3.0

9 months ago

4.2.0

10 months ago

4.1.2-rc1

12 months ago

4.1.0

12 months ago

4.0.0-alpha-4

1 year ago

4.0.0

1 year ago

4.0.0-alpha-2

1 year ago

4.0.0-alpha-3

1 year ago

4.0.0-alpha-1

1 year ago

3.0.3

1 year ago

4.0.0-alpha.0

1 year ago

3.0.2

1 year ago

3.0.2-alpha.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.4.0-rc5

2 years ago

2.4.0-rc3

2 years ago

2.4.0-rc2

2 years ago

2.3.6

2 years ago

2.3.5

2 years ago

2.4.0-rc1

2 years ago

2.3.4-rc1

2 years ago

2.3.4-rc2

2 years ago

2.3.0

2 years ago

2.2.1

2 years ago

2.2.0

2 years ago

2.3.1

2 years ago

2.1.3

2 years ago

2.3.4

2 years ago

2.3.3

2 years ago

2.3.0-rc1

2 years ago

2.3.0-rc2

2 years ago

2.3.0-rc3

2 years ago

2.3.5-rc1

2 years ago

2.3.3-rc1

2 years ago

2.3.3-rc2

2 years ago

2.1.1

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.1.0

2 years ago

2.0.0

3 years ago

2.0.0-rc6

3 years ago

2.0.0-rc5

3 years ago

2.0.0-rc4

3 years ago

2.0.0-rc3

3 years ago

2.0.0-rc2

3 years ago

2.0.0-rc1

3 years ago