-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #114 Demo: https://user-images.githubusercontent.com/36896271/233920583-5d5e77cc-ff50-4f4c-a617-a5dfc5e21a66.mov - [x] WebAuthn logic - [x] prove - [x] verify - [x] docs - [x] tests (in progress) - [x] consumer-client
- Loading branch information
Showing
19 changed files
with
3,759 additions
and
2,209 deletions.
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> | ||
|
||
<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.