Finger.js

Simple WebAuthn Fingerprint Auth โ€“ No Dependencies

๐Ÿ“ฅ Download

โฌ‡๏ธ Download finger.js

๐Ÿš€ How to Use

๐Ÿ”น Async/Await Example

<script src="finger.js"></script>
    <script>
    async function register() {
    const id = await finger("#output").register();
    if (id) alert("โœ… Registered with ID: " + id);
    }
    
    async function login() {
    const ok = await finger("#output").login();
    if (ok) alert("โœ… Login successful!");
    }
    </script>

๐Ÿ”น Classic Callback Example

<script src="finger.js"></script>
    <script>
    function register() {
    finger("#output").register(function(id) {
    if (id) alert("โœ… Registered with ID: " + id);
    });
    }
    
    function login() {
    finger("#output").login(function(ok) {
    if (ok) alert("โœ… Login OK!");
    });
    }
    </script>

๐Ÿงช Live Demo Examples

๐Ÿ”น Async/Await (Modern)

// Async/Await
async function registerAsync() {
  const result = await finger("#output").register();
  if (result) alert("โœ… Registered!");
}
async function loginAsync() {
  const ok = await finger("#output").login();
  if (ok) alert("โœ… Login successful!");
}

๐Ÿ”น Traditional Callback (Classic)

// Classic Callbacks
function registerClassic() {
  finger("#output").register(function(result) {
    if (result) alert("โœ… Registered!");
  });
}
function loginClassic() {
  finger("#output").login(function(ok) {
    if (ok) alert("โœ… Login OK!");
  });
}

    

๐Ÿ“ Notes