Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AcidLeroy/gaiadown-ts
Gaia backend for levelup
https://github.com/AcidLeroy/gaiadown-ts
Last synced: 2 months ago
JSON representation
Gaia backend for levelup
- Host: GitHub
- URL: https://github.com/AcidLeroy/gaiadown-ts
- Owner: AcidLeroy
- License: apache-2.0
- Created: 2019-07-01T23:46:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-09-15T02:51:13.000Z (over 1 year ago)
- Last Synced: 2024-11-03T04:04:09.721Z (2 months ago)
- Language: TypeScript
- Size: 879 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GaiaDown
[Gaia](https://github.com/blockstack/gaia) storage backend for [LevelUP](https://github.com/Level/levelup). The API implements the
[abstract-leveldown](https://github.com/Level/abstract-leveldown) interface. Specifically, this module needs a [UserSession](https://github.com/blockstack/stacks.js/blob/1af7a18b1017981f5b44c1006d940eb4648d0491/packages/auth/src/userSession.ts#L48) 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](https://travis-ci.com/AcidLeroy/gaiadown-ts.svg?branch=master)](https://travis-ci.com/AcidLeroy/gaiadown-ts)
[![npm version](https://badge.fury.io/js/gaiadown-ts.svg)](https://badge.fury.io/js/gaiadown-ts)
# Installation
`npm install gaiadown-ts`# Example
```ts
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](https://github.com/Level/levelup) for API.