gaiadown-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

GaiaDown

Gaia storage backend for LevelUP. The API implements the abstract-leveldown interface. Specifically, this module needs a UserSession object to create the GaiaDOWN instance. Furthermore, all the options that getFile and putFile take can also be used in the LevelDB instance. This allows you to encrypt/decrypt and sign/verify your data.

Build Status npm version

Installation

npm install gaiadown-ts

Example

import GaiaLevelDOWN, {PutFileOptions, GetFileOptions} from 'gaiadown-ts' 
import levelup from 'levelup'
 
// Grab the UserSession object after logging in.
const db = levelup(new GaiaLevelDOWN("/prefix/location/", userSession))
  // Can pass encrypt and sign options, same options as UserSession
  let putOpts : PutFileOptions = {
    encrypt: true, 
    sign: false
  }
  db.put('foo', 'bar', putOpts, function (err) {
    if (err) throw err
    // Can pass decrypt and verify options, same options as UserSession
    let getOpts : GetFileOptions = {
      decrypt: true, 
      verify: false,
    }
    db.get('foo', getOpts, function (err, value) {
      if (err) throw err
      console.log(String(value)) // 'bar'
    })
  })
 

API

Please see LevelUP for API.

Package Sidebar

Install

npm i gaiadown-ts

Weekly Downloads

0

Version

1.0.5

License

Apache-2.0

Unpacked Size

752 kB

Total Files

21

Last publish

Collaborators

  • acidleroy