did-connect

Service that connects your dapp with DID and ABT Wallet

Usage no npm install needed!

<script type="module">
  import didConnect from 'https://cdn.skypack.dev/did-connect';
</script>

README

DID Connect

A service that connect your web application to forge-powered blockchain which enables DID-Login and Micro-Payment

Requirements

  • Node.js v10+
  • MongoDB 3.4+

Try URL

Components

This repo contains following part of the service

  • FrontEnd: allow developer to create his/her application and get integration guide
  • BackEnd: do did-auth interaction on behalf of the dapp and wallet
  • Documentation: configuration and integration instructions, checkout docs/README.md

Configuration

dApp configuration file is auto generated and stored in .env, example configure as:

SKIP_PREFLIGHT_CHECK=true
NETLIFY=false

# server only
APP_TOKEN_SECRET="34db9614faa10fc6ba16e6c3dff6ca8d7b06deb7d075681e8f"
APP_TOKEN_TTL="1d"
APP_SK="PUT YOUR APPLICATION SK HERE"
APP_PORT="3030"
VAULT_DID="z1dreFdjYeD2194uHBgg3wsysHEs7WXYQVN"
VAULT_PK="z9ceFPrzXj7k5pAodfSEpc7s7Vans7ykxhEUerwxdivun"
ALI_ACCESS_KEY="xxx"
ALI_ACCESS_SECRET="xxx"

# both server and client
REACT_APP_CHAIN_ID="raohuixia"
REACT_APP_CHAIN_HOST="http://192.168.43.94:8211/api"
REACT_APP_APP_NAME="DID Connect Service"
REACT_APP_APP_DESCRIPTION="A service that connects your dapp with ABT Wallet"
REACT_APP_APP_ID="zNKnn6yk3XTVKZT5TWimSNSwMp6f7GudxuUJ"
REACT_APP_BASE_URL="http://192.168.43.94:3030"
REACT_APP_DOC_BASE_URL="http://192.168.43.94:8000"
REACT_APP_API_PREFIX=""

Caution: .env contains very sensitive info such as Application wallet secret key, PLEASE DO NOT COMMIT .env FILE

Docs folder should have its own configuration.

Getting started

Note: You have to setup an .env file manually.

git clone https://github.com/ArcBlock/did-connect.git
cd did-connect
make init
yarn start

TODO

  • Server-side global error catcher
  • Set CreatedAt/UpdatedAt by global mongoose hook

LICENSE

Copyright 2018-2019 ArcBlock

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.