dsc-auth
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

DSCAuth

DSCAuth is an Oauth platform built on top of Qr Codes to integrate all the products of DSC VIT.

DSCAuth is built to overcome the hassle of registrations and logging in for various events and products managed by DSC.

Features:

  • It allows any user registered with connectX to authenticate any DSC product or registration form by just scanning a Qr code .
  • DSCAuth is concurrently built for both ES5 and ES6 using typescript and fuse-box.
  • It can integrate into anything from a jquery website to a react PWA.
  • It also has typescript typings , so it can support Angular .

Getting Started:

Usage with ES5 :

Include the minified version to HTML from CDN.

<script src="https://cdn.jsdelivr.net/npm/dsc-auth/dist/dscAuth.js"></script>

Add a script to initialize the library and handle the data.

<script>

        // Instantiate the object
        let Authentication=new Auth("<----API KEY---->");

        /* Initialize by providing the details handler
           Details will be logged when you scan the qr with connectX */
        Authentication.init(function(details){
            console.log(details);
        },true);

        // Fetch the the Qr code and handle the base64 image.
        Authentication.getQr().then(function(image){
            let img=document.createElement('img');
            img.src="data:image/png;base64,"+image;
            document.body.appendChild(img);
        });

</script>

Usage with ES6 :

Install the package from npm repository.

npm install dsc-auth

Import the library & Add a script to initialize the library and handle the data.

import Auth from 'dsc-auth'

// Instantiate the object
let Authentication=new Auth("<----API KEY---->");

/* Initialize by providing the details handler
Details will be logged when you scan the qr with connectX */

Authentication.init(function(details){
    console.log(details);
},true);

// Fetch the the Qr code and handle the base64 image.
Authentication.getQr().then(function(image){
    let img=document.createElement('img');
    img.src="data:image/png;base64,"+image;
    document.body.appendChild(img);
});

API Documentation :

Sno. Purpose Function Parameters explanation
1 To instantiate the Auth module for your website
Auth(API_KEY)
The API key of the project obtained from DSCCruX
2 Initializes the library by setting the details handler and ping mode
Authentication.init(detailsHandler [,Ping])
detailsHandler(details){}
Details handler will be invoked with details as the parameter.
ping
is an optional argument that takes a boolean value. Defaults to false, Continuously pings the websocket if set to true (40 seconds once)
3 Fetch the Qr code and handle the changes in javascript.
Authentication.getQr()
Returns a promise. Promise resolves a base64 encoded image

Contributing :

Setup local development environment :

  1. Install the dependencies :
npm install
  1. Start the local development server :
npm start
  1. Build the package :
npm run build

Publishing to npm :

  1. Bump the version of the package by using
npm version <type of update>
  1. Push the update to npm
npm publish

Developers :

Vineeth , Samyak

Package Sidebar

Install

npm i dsc-auth

Weekly Downloads

2

Version

1.1.2

License

MIT

Unpacked Size

76.5 kB

Total Files

25

Last publish

Collaborators

  • technophilic