Verida Documentation
  • Welcome
  • Network Overview
  • Start Building
  • Verida Wallet
  • Whitepapers
  • Glossary
  • Protocol
    • Core concepts
      • Design Principles
      • Decentralized Identity
      • Confidential Databases
      • Confidential Compute
      • Accounts and Identity
      • Data Storage
      • Application Contexts
      • Messaging
      • Schemas
      • Data Sharing
    • Client SDK
      • Getting Started
      • How It Works
      • Authentication
      • Data
      • Queries
      • Permissions
      • Messaging
      • Account Profiles
      • Events
      • Command Line Tools
      • Configuration
      • React Native
      • Advanced
    • Verida Connect SDK
      • Getting Started
      • WebUser
      • WalletConnect Support
      • Authentication Server
    • Blockchain Bridge
    • Run a Node
      • Database Node
        • Setup
        • Operations
        • FAQ
      • Compute Node
    • Verida Networks
  • Extensions
    • Credentials
      • Verifiable Credentials Developer SDK
      • cheqd Credential Service
      • Privado ID (fmr Polygon ID)
      • zkPass credentials
      • Reclaim Protocol credential
    • Verida URIs
    • Vue Components
Powered by GitBook
On this page
  • Closing a database​
  • Datastore v Database​
  • Database info​

Was this helpful?

  1. Protocol
  2. Client SDK

Advanced

PreviousReact NativeNextVerida Connect SDK

Last updated 8 months ago

Was this helpful?

Closing a database

Databases should be closed when you have finished using them. This closes socket connections associated with syncing and cleans up other internal resources such as caching.

await database.close()

Datastore v Database

You can access the underlying database object from a datastore object:

const db = await datastore.getDb()

The Verida database object is a wrapper around a native . You can fetch this PouchDb instance from a database object:

const pouchDb = await db.getDb()

Database info

Additional information about a database can be retrieved:

const dbInfo = await database.info()
console.log(dbInfo)

Here’s example output for an encrypted database:

{
  type: 'VeridaDatabase',
  privacy: 'encrypted',
  did: 'did:vda:polyamoy:0x6B2a1bE81ee770cbB4648801e343E135e8D2Aa6F',
  dsn: 'https://<username>:<password>@db.banksia.verida.io:5984',
  storageContext: 'Verida Test: Test Application 1',
  databaseName: 'SyncTestDb',
  databaseHash: '<databaseHash>',
  encryptionKey: Uint8Array(32) [
    ...
  ],
  sync: {
    canceled: true,
    pull: { status: 'cancelled', canceled: undefined },
    push: { status: 'cancelled', canceled: undefined }
  }
}
​
​
PouchDb instance
​