@v4tab/ootauth

the ootkey authentication module

Usage no npm install needed!

<script type="module">
  import v4tabOotauth from 'https://cdn.skypack.dev/@v4tab/ootauth';
</script>

README

README

ootauth

A ootkey client library for using ootkeys

npm i @v4tab/ootauth

ootauth = require("@v4tab/ootauth"),

then

ootauth(app, cfg);

where app is the koa instance and cfg is:

{
    "domain":           "keyboxmail.com",
    "aname":            "auth.keyboxmail.com",
    "client_id":        "B8...jmy1D9ZOMmeATlSA",
    "jwtkey":           "YBkluAu...MAYHHwPg",
    "keybase":          "/k/auth.keyboxmail.com",
    "name":             "keyboxmail",
    "refer_url":        "/landing/refer",
    "validation_url":   "/landing/validate",
    "tokenname":        "ootkey_keyboxmail"
}

ootauth attaches methods to the koa app.context

a_process_token(ctx) calls v4token.a_checkcookie(ctx) If it is not a valid token (using the above cfg) it redirects to cfg.aname. This is the old style validation and is no longer used.

a_debugcookie calls v4token.a_checkcookie(ctx);

a_validate(ctx) is used to check if there is a valid client cookie. It calls v4token.a_checkcookie(ctx);

a_process_query(ctx); takes a ctx and expects a query with error or token elements.

The token is one that has been generated by ootkey.com and is signed with the correct key. If it receives the correct token. It sets a