Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@j2inn/scram

garethj998.1kISC1.0.6TypeScript support: included

TypeScript client SCRAM authentication library

j2, client, scram, authentication, typescript

readme

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.

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
  })
}