The NodeJS server SDK for Charon.

Overview

Charon - NodeJS Server SDK

This is the NodeJS server SDK for Charon: A new form of secure, passwordless authentication.

The SDK currently serves as a layer built on top of the Charon Authentication server API. With support for verifying users as an express middleware function and setting up pre-built endpoints for your client to interact with. Works well when paired with any CharonClient libraries (such as charonclientnode).

This SDK can be used client side, however it is strongly discouraged to do so doing this would compromise your API token.

Before you start

  1. Create your app on Charon
  2. Create a new instance of the CharonServer with the APIKey
  3. Use the different functions supported by the API

Express setup using the pre-built endpoints (for easy use with any CharonClient SDKs)

    var app = express();
    var charonServer = new CharonAPIEndpoints("API TOKEN HERE");

    //our endpoints use async code by default

    //endpoint for creating a new user
    app.post('/api/v1/charon/create',charonServer.createUserEndpoint);

    //endpoint for getting all pending device sign ins for a particular user
    app.post('/api/v1/charon/pending',charonServer.getPendingAuthDevicesEndpoint);

    //endpoint for requesting a login to an account from a device
    app.post('/api/v1/charon/login',charonServer.requestLoginEndpoint);
    
    //endpoint for authenticate a pending login request
    app.post('/api/v1/charon/authenticate',charonServer.authenticatePendingEndpoint);

    app.listen(8080);

Using the verifyAccount middleware for any endpoints that require authentication to use (such as creating a post)

    var app = express();
    app.use(express.bodyParser());

    var charonServer = new CharonServer("API TOKEN HERE");

    //for requests that require authentication, ADD THE USERNAME AND KEY OF THE ACCOUNT TO THE HTTP POST BODY
    app.post('/post/create',charonServer.verifyAccountMiddleware,async function(req,res,next){
        if(req.charon.auth == true){
        //write your own post logic here:
        //EXAMPLE
        PostHandler.createPost(req.charon.username,{'test':req.body.test});

        }else if(req.charon.auth == false){
            res.json({'status':'invalidkey'});
        }
    });
You might also like...

A lazy plugin for printing local network when starting NodeJS server. I made this so you don't have to.

A lazy plugin for printing local network when starting NodeJS server. I made this so you don't have to.

lazy-net A simple, lightweight plugin for printing local network when starting Node.js or Express.js server. I made this so you don't have to. There a

Feb 10, 2022

Base Mydog remould , NodeJS Server

KalrCat 卡尔猫,基于开源Nodejs服务端框架 Mydog 魔改而成 使用了Protobuf 作为 协议传输工具 Base Mydog remould , NodeJS Server Protobuf is used as a protocol tool Mydog Home https:/

Nov 4, 2022

a toy project to explore Stable Diffusion locally through a nodeJS server.

SD-explorer foreword this is a toy project to run the Stable Diffusion model locally. if you're after something more solid, I'd suggest you use WebUI

Dec 18, 2022

Today began learn about MEAN stack first with Nodejs that is a server side form of javascript. Repository for track of Day by Day improvement track in new Skill.

Today began learn about MEAN stack first with Nodejs that is a server side form of javascript. Repository for track of Day by Day improvement track in new Skill.

NodeJs Today began learn about MEAN stack first with Nodejs that is a server side form of javascript. Repository for track of Day by Day improvement t

Oct 14, 2022

microCMS JavaScript SDK.

microCMS JavaScript SDK It helps you to use microCMS from JavaScript and Node.js applications. Getting Started Install Install npm package. $ npm inst

Dec 31, 2022

Temporal-time-utils - This is a library with some reusable functions for Temporal.io TypeScript SDK

temporal-time-utils This is a library with some reusable functions for Temporal.io TypeScript SDK: sleepUntil: sleep to a specific date, instead of by

Oct 18, 2022

Anagolay Network Javascript SDK written in Typescript

Anagolay Network Javascript SDK written in Typescript. This repo will contain the bindings to Anagolay Network with the sane defaults for pallet usage

Nov 26, 2022

Lazerpay SDK allows you accept payments easily in your react application

Lazerpay SDK allows you accept payments easily in your react application

Lazerpay Official react sdk Lazerpay SDK allows you accept payments easily in your react application Installation npm install lazerpay-react Usage imp

Nov 20, 2022

Firebase SDK 9 + Google Sign In + Chrome Extension Manifest Version 3 + Webpack

Firebase SDK 9 + Google Sign In + Chrome Extension Manifest Version 3 + Webpack Demo Find this Chrome Extension Setup and working demo here or on Yout

Dec 28, 2022
Owner
null
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
The iofod SDK provides developers with the ability to interact with the main iofod interface within the Web worker, enabling rapid development of iofod extensions through the SDK.

iofod-sdk English | 简体中文 The iofod SDK provides developers with the ability to interact with the main iofod interface within the Web worker, enabling

iofod, Inc. 47 Oct 17, 2022
Movehat is a TypeScript SDK for Move on Sui built on top of Sui's TypeScript SDK and our fork of Ian Macalinao's `move-ts`.

Movehat Movehat is a TypeScript SDK for Move on Sui built on top of Sui's TypeScript SDK and our fork of Ian Macalinao's move-ts. Movehat aspires to b

Pentagon 10 Sep 30, 2022
NodeJS(TypeScript) SDK For V2EX

NodeJS(TypeScript) SDK For V2EX

chyroc 4 Mar 2, 2022
Autoinspector SDK for nodejs.

Autoinspector Node.js SDK The Autoinspector Node library provides convenient access to the Autoinspector API from applications written in server-side

Autoinspector 2 Jan 27, 2022
A remote nodejs Cache Server, for you to have your perfect MAP Cache Saved and useable remotely. Easy Server and Client Creations, fast, stores the Cache before stopping and restores it again!

remote-map-cache A remote nodejs Cache Server, for you to have your perfect MAP Cache Saved and useable remotely. Easy Server and Client Creations, fa

Tomato6966 8 Oct 31, 2022
Monolithic repo for api server, image server, web server

Onsecondary Market Deployed at https://market.onsecondary.com Monolithic repo for api server, image server, web server TODO -use a script to cull expi

Admazzola 2 Jan 11, 2022
CLI Progress Bar implemented in NodeJS to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code

NodeJS-ProgressBar CLI Progress Bar for NodeJS and JavaScript to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code D

Atanu Sarkar 5 Nov 14, 2022
A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and configure Typescript on it.

CTSP- Create TS Project A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and conf

Jean Rodríguez 7 Sep 13, 2022