# semaphore-webauthn

> ## Example usage:

Latest version **1.2.0** (published 2023-03-17) · 0 weekly downloads

## Install

```sh
npm install semaphore-webauthn
pnpm add semaphore-webauthn
yarn add semaphore-webauthn
bun add semaphore-webauthn
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2023-03-17 |
| First published | 2023-03-16 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 63.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | richardliu |

## Links

- npm: https://www.npmjs.com/package/semaphore-webauthn
- npm.io page: https://npm.io/package/semaphore-webauthn

## Dependencies (3)

- [@simplewebauthn/server](https://npm.io/package/@simplewebauthn/server.md) ^7.2.0
- [@simplewebauthn/browser](https://npm.io/package/@simplewebauthn/browser.md) ^7.2.0
- [@semaphore-protocol/identity](https://npm.io/package/@semaphore-protocol/identity.md) ^3.2.3

## Recent versions

- 1.2.0 (latest) — 2023-03-17
- 1.1.0 — 2023-03-17
- 0.0.0 — 2023-03-16
- 0.1.0 — 2023-03-16
- 0.0.2 — 2023-03-16
- 0.0.1 — 2023-03-16
- 1.0.0 — 2023-03-16

## README

# semaphore-webauthn

## Example usage:

```typescript
import { WebAuthnIdentity } from "semaphore-webauthn";

// STEP 1: Configure WebAuthn options
const options = {
  rpName: "my-app",
  rpID: window.location.hostname,
  userID: "my-id",
  userName: "my-name",
};

// STEP 2: Register a new WebAuthn credential and get its Semaphore identity
const newWebAuthnIdentity = await WebAuthnIdentity.fromRegister(options);

// Now we can save this commitment in our DB (pseudocode)
const { commitment } = newWebAuthnIdentity.getIdentity();
fetch("/api/register" /* Replace this with your endpoint */, {
  commmitment,
  // ...
});

// STEP 3: Authenticate existing WebAuthn credential and signal
const existingWebAuthnIdentity = await WebAuthnIdentity.fromRegister(options);
// Get existing group and anonymously signal (pseudocode)
import { Group } from "@semaphore-protocol/group";
import { generateProof } from "@semaphore-protocol/proof";

const group = new Group(groupId, groupSize);
group.addMembers(memberList);

generateProof(
  existingWebAuthnIdentity.getIdentity(),
  group,
  groupId,
  "this is a signal",
  {
    zkeyFilePath: "./semaphore.zkey",
    wasmFilePath: "./semaphore.wasm",
  }
);
```

---
_Source: https://npm.io/package/semaphore-webauthn · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
