iso-passkeys
v0.2.2
Published
Passkeys tooling.
Downloads
13
Maintainers
Readme
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