Skip to content

A library to provide self-sovereign data storage on the Verida network for the Polygon ID SDK

Notifications You must be signed in to change notification settings

verida/polygonid-storage

Repository files navigation

PolygonID Storage

This library provides self-sovereign database storage on the Verida network for PolygonID related data.

It has drop in replacements for InMemoryDataSource, InMemoryMerkleTreeStorage and InMemoryPrivateKeyStore.

Example usage

Establish a connection to the Verida network. Use the Private Key authentication strategy for Node.js servers (ie: Issuer server) or the Verida Connect SDK strategy for web-browsers.

This will give you a context object that can be used to create encrypted, self-sovereign databases.

import { VeridaMerkleTreeStorage, VeridaPrivateKeyStore, VeridaDataSourceFactory } from '@verida/polygonid-storage'

// Create data storage
const dataStorage = {
    credential: new CredentialStorage(
        await VeridaDataSourceFactory<Type>(context, "polygonid_credentials")
    ),
    identity: new IdentityStorage(
        await VeridaDataSourceFactory<Type>(context, "polygonid_identity")
        await VeridaDataSourceFactory<Type>(context, "polygonid_profile")
    ),
    // @todo
    mt: new VeridaMerkleTreeStorage(40, await VeridaDataSourceFactory<Type>(context, "polygonid_merkletree")),
    states: new EthStateStorage(conf),
};

// Create private key store
const privateKeyStoreDatabase = await context.openDatabase(
    "polygonid_keystore"
);
const keyStore = new VeridaPrivateKeyStore(privateKeyStoreDatabase);

About

A library to provide self-sovereign data storage on the Verida network for the Polygon ID SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published