{"id":15198661,"url":"https://github.com/codebytere/node-mac-auth","last_synced_at":"2025-10-28T10:32:54.891Z","repository":{"id":35038972,"uuid":"199366846","full_name":"codebytere/node-mac-auth","owner":"codebytere","description":"handle and query for biometric auth on macOS!","archived":false,"fork":false,"pushed_at":"2024-02-21T11:11:41.000Z","size":336,"stargazers_count":25,"open_issues_count":5,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-14T07:25:54.624Z","etag":null,"topics":["authentication","electronjs","macos","nodejs","touchid"],"latest_commit_sha":null,"homepage":"","language":"Objective-C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codebytere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-07-29T02:52:14.000Z","updated_at":"2024-03-29T15:07:19.000Z","dependencies_parsed_at":"2024-02-21T12:24:21.556Z","dependency_job_id":"fef09cc6-dfaa-476a-bb80-9915002980e4","html_url":"https://github.com/codebytere/node-mac-auth","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebytere%2Fnode-mac-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebytere%2Fnode-mac-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebytere%2Fnode-mac-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebytere%2Fnode-mac-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codebytere","download_url":"https://codeload.github.com/codebytere/node-mac-auth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238638096,"owners_count":19505532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","electronjs","macos","nodejs","touchid"],"created_at":"2024-09-28T01:23:56.794Z","updated_at":"2025-10-28T10:32:49.558Z","avatar_url":"https://github.com/codebytere.png","language":"Objective-C++","readme":"[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)\n [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![GitHub release](https://img.shields.io/github/release/codebytere/node-mac-auth.svg)](https://GitHub.com/codebytere/node-mac-auth/releases/) [![Actions Status](https://github.com/codebytere/node-mac-auth/workflows/Test/badge.svg)](https://github.com/codebytere/node-mac-auth/actions)\n\n# node-mac-auth\n\nA native node module that allows you to query and handle native macOS biometric authentication. \n\nThis module will have no effect unless there's an app bundle to own it: without one the API will simply appear not to run as a corollary of the way macOS handles native UI APIs.\n\n**Nota Bene:** This module does not nor is it intended to perform process privilege escalation, e.g. allow you to authenticate as an admin user.\n\n## API\n\n### `canPromptTouchID()`\n\nReturns `Boolean` - whether or not this device has the ability to use Touch ID.\n\n```js\nconst { canPromptTouchID } = require('node-mac-auth')\n\nconst canPrompt = canPromptTouchID()\nconsole.log(`I ${canPrompt ? 'can' : 'cannot'} prompt for TouchID!`)\n```\n\n**NOTE:** This API will return `false` on macOS systems older than Sierra 10.12.2.\n\n### `promptTouchID(options)`\n\n* `options` Object\n  * `reason` String - The reason you are asking for Touch ID authentication.\n  * `reuseDuration` Number (optional) - The duration for which Touch ID authentication reuse is allowable, in seconds.\n\nReturns `Promise\u003cvoid\u003e` - resolves when Touch ID authenticates successfully.\n\n```js\nconst { promptTouchID } = require('node-mac-auth')\n\npromptTouchID({ reason: 'To get consent for a Security-Gated Thing' }).then(() =\u003e {\n  console.log('You have successfully authenticated with Touch ID!')\n}).catch(err =\u003e {\n  console.log('TouchID failed because: ', err)\n})\n```\n\n## Trying It Out\n\nTo see this module in action:\n\n```sh\n$ git clone https://github.com/electron/electron-quick-start\n$ cd electron-quick-start\n$ npm install\n$ npm install node-mac-auth\n```\n\nthen open `main.js` inside `electron-quick-start` and add:\n\n```js\nconst { canPromptTouchID, promptTouchID } = require('node-mac-auth')\n```\n\nto the top at line 4, and \n\n```js\nconst canPrompt = canPromptTouchID()\nconsole.log(`I ${canPrompt ? 'can' : 'cannot'} prompt for TouchID!`)\n\npromptTouchID({ reason: 'To get consent for a Security-Gated Thing' }).then(() =\u003e {\n  console.log('You have successfully authenticated with Touch ID!')\n}).catch(err =\u003e {\n  console.log('TouchID failed because: ', err)\n})\n```\n\nInside the `createWindow` function beginning at line 9. Enjoy!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebytere%2Fnode-mac-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodebytere%2Fnode-mac-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebytere%2Fnode-mac-auth/lists"}