UNPKG

@j2inn/scram

Version:

TypeScript client SCRAM authentication library

45 lines (30 loc) 1.19 kB
# TypeScript client SCRAM authentication library This library is used by clients wanting to authenticate with servers that use SCRAM (Salted Challenge Response Authentication Mechanism). For more information on SCRAM, please see the [specification](https://datatracker.ietf.org/doc/html/rfc5802#page-8). ## Installation npm install @j2inn/scram ## Use import authenticate from '@j2inn/scram' ... async function onAuthenticate(username: string, password: string): void { await authenticate({ username, password, uri: new URL('/auth', window.location.href) }) } An alternative `fetch` parameter can be specified if this library is used in a NodeJS environment... import fetch from 'node-fetch' import authenticate from '@j2inn/scram' ... async function onAuthenticate(username: string, password: string, uri: string): void { await authenticate({ username, password, fetch, uri }) } ## Links - [SCRAM specification](https://datatracker.ietf.org/doc/html/rfc5802#page-8) - [SCRAM over SASL](http://www.alienfactory.co.uk/articles/skyspark-scram-over-sasl)