Giter Site home page Giter Site logo

rif-data-vault's Introduction

logo

RIF Data Vault

A user centric cloud storage system

docs alerts

The Data Vault is a user-centric cloud service. Allows any user with a digital wallet to connect to their own storage cloud, encrypting their information on the client side.

Quick start

Connect to RIF Data Vault from your browser app!

import DataVaultWebClient, { AuthManager, AsymmetricEncryptionManager } from '@rsksmart/ipfs-cpinner-client'

const serviceUrl = 'https://data-vault.identity.rifos.org'

// using Metamask
const address = await window.ethereum.request({ method: 'eth_accounts' }).then(accounts => accounts[0])
const did = `did:ethr:rsk:${address}`

const dataVault = new DataVaultWebClient({
  serviceUrl,
  authManager: new AuthManager({ did, serviceUrl, personalSign: (data: string) => window.ethereum.request({ method: 'personal_sign', params: [data, address] }) }),
  encryptionManager: AsymmetricEncryptionManager.fromWeb3Provider(window.ethereum)
})

const key = 'MyKey'
const content = 'this is my content'

const id = await dataVault.create({ key, content })

await dataVault.get({ did, key })

Read the docs and find out more!

Modules

Run for development

  1. Install dependencies

    npm i
    npm run setup
    
  2. Install IPFS CLI. Find your option: https://docs.ipfs.io/how-to/command-line-quick-start/.

Test

  1. Init IPFS (once)
ipfs init
  1. Start IPFS Daemon
ipfs daemon
  1. Run tests
npm test

or watch mode with

test:watch

Lint

npm run lint

Branching model

  • master has latest release. Do merge commits.
  • develop has latest approved PR. PRs need to pass ci and LGTM. Do squash & merge.
  • Use branches pointing to develop to add new PRs.
  • Do external PRs against latest commit in develop.

Deploy your Data Vault instance

To run a productive instance of the Data Vault refer to Data Vault service configuration

rif-data-vault's People

Contributors

dependabot[bot] avatar diegograsso avatar ilanolkies avatar javiesses avatar jessgusclark avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rif-data-vault's Issues

UX - Add Newline and '*' to DV authentication message

Taking UX into account, it would be good to add some Newline (end of line) and some '*' in this message that is asked when authenticating to Data Vault:

image

The proposal is:

Are you sure you want to login to the RIF Data Vault? [Newline]

* URL: https://... [Newline]
* Verification code: ...

Note: if this issue should be created in rLogin instead of here, LMK and I move it.

Add factory methods

The method should automatically setup sign, decrypt and getEncryptionPublicKey.

In addition, public key returned by getEncryptionPublicKey should be memoized. See:

Originally posted by @ilanolkies in #41 (comment)

  • AsymmetricEncryptionManager
  • SignerEncryptionManager
  • AuthManager
  • DataVaultWebClient

Create DataVaultProvider Web Client SDK

  • Receives:
    • web3Provider/signer function and a did. Will be used to authenticate
    • Optional: storage get and set functions. Will be used to save the access token so it can be reused. Default: window.localStorage. This is an option for other clients, like mobile applications.
  • Implements @rsksmart/express-did-auth authentication protocol - RIFID-450
    • The login will be done in the first interaction with the DV API and the token will be saved in the provided storage so it can be reused
  • Speaks with DV Service API
  • Encrypts/decrypts content prior to put or after retrieving it from the DV Service
  • WebJS compatible
type Key = string
type ContentIdentifier = string
type Content = string // if it is a JSON, must be stringified

type PutFilePayload = { key: Key, content: Content }
type PutFileResponse = { id: ContentIdentifier }
type GetFilePayload = { key: Key }
type GetFileResponse = { id: ContentIdentifier, content: Content }
type DeleteFilePayload = { key: Key, id: Identifier }
type DeleteFileResponse = {}
type SwapFilePayload = { key: Key, id: ContentIdentifier, content: Content }
type SwapFileResponse = { id: ContentIdentifier }

interface DataVaultWebClient {
  put(payload: PutFilePayload): PutFileResponse
  put(payload: PutFilePayload[]): PutFileResponse[]
  get(payload: GetFilePayload): GetFileResponse[]
  get(payload: GetFilePayload[]): GetFileResponse[]
  delete(payload: DeleteFilePayload): DeleteFileResponse
  delete(payload: DeleteFilePayload[]): DeleteFileResponse[]
  swap(payload: SwapFilePayload): SwapFileResponse
  swap(payload: SwapFilePayload[]): SwapFileResponse[]
}

Allow to perform bulk CRUD operations from the client

Should implement this interface

get (GetContentPayload): Promise<string[]>
create (CreateContentPayload): Promise<CreateContentResponse>
delete (DeleteTokenPayload): Promise<boolean[]>
swap (SwapContentPayload): Promise<SwapContentResponse[]>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.