Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 1.76 KB

NON-BUNDLERS.md

File metadata and controls

49 lines (33 loc) · 1.76 KB

Deploying WebAuthn-Local-Client WITHOUT A Bundler

To use this library directly -- i.e., in a classic/vanilla web project without a modern bundler tool -- make a directory for it (e.g., webauthn-local-client/) in your browser app's JS assets directory.

Then copy over all @lo-fi/webauthn-local-client/dist/auto/* contents, as-is:

  • @lo-fi/webauthn-local-client/dist/auto/walc.js

    Note: this is not the same as dist/bundlers/walc.mjs, which is only intended for web application projects WITH a bundler

  • @lo-fi/webauthn-local-client/dist/auto/external.js

    This is an auto-loader that dynamically loads the rest of the non-ESM external/* dependencies via <script>-element injection into the DOM. @lo-fi/webauthn-local-client/dist/auto/walc.js runs this loader automatically.

  • @lo-fi/webauthn-local-client/dist/auto/external/* (preserve the whole external/ sub-directory):

    • libsodium.js
    • libsodium-wrappers.js
    • cbor.js
    • asn1.all.min.js

Import/Usage

To import and use webauthn-local-client in a non-bundled browser app:

import { register, auth } from "/path/to/js-assets/webauthn-local-client/walc.js";

The library's dependencies will be auto-loaded (via external.js).

Using Import Map

If your non-bundled browser app has an Import Map, you can improve the import by adding an entry for this library:

<script type="importmap">
{
    "imports": {
        "webauthn-local-client": "/path/to/js-assets/webauthn-local-client/walc.js"
    }
}
</script>

Then you'll be able to import the library in a more friendly/readable way:

import { register, auth } from "webauthn-local-client";