GithubHelp home page GithubHelp logo

lambda-sensui's Introduction

lambda-sensui

uPort Funding Service

FAQ and helpdesk support

CircleCI

codecov

API Description

RPC endpoint

This endpoints tries to send funds to the address on the from field of the transaction. The from field needs to match with the deviceKey in the Authorization token.

Sensui, does some limit check before actually sending the funds. If sensui funds an attempt to abuse a 429 Too many connections is returned

The endpoint is private, only valid tokens from nisaba are allowed.

Endpoints

Fund

POST /fund

Header

Authorization: Bearer <jwt token>

The authorization header needs a JWT token that is signed by the nisaba service (a build that very much resembles this one, in that it also uses the serverless framework and AWS lambda. The JWT token is generated from the following control flow (for uPort):

  1. User is signing up on uPort, which requests the users phone number and/or that the user complete a captcha challenge
  2. The user submits their phone number and recieves a text with a secret code and/or completes captcha challenge
  3. Upon successful completion, a JWT token is created and then signed by the nisaba service (becoming a 'nisaba token' as referenced in the comments in the code
  4. This token is associated with the user and allows them to use the methods of the API and make calls

Body

{
  tx: <signedTx>,
  blockchain: <blockchain name>
}

Response

Status Message
200 Ok. address funded
400 Bad request No JSON or paramter missing
401 Forbidden Fuel token not granted by nisaba
403 Forbidden JWT token missing or invalid
429 Abuse Abusing gasPrice or funds not needed
500 Internal Error Internal error

Response data

{
  txHash: <tx hash>
}

Relay

POST /relay

Header

Authorization: Bearer <jwt token>

Body

{
  metaSignedTx: <metaSignedTx>,
  blockchain: <blockchain name>
}

Response

Status Message
200 Ok. address funded
400 Bad request No JSON or paramter missing
401 Forbidden Fuel token not granted by nisaba
403 Forbidden Invalid metaTx signature
500 Internal Error Internal error

Response data

{
  txHash: <tx hash>
}

lambda-sensui's People

Contributors

aldigjo avatar beckkles avatar c-castillo avatar dependabot[bot] avatar mirceanis avatar oed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lambda-sensui's Issues

Documentation gaps

  • Secrets. How to leverage AWS KMS and serverless-kms-secrets
  • Rolling your own sensui with or without nisaba

Script to run your own sensui

Automate as much as possible.

  • Check you have your AWS credentials installed,
  • Check for a KMS key to encrypt/decrypt the secret
  • Guidelines to configure AWS/CircleCI integration
  • Delete/wipe the kms files (or remove from source control)

Define allow string

Allow string

Inspired by ERC67

<network>:<ethereum address>?(value=<value>)(&function=<func name>(<param type> <param value>. ...))

  • network: can be a standard network name or a network id
  • ethereum address: can be a contract address or any address
  • value: value to transfer
  • func name: function name
  • param type: parameter type (address, uint, etc)
  • param value: parameter value

Any field can be replaced by * to allow any instance of it.

Tx Query

We need to check on how many successful vs failed fund/relay tx. by cicle (every 2 weeks)

Bad metaTx

Fail with this metaTx (invalid)

'{"metaSignedTx":"f86480831e8480825208947fab8b9ad84e0c46106cbba87051f66cf49c9bf2822710801ca0fb67739ea750832b31689609c4f1f7f13e1f4ef70abf4d4a6e41f9ca6c1f488ba04c8546a6c00d2afa21ccb2318e8959595cbf987a64f83cd630c2250622b1f901","blockchain":"rinkeby"}'

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.