BioLock / source · biolock.dev / commits / ca434489
Name it BioLock new
written by Moontrace · ca4344897262c36de86cc3c37d2f69413751f189 · parent 6e78aa17
5 files changed
README.md changed
| 1 | | - # Moontrace fingerprint sign-in |
| 1 | + # BioLock |
| 2 | 2 | |
| 3 | | - Sign in with your own fingerprint or face. That is the only way: no passwords, no security keys, |
| 3 | + BioLock: sign in with your own fingerprint or face. That is the only way: no passwords, no security keys, |
| 4 | 4 | no QR codes, no phone-to-computer sign-in. A Moontrace project, public domain (Unlicense). |
| 5 | 5 | |
| 6 | | - Live: https://moontrace.ai/fingerprint/ · Demo: https://moontrace.ai/fingerprint/demo/ |
| 6 | + Live: https://moontrace.ai/biolock/ · Demo: https://moontrace.ai/biolock/demo/ |
| 7 | 7 | |
| 8 | 8 | ## How it works |
| 9 | 9 | |
demo/app.js changed
| 4 | 4 | import * as C from '../code/client.js'; |
| 5 | 5 | |
| 6 | 6 | const rpId = location.hostname, origin = location.origin; |
| 7 | | - const DB = 'moontrace-fingerprint-demo'; |
| 7 | + const DB = 'biolock-demo'; |
| 8 | 8 | const db = () => { try { return JSON.parse(localStorage.getItem(DB) || '{"creds":[]}'); } catch { return { creds: [] }; } }; |
| 9 | 9 | const put = (v) => { try { localStorage.setItem(DB, JSON.stringify(v)); } catch { /* private mode */ } }; |
| 10 | 10 | const $ = (s) => document.querySelector(s); |
| | ⋯ |
| 30 | 30 | |
| 31 | 31 | $('#fp-add').onclick = async () => { |
| 32 | 32 | try { |
| 33 | | - const opts = S.registrationOptions({ rpId, rpName: 'Moontrace fingerprint sign-in demo', userName: 'demo', displayName: 'Demo member', excludeIds: C.enrolledOnThisDevice(rpId) }); |
| 33 | + const opts = S.registrationOptions({ rpId, rpName: 'BioLock demo', userName: 'demo', displayName: 'Demo member', excludeIds: C.enrolledOnThisDevice(rpId) }); |
| 34 | 34 | const cred = await C.enrollThisDevice(opts); |
| 35 | 35 | const rec = await S.verifyRegistration({ credential: cred, expectedChallenge: opts.challenge, expectedOrigin: origin, rpId }); |
| 36 | 36 | rec.name = ($('#fp-name').value || '').trim() || 'This device'; |
src/client.js changed
| 1 | | - // Moontrace fingerprint sign-in: browser side. |
| 1 | + // BioLock: browser side. |
| 2 | 2 | // Sign in with this device's own fingerprint or face reader. Nothing else: no security keys, |
| 3 | 3 | // no QR codes, no phone-to-computer sign-in. Uses the browser's W3C Web Authentication API, |
| 4 | 4 | // limited to the built-in reader. Public domain (Unlicense). |
| 5 | 5 | |
| 6 | | - const KEY = 'moontrace-fingerprint:enrolled-here'; |
| 6 | + const KEY = 'biolock:enrolled-here'; |
| 7 | 7 | |
| 8 | 8 | function toB64u(buf) { |
| 9 | 9 | const b = new Uint8Array(buf); let s = ''; |
src/server.js changed
| 1 | | - // Moontrace fingerprint sign-in: server side. |
| 1 | + // BioLock: server side. |
| 2 | 2 | // Sign in with the fingerprint or face reader built into your own device. Nothing else: |
| 3 | 3 | // no passwords, no security keys, no QR codes, no phone-to-computer sign-in. |
| 4 | 4 | // Under the hood it uses the W3C Web Authentication standard, because that is the only way |
test/server.test.js changed
| 87 | 87 | const stored = await S.verifyRegistration({ credential: await k.create(ro), expectedChallenge: ro.challenge, expectedOrigin: ORIGIN, rpId: RP }); |
| 88 | 88 | const so = S.signInOptions({ rpId: RP }); |
| 89 | 89 | await assert.rejects(S.verifySignIn({ credential: await k.get(so), stored, expectedChallenge: 'other', expectedOrigin: ORIGIN, rpId: RP }), /challenge/); |
| 90 | | - await assert.rejects(S.verifySignIn({ credential: await k.get(so, { flags: 0x01 }), stored, expectedChallenge: so.challenge, expectedOrigin: ORIGIN, rpId: RP }), /fingerprint/); |
| 90 | + await assert.rejects(S.verifySignIn({ credential: await k.get(so, { flags: 0x01 }), stored, expectedChallenge: so.challenge, expectedOrigin: ORIGIN, rpId: RP }), /biolock/); |
| 91 | 91 | const bad = await k.get(so); const sig = S.fromB64u(bad.response.signature); sig[10] ^= 1; bad.response.signature = S.toB64u(sig); |
| 92 | 92 | await assert.rejects(S.verifySignIn({ credential: bad, stored, expectedChallenge: so.challenge, expectedOrigin: ORIGIN, rpId: RP }), /signature/); |
| 93 | 93 | k.setCounter(5); |
Browse files at this commit