webauthn
БесплатноБез исполняемых скриптовНе проверенWebAuthn lets users sign in with passkeys (Face ID, Touch ID, Windows Hello, security keys) instead of passwords, using public-key credentials checked by your…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
WebAuthn / Passkeys
Overview
WebAuthn (Web Authentication) lets users authenticate with biometrics (Face ID, Touch ID, Windows Hello) or hardware keys (YubiKey) instead of passwords. Passkeys are WebAuthn credentials that can sync across devices through iCloud Keychain, Google Password Manager or a password manager such as 1Password.
- Relying Party (RP): your server; it issues challenges and verifies responses.
- Authenticator: the device or key that holds the private key; the private key never leaves it.
- Credential: a public/private key pair; you store the credential id and public key.
- Challenge: random bytes from the server, used once, which stops replay.
This skill uses SimpleWebAuthn 14 (@simplewebauthn/server 14.x and @simplewebauthn/browser 14.x, Node 20+). Differences from older tutorials: excludeCredentials and allowCredentials take { id, transports } with no type; browser calls take { optionsJSON }; verification takes a credential object (id, publicKey, counter, transports); registrationInfo.credential holds what you store.
Instructions
1. Install and configure the relying party
npm install @simplewebauthn/server @simplewebauthn/browser
// config/webauthn.ts
export const RP_NAME = "Northwind Traders";
export const RP_ID = process.env.RP_ID ?? "localhost"; // registrable domain, no scheme or port
export const ORIGIN = process.env.ORIGIN ?? "http://localhost:3000"; // exact origin(s) the browser will report
// Production: RP_ID=northwind-traders.dev, ORIGIN=https://app.northwind-traders.dev
RP_ID must equal the page's domain or a registrable parent of it. Credentials are bound to it for life: changing it orphans every passkey.
2. Registration
Server, step one: options. Store the challenge server-side (a session or Redis key with a TTL), never trust one sent back by the client.
import { generateRegistrationOptions, verifyRegistrationResponse } from "@simplewebauthn/server";
import { RP_ID, RP_NAME, ORIGIN } from "../config/webauthn";
app.post("/auth/register/begin", async (req, res) => {
const user = await requireSessionUser(req); // the user is already signed in (or just signed up)
const existing = await db.passkeys.findByUser(user.id);
const options = await generateRegistrationOptions({
rpName: RP_NAME,
rpID: RP_ID,
userName: user.email,
userDisplayName: user.name,
userID: new TextEncoder().encode(user.id), // stable, opaque id: not the email
excludeCredentials: existing.map((p) => ({ id: p.id, transports: p.transports })),
authenticatorSelection: { residentKey: "preferred", userVerification: "preferred" },
});
await challenges.set(user.id, options.challenge, { ttlSeconds: 300 });
res.json(options);
});
Server, step two: verify and store.
app.post("/auth/register/finish", async (req, res) => {
const user = await requireSessionUser(req);
const expectedChallenge = await challenges.take(user.id); // read and delete
if (!expectedChallenge) return res.status(400).json({ error: "Challenge expired" });
try {
const { verified, registrationInfo } = await verifyRegistrationResponse({
response: req.body.credential,
expectedChallenge,
expectedOrigin: ORIGIN,
expectedRPID: RP_ID,
requireUserVerification: false, // default is true; see Guidelines
});
if (!verified || !registrationInfo) return res.status(400).json({ error: "Verification failed" });
const { credential, credentialDeviceType, credentialBackedUp } = registrationInfo;
await db.passkeys.insert({
id: credential.id, // base64url string
userId: user.id,
publicKey: credential.publicKey, // Uint8Array: store as bytes
counter: credential.counter,
transports: credential.transports,
deviceType: credentialDeviceType, // "singleDevice" | "multiDevice"
backedUp: credentialBackedUp,
});
res.json({ ok: true });
} catch (err) {
res.status(400).json({ error: (err as Error).message });
}
});
Browser:
import { startRegistration, browserSupportsWebAuthn } from "@simplewebauthn/browser";
export async function registerPasskey() {
if (!browserSupportsWebAuthn()) throw new Error("This browser does not support passkeys");
const options = await (await fetch("/auth/register/begin", { method: "POST" })).json();
let credential;
try {
credential = await startRegistration({ optionsJSON: options });
} catch (err) {
if ((err as Error).name === "InvalidStateError") throw new Error("This device already has a passkey for this account");
throw err;
}
const res = await fetch("/auth/register/finish", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ credential }),
});
if (!res.ok) throw new Error((await res.json()).error);
}
3. Authentication
import { g
Установить webauthn в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл webauthn?
WebAuthn lets users sign in with passkeys (Face ID, Touch ID, Windows Hello, security keys) instead of passwords, using public-key credentials checked by your server. Use when adding passkey or biometric login, implementing FIDO2 authentication, replacing password forms, or verifying credentials with the SimpleWebAuthn library for Node.js, py_webauthn for Python or WebAuthn4J for Java.
Как установить скилл webauthn?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл webauthn запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic