New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

web-auth-prf2

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web-auth-prf2

A lightweight TypeScript library that implements WebAuthn with PRF (Pseudo-Random Function) for secure authentication and encryption. This package allows users to register, authenticate, and encrypt/decrypt messages using derived keys.

latest
npmnpm
Version
1.0.4
Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

WebAuthn PRF Example

A lightweight TypeScript library that implements WebAuthn with PRF (Pseudo-Random Function) for secure authentication and encryption. This package allows users to register, authenticate, and encrypt/decrypt messages using derived keys.

Installation

Install the package using npm:

# npm install webauthn-prf-example

Usage

Register a User

To register a new user, call the handleRegister function:

// import { handleRegister } from "webauthn-prf-example";

document.getElementById("registerBtn").addEventListener("click", async () => {
  await handleRegister();
});

Authenticate a User

To authenticate an existing user, call the handleAuthenticate function:

// import { handleAuthenticate } from "webauthn-prf-example";

document
  .getElementById("authenticateBtn")
  .addEventListener("click", async () => {
    await handleAuthenticate();
  });

Save and Load Messages

To save and retrieve encrypted messages, use the saveMessage and loadMessages functions:

// import { saveMessage } from "webauthn-prf-example";

document
  .getElementById("saveMessageBtn")
  .addEventListener("click", async () => {
    await saveMessage();
  });

Logout

To log out and clear stored credentials and messages, use the handleLogout function:

// import { handleLogout } from "webauthn-prf-example";

document.getElementById("logoutBtn").addEventListener("click", async () => {
  await handleLogout();
});

API

handleRegister()

Registers a new user with WebAuthn and securely stores authentication credentials.

handleAuthenticate()

Authenticates a registered user using WebAuthn credentials.

saveMessage()

Encrypts and saves a message using the derived encryption key.

loadMessages()

Loads and decrypts saved messages.

handleLogout()

Clears stored credentials and messages, effectively logging out the user.

For more details, check out the official WebAuthn documentation: MDN WebAuthn Docs.

FAQs

Package last updated on 05 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts