0.2.2 • Published 8 months ago

iso-passkeys v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

iso-passkeys NPM Version License iso-passkeys

Isomorphic passkeys tooling

Install

pnpm install iso-passkeys

Usage

import { supports, credentialsCreate, credentialsGet } from 'iso-passkeys'

const credential = await credentialsCreate({
  publicKey: {
    challenge: base64url.encode(new Uint8Array([1, 2, 3, 4])),
    rp: {
      id: 'example.com',
      name: 'Example',
    },
    user: {
      id: user.id,
      name: username,
      displayName: 'Joe Doe',
    },
    attestation: 'none',
    authenticatorSelection: {
      userVerification: 'required',
      requireResidentKey: true,
      residentKey: 'required',
    },
    extensions: {
      credProps: true,
      largeBlob: {
        support: 'preferred',
      },
      prf: {
        eval: {
          first: new Uint8Array(new Array(32).fill(1)).buffer,
          second: new Uint8Array(new Array(32).fill(1)).buffer,
        },
      },
    },
  },
})

const assertion = await credentialsGet({
  mediation: 'conditional',
  publicKey: {
    challenge: base64url.encode(new Uint8Array([1, 2, 3, 4])),,
    allowCredentials: [],
    userVerification: 'required',
    rpId: 'example.com',
    extensions: {
      largeBlob: {
        // read: true,
        write: utf8.decode('hello world').buffer,
      },
      prf: {
        eval: {
          first: utf8.decode('first-salt').buffer,
          second: utf8.decode('second-salt').buffer,
        },
      },
    },
  },
})

Docs

Check https://hugomrdias.github.io/iso-repo/modules/iso_passkeys.html

License

MIT © Hugo Dias

0.2.2

8 months ago

0.2.1

9 months ago

0.2.0

10 months ago

0.1.1

12 months ago

0.1.6

12 months ago

0.1.5

12 months ago

0.1.0

12 months ago

0.0.1

12 months ago