JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q25645F
  • License MIT

A u2f host implementation in node.js

Package Exports

  • u2f-host-node

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (u2f-host-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

U2F Host Node

A u2f host implementation in node.js

Install

npm install u2f-host-node --save
# or
yarn add u2f-host-node

Usage

const u2f = require('u2f')
const U2FHost = require('u2f-host-node').U2FHost

async function main() {
  const host = U2FHost.discover()
  const appId = 'https://example.com'

  // register
  const registerReq = u2f.request(appId)
  console.log('Touch the key to register')
  const registerResponse = await host.register(registerReq)
  const registration = u2f.checkRegistration(authRequest, registerResponse)

  // sign
  const signRequest = u2f.request(appId, registration.keyHandle)
  console.log('Touch the key to sign')
  const signResponse = await host.authenticate(signRequest)
  const verified = u2f.checkSignature(signRequest, signResponse, registration.publicKey)
}

main()

Docs

Development

Prerequisites

Before development, make sure you installed all packages. We are using yarn for this project.

yarn

Developing SDK

## build
yarn build

## test
yarn test
# or watch changes
yarn test:dev

## lint
yarn lint

FAQ