{"id":17216886,"url":"https://github.com/markusjx/passport-desktop","last_synced_at":"2025-04-13T23:25:02.542Z","repository":{"id":189348296,"uuid":"668421748","full_name":"MarkusJx/passport-desktop","owner":"MarkusJx","description":"A Node.js addon for enabling Client-side Windows Hello using Microsoft Passport","archived":false,"fork":false,"pushed_at":"2023-08-20T10:14:55.000Z","size":289,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-01T16:21:01.180Z","etag":null,"topics":["electron","microsoft-passport","nodejs"],"latest_commit_sha":null,"homepage":"https://markusjx.github.io/passport-desktop/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MarkusJx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null}},"created_at":"2023-07-19T19:10:20.000Z","updated_at":"2024-08-19T16:16:44.809Z","dependencies_parsed_at":"2024-08-19T16:16:27.750Z","dependency_job_id":"7845d6f4-7008-4b69-9031-faa811d0745e","html_url":"https://github.com/MarkusJx/passport-desktop","commit_stats":null,"previous_names":["markusjx/passport-desktop"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkusJx%2Fpassport-desktop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkusJx%2Fpassport-desktop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkusJx%2Fpassport-desktop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkusJx%2Fpassport-desktop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarkusJx","download_url":"https://codeload.github.com/MarkusJx/passport-desktop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248795328,"owners_count":21162750,"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":["electron","microsoft-passport","nodejs"],"created_at":"2024-10-15T03:42:36.097Z","updated_at":"2025-04-13T23:25:02.509Z","avatar_url":"https://github.com/MarkusJx.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# passport-desktop\n\nWindows Hello for client Applications in Node.js on Windows Platforms.\nThis is a replacement for the [node-ms-passport](https://github.com/MarkusJx/node-ms-passport) module.\n\nThis module's implementation was heavily inspired by the\n[desktop module of bitwarden](https://github.com/bitwarden/clients/tree/master/apps/desktop/desktop_native).\n\n## Installation\n\n```bash\nnpm install passport-desktop\n```\n\nPre-built binaries are available for windows 32/64 bit platforms.\nOn other platforms, the module is obviously not available,\nimporting it will **not** throw an error. Instead, all methods will\nthrow an error when called, except for `Passport.available()` which\nwill return `false`.\n\n## Usage\n\n### Check if Windows Hello is available\n\n```ts\nimport { Passport } from 'passport-desktop';\n\nif (!Passport.available()) {\n    throw new Error('Windows Hello is not available');\n}\n```\n\n### Check if an Passport account with a given id exists\n\n```ts\nimport { Passport } from 'passport-desktop';\n\nawait Passport.accountWithIdExists('my-account-id'); // false, probably\n```\n\n### Create a new Passport account and sign a challenge\n\n```ts\nimport {\n    Passport,\n    PublicKeyEncoding,\n    KeyCreationOption,\n} from 'passport-desktop';\nimport { randomBytes, createPublicKey, createVerify } from 'node:crypto';\n\nconst passport = new Passport('my-account-id');\nif (!passport.accountExists) {\n    await passport.createAccount(KeyCreationOption.FailIfExists);\n}\n\nconst challenge = randomBytes(32);\nconst signature = await passport.sign(challenge);\n\n// Verify the signature with the public key\nconst keyBuffer = await passport.getPublicKey(\n    PublicKeyEncoding.Pkcs1RsaPublicKey\n);\nconst key = createPublicKey({\n    key: keyBuffer,\n    format: 'der',\n    type: 'pkcs1',\n});\n\n// Create a verifier and verify the challenge\nconst verify = createVerify('SHA256');\nverify.write(challenge);\nverify.end();\n\nverify.verify(key, signature); // true\n\n// Delete the account\nawait passport.deleteAccount();\n```\n\n### Verify a challenge signed by a client\n\nA challenge signed by a client can be verified by using the public key of the client.\nThe node-crypto module may be used to verify the signature.\nThe public key can be obtained by the client by calling `Passport.getPublicKey()` and\npassing the `PublicKeyEncoding.Pkcs1RsaPublicKey` encoding option to that method.\n\n```ts\nimport { randomBytes, createPublicKey, createVerify } from 'node:crypto';\n\nconst challenge = randomBytes(32);\n\n// Send the challenge to the client and obtain the signature\n\nconst keyBuffer: Buffer = ...; // Obtain the public key from the client\nconst signature: Buffer = ...; // Obtain the signature from the client\n\nconst key = createPublicKey({\n    key: keyBuffer,\n    format: 'der',\n    type: 'pkcs1'\n});\n\nconst verify = createVerify('SHA256');\nverify.write(challenge);\nverify.end();\n\nverify.verify(key, signature);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkusjx%2Fpassport-desktop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkusjx%2Fpassport-desktop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkusjx%2Fpassport-desktop/lists"}