auth0/ethereum-user-db-service

Name: ethereum-user-db-service

Owner: Auth0

Description: npm module used to perform database operations in mariadb

Created: 2016-11-21 12:58:57.0

Updated: 2018-01-16 08:47:44.0

Pushed: 2017-05-19 09:34:55.0

Homepage: null

Size: 9

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

MariaDB database access module

Installation
install eth-db-service  -g
Usage

The module assumes that mariaDB is running on the host under alias: user-db. Make sure you name the MariaDB image with this alias in your docker-compose deployment!

t DbService = require('eth-db-service');
dbService = new DbService();

Every method returns a promise with the result.

Check if mobileMapping table exists
rvice.checkIfMobileMappingTableExists()
n(function(result) {
if(result.lenght == 0) {
  console.log("Tabled does not exist!";)
}
//users is an array of user objects
atch(function handleError(error) {
//your error handling goes here

Check if userCredentials table exists
rvice.checkIfUserCredentialsTableExists()
n(function(result) {
if(result.lenght == 0) {
  console.log("Tabled does not exist!";)
}
//users is an array of mapping objects 
atch(function handleError(error) {
//your error handling goes here

Create mobile mappings table

The table will have two rows:

rvice.createMobileMappingTable(message,address,password)
n(function() {
//do something aftewards
atch(function handleError(error) {
//your error handling goes here

Create mobile usersCredentials table

The table will have two rows:

rvice.createUserCredentialsTable(message,address,password)
n(function() {
//do something aftewards
atch(function handleError(error) {
//your error handling goes here

Insert new user
rvice.insertUserCredentials(email, authenticationKey)
n(function() {
//do something aftewards
atch(function handleError(error) {
//your error handling goes here

Insert new mapping
rvice.insertMapping(address, value)
n(function() {
//do something aftewards
atch(function handleError(error) {
//your error handling goes here

Get user by email
rvice.getUserCredentialsByEmail(email)
n(function(user) {
var email = user.emai;
var authenticationKey = user.authenticationKey;
atch(function handleError(error) {
//your error handling goes here

Get mapping by secondary address
rvice.getMappingByAddress(address)
n(function(mapping) {
var address = mapping.address;
var secondaryKey = mapping.value;
atch(function handleError(error) {
//your error handling goes here

Get all users
rvice.getUserCredentials()
n(function(users) {
//users is an array of user objects
atch(function handleError(error) {
//your error handling goes here

Get all mappings
rvice.getMappings()
n(function(mapping) {
//users is an array of mapping objects
atch(function handleError(error) {
//your error handling goes here

Dependencies

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.