Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cvolny/npm-webauthn-client

Webauthn client leveraging Axios and CBOR encoding.
https://github.com/cvolny/npm-webauthn-client

axios cbor django-rest-framework nodejs npm reactjs webauthn

Last synced: about 14 hours ago
JSON representation

Webauthn client leveraging Axios and CBOR encoding.

Awesome Lists containing this project

README

        

# @cvolny/webauthn-client
Webauthn client leveraging Axios and CBOR encoding.

I have request/response interceptors set on an axios instance inside of webauthn.js such that
CBOR encoding/decoding is performed for you. I also configured the axios xsrf settings for
the Django web framework default configuration.

## Example Usage:
```
import {
webauthn_login,
webauthn_register,
} from "webauthn-client";

...

login_passwordless = (username) => {
const success = (res) => this.setState({authenticated: true});
const failure = (res, code) => console.log('webauthn login failed', code, res);
webauthn_login({username: username}, success, failure);
};

login_2fa = (username, password) => {
const success = (res) => this.setState({authenticated: true});
const failure = (res, code) => console.log('webauthn login failed', code, res);
webauthn_login({username: username, password: password}, success, failure);
};

register = () => {
const success = (res) => console.log('registered!');
const failure = (res, code) => console.log('webauthn registration failed', code, res);
webauthn_register({}, success, failure);
};
```

## Notes:

Really any map can be passed for authentication payload (username, password, token, etc).