-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add webauthn-pcd
package
#134
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9852c24
add webauthn-pcd package
rrrliu 188f82b
pr comments
rrrliu bf3c826
proving example consumer-client
rrrliu 3a2c7aa
tests
rrrliu c08d29e
remove jest
rrrliu deaaf3b
update lockfiles
rrrliu 8898f68
pr comments
rrrliu 8a4ff88
readme fixes
rrrliu ac49c88
comments
rrrliu 764a9f1
fix build
rrrliu 287e940
use jest
rrrliu 51ece36
versions
rrrliu 1a7d636
remove unnecessary mocha and sinon
rrrliu 8f826b8
Merge branch 'main' into rrrliu/webauthn-pcd
rrrliu ce86b1b
fix build
rrrliu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
extends: ["@pcd/eslint-config-custom"], | ||
root: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"loader": "ts-node/esm" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# @pcd/webauthn-pcd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# `@pcd/webauthn-pcd` | ||
|
||
A wrapper around WebAuthn authentication verification as specified by the [W3C protocol](https://www.w3.org/TR/webauthn-2/#sctn-verifying-assertion). WebAuthn enables authentication via a keypair rather than a password, including Face ID, Yubico devices, and many other devices. More options can be configured, such as allowed origin, a unique client ID, and a challenge to be signed. | ||
|
||
In contrast to purely software-based PCDs, the WebAuthn PCD allows for actions in the physical world to form the basis of a proof. The specific _authorization gesture_ used for registration and authentication can be associated with a hardware device and includes actions like facial recognition, PINs, and fingerprints. With a TPM or secure enclave, the authenticator can have certain security guarantees, such as the private key not being knowable even by the owner of the device. | ||
|
||
Some example use cases: | ||
|
||
- Proof that I own a particular Yubikey and therefore am a authorized member of an organization. | ||
- Proof that I own an Apple device that has a particular [Passkey](https://developer.apple.com/passkeys/), and that I've used Face ID or Touch ID to authenticate. | ||
- Proof that a human has in some way interacted with a hardware device (through fingerprint, facial scan, or other [test of user presence](https://www.w3.org/TR/webauthn-2/#test-of-user-presence)), and therefore not an script or automated spammer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./src/WebAuthnPCD"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@pcd/webauthn-pcd", | ||
"version": "0.5.3", | ||
"license": "GPL-3.0-or-later", | ||
"main": "./index.ts", | ||
"types": "./index.ts", | ||
"scripts": { | ||
"lint": "eslint \"**/*.ts{,x}\"", | ||
"test": "jest", | ||
"build": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"@pcd/pcd-types": "0.5.3", | ||
"@simplewebauthn/browser": "^7.2.0", | ||
"@simplewebauthn/server": "^7.2.0", | ||
"@simplewebauthn/typescript-types": "^7.0.0", | ||
"@types/expect": "^24.3.0", | ||
"@types/jest": "^29.5.0", | ||
"@types/json-bigint": "^1.0.1", | ||
"json-bigint": "^1.0.0", | ||
"typescript": "^4.5.2", | ||
"uuid": "^9.0.0" | ||
}, | ||
"devDependencies": { | ||
"@pcd/eslint-config-custom": "*", | ||
"@pcd/tsconfig": "*", | ||
"eslint": "^7.32.0", | ||
"jest": "^29.5.0", | ||
"ts-jest": "^29.1.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { FieldLabel, Separator, Spacer, TextContainer } from "@pcd/passport-ui"; | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
import { WebAuthnPCD } from "./WebAuthnPCD"; | ||
|
||
export function WebAuthnCardBody({ pcd }: { pcd: WebAuthnPCD }) { | ||
return ( | ||
<Container> | ||
<p> | ||
This PCD represents a signature proof in the context of a WebAuthn | ||
credential. In other words, this is a ZK proof that a particular | ||
credential keypair signed a particular challenge. | ||
</p> | ||
Comment on lines
+9
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💯 |
||
|
||
<Separator /> | ||
|
||
<FieldLabel>Credential Public Key</FieldLabel> | ||
<TextContainer> | ||
{pcd.claim.credentialDetails.credentialPublicKey} | ||
</TextContainer> | ||
<Spacer h={8} /> | ||
|
||
<FieldLabel>Credential ID</FieldLabel> | ||
<TextContainer>{pcd.claim.credentialDetails.credentialID}</TextContainer> | ||
<Spacer h={8} /> | ||
|
||
<FieldLabel>Challenge</FieldLabel> | ||
<TextContainer>{pcd.claim.challenge}</TextContainer> | ||
<Spacer h={8} /> | ||
|
||
<FieldLabel>Origin</FieldLabel> | ||
<TextContainer>{pcd.claim.origin}</TextContainer> | ||
<Spacer h={8} /> | ||
|
||
<FieldLabel>Relying Party ID</FieldLabel> | ||
<TextContainer>{pcd.claim.rpID}</TextContainer> | ||
</Container> | ||
); | ||
} | ||
|
||
const Container = styled.div` | ||
padding: 16px; | ||
overflow: hidden; | ||
width: 100%; | ||
`; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verbosely commenting this function and each step may be nice