o-sheets

1.0.14 • Public • Published

o-sheets

This library is a wrapper around the V4 Google Sheets API, along with some functions from the V3 API. Mainly, it allows you to upload data encrypted through Paillier homomorphic encryption. This is great because data is private but you can still have other people do math on it, meanwhile you aren't paying exorbitant read/write costs like in Google's BigQuery.

To get started, create a service account for your google cloud console account. Save the credentials as drivekey.json in the root directory. Add the service account's email as a person with "edit" priviledges to your google sheet.

Have people analyze your data by downloading the google sheet and using the paillier-bignum nodejs library with the publicKey parameters you post to the top of your sheet. If you're at this library trying to analyze existing data use this: https://github.com/juanelas/paillier-bignum

install

This library is built on top of paillier-bignum, which is built on top of node-bignum. These require sudo priviledges to install.

    sudo npm install --save o-sheets --unsafe-perm

setup

forms.json

This file can help you address different google sheets you have. It's a mapping to Sheet IDs. Fun fact, these IDs are also used for files posted on Google Drive, as well as forms made with Google Forms. This makes it easy to take in user data through a Google Form, export the responses to a Google Sheet private to you, then homomorphically encrypt user inputs to the sheet you're looking at here. In the future we might try and automate this.


https://docs.google.com/sheets/d/{{ sheet ID}}
{
    "encryptedSheets":{{ sheet ID}}
}

authorization

Authorization with Google's APIs using a service account might be the hardest part for beginners. Try making search engine queries based on the aforementioned instructions.

    var Sheets = require("o-sheets");
    var sheets = new Sheets({},function(){
        # do stuff after
    });
    # a paillier encryption key /pub will be generated and saved to ./paillierPrivKey.json
    # THE PUB KEY PARAMS IS INSIDE THIS FILE TOO for sharing with other people.

methods

insertEncryptedRow

Be sure and label each column at the top of your sheet as col0, col1, etc.. By default, paillier-bignum only accepts base10 numbers. So figre out how you're going to encode your data before trying to insert it.

    var offset = 2; # OFFSET means only the input values from offset:end will be encrypted. Default: 0 
    sheets.insertEncryptedRow("encryptedSheets",["Mick Jagger","10/0/19 3:33:04pm",1001,120348,41040],function(){
        
    },offset);

In addition to the offset variable, inserting null values within arrays will result in them not being encrypted.

In the future a command will be added to input a dictionary with each input specified.

Readme

Keywords

none

Package Sidebar

Install

npm i o-sheets

Weekly Downloads

1

Version

1.0.14

License

ISC

Unpacked Size

43.5 kB

Total Files

14

Last publish

Collaborators

  • projectoblio