Coder Social home page Coder Social logo

bpass's Introduction

nPass - Nano based tokens for web access

Overview

nPass is a chrome extension that interacts with web sites to generate and provide paid access tokens on demand, both for the general case of logging in to a site (no user registration required), and for access to individual content (no need to watch commercials).

The goal of nPass is to demonstrate a viable alternative to ad-supported content:

  • Direct compensation for your content.
  • Easy to add to your website.
  • Easy to add to your browser.

nPass is built on the Nano cryptocurrency network, which enables fast and feeless transactions for near instant token generation.

Visit https://npass.dev/npass for a detailed overview and live demonstration.

Screenshot

This repository contains npass-lib, a set of ReactJS widgets a web site can use to interact with the nPass extension, and npass-demo-server, an example Vertx (Kotlin) web server used to handle http based resource requests with embedded nPass tokens. The demo website code is included as npass-lib/example.

Extension Setup Instructions

  • Install the nPass chrome extension.
  • Create a new wallet. You can export your generated keys to a local file if you want to keep a backup. If you do export the keys, please keep in mind the risks involved with key management.
  • Note: Since nPass is still in alpha stage of development, it is not recommended to use this wallet to hold more than a trivial amount of Nano for testing purposes.

Wallet Screen

  • A QR code should be displayed on the Wallet page (accessible from the drop down menu in the extension).
  • Using the QR code and your existing Nano wallet, send the nPass wallet a small amount of Nano for testing.
  • The nPass wallet should detect the pending transaction and generate a receive block to open the account. A message will popup when it is received.
  • Your wallet amount should be reflected on the Home page of the extension.

Home Screen

  • Visit https://npass.dev/npass to try out the two demonstration examples - one demonstrates accessing media items, the other demonstrates paywalled access or site login using nPass tokens.
  • To avoid the alert popping up on every token purchase, you can select AutoPay in the extension Settings screen. You can cap the amoun of Nano that is spent in total, or per domain.

Settings Screen

  • Any tokens purchased from the demo site should be visible in the extension

Token Screen

Site Integration

The npass-lib component library makes it easy to wrap your media content or web page with support for nPass token request and validation.

For example, to wrap an image with nPass support:

  const npassProps = {
      onTokenVerified: this.onTokenVerified,
      onTokenFailed: this.onTokenFailed,
      contentDetails: this.state.contentDetails,
      paymentDetails: this.state.paymentDetails,
  };  
  <NpassTokenImage {...npassProps} />

See the example site under npass-lib\example\src\App.js for further examples of how to wrap your content.

The npass-lib components will automate token request from the extension, and inject the received nPass Token into GET requests for the embedded content.

To process token validation securely, the site should run a simple back end service to handle the http(s) GET requests using a Bearer token in the Authentication header. A sample web server with the nPass Auth handler is provided under the npass-demo module.

Feel free to raise an issue or contact directly for any questions on site integration.

Architecture

nPass Component Diagram

bpass's People

Contributors

my1 avatar tjl-dev avatar

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.