-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,579 additions
and
553 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: main | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-22.04 | ||
|
||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | ||
|
||
- name: Install NodeJS | ||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run format | ||
run: npm run format:check | ||
|
||
deploy: | ||
if: ${{ github.event_name == 'release' }} | ||
needs: format | ||
runs-on: ubuntu-22.04 | ||
|
||
permissions: | ||
actions: write | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | ||
|
||
- name: Install NodeJS | ||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run build | ||
run: npm run build | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 | ||
with: | ||
name: packages | ||
path: | | ||
dist | ||
package.json | ||
- name: Dispatch deployment | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.DEPLOYMENT_GITHUB_TOKEN }} | ||
run: > | ||
gh workflow run passwordless-client-js | ||
--repo bitwarden/passwordless-devops | ||
--field repository=${{ github.repository }} | ||
--field run-id=${{ github.run_id }} | ||
--field name=packages |
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
{ | ||
"arrowParens": "always", | ||
"bracketSameLine": false, | ||
"bracketSpacing": true, | ||
"endOfLine": "auto", | ||
"printWidth": 100, | ||
"semi": true, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "none", | ||
"quoteProps": "consistent" | ||
} |
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
.png) | ||
.png>) | ||
|
||
Welcome to Passwordless.dev by Bitwarden. Passwordless.dev is a software toolkit that helps developers bring FIDO2 WebAuthn passkeys to their end users. Provide passwordless authentication without the need to read W3C specification documentation, determine cryptography, or manage stored public keys. Passwordless with Bitwarden does this for you. | ||
|
||
## Get started | ||
|
||
Passwordless.dev consists of three key parts: | ||
|
||
* An open-source client side library, used by your frontend to make requests to the end-user's browser WebAuthn API and requests to the passwordless.dev APIs. | ||
* A public RESTful API used to complete FIDO2 WebAuthn cryptographic exchanges with the browser. | ||
* a private RESTful API used to initiate key registrations, verify signins, and retrieve keys for end-users. | ||
- An open-source client side library, used by your frontend to make requests to the end-user's browser WebAuthn API and requests to the passwordless.dev APIs. | ||
- A public RESTful API used to complete FIDO2 WebAuthn cryptographic exchanges with the browser. | ||
- a private RESTful API used to initiate key registrations, verify signins, and retrieve keys for end-users. | ||
|
||
To start, download the Passwordless.js library: | ||
|
||
|
@@ -30,22 +30,26 @@ Next, your front end must import the library to call the methods: | |
|
||
```js | ||
import { Client } from '@passwordlessdev/passwordless-client'; | ||
const p = new Client({apiKey: ""}); | ||
const p = new Client({ apiKey: '' }); | ||
``` | ||
|
||
#### HTML | ||
|
||
Install the Passwordless.dev JS client: | ||
|
||
```html | ||
<script src="https://cdn.passwordless.dev/dist/1.1.0/passwordless.iife.js" crossorigin="anonymous"></script>` | ||
<script | ||
src="https://cdn.passwordless.dev/dist/1.1.0/passwordless.iife.js" | ||
crossorigin="anonymous" | ||
></script> | ||
` | ||
``` | ||
|
||
Next, your front end must import the libary to call the methods: | ||
|
||
```html | ||
<script> | ||
const p = new Passwordless.Client({apiKey: ""}); | ||
const p = new Passwordless.Client({ apiKey: '' }); | ||
</script> | ||
``` | ||
|
||
|
@@ -54,12 +58,14 @@ Registering a token could look like: | |
```javascript | ||
// Instantiate a passwordless client using your API public key. | ||
const p = new Passwordless.Client({ | ||
apiKey: "myapplication:public:4364b1a49a404b38b843fe3697b803c8" | ||
apiKey: 'myapplication:public:4364b1a49a404b38b843fe3697b803c8' | ||
}); | ||
|
||
// Fetch the registration token from the backend. | ||
const backendUrl = "https://localhost:8002"; | ||
const registerToken = await fetch(backendUrl + "/create-token?userId" + userId).then(r => r.json()); | ||
const backendUrl = 'https://localhost:8002'; | ||
const registerToken = await fetch(backendUrl + '/create-token?userId' + userId).then((r) => | ||
r.json() | ||
); | ||
|
||
// Register the token with the end-user's device. | ||
const { token, error } = await p.register(registerToken); | ||
|
@@ -90,7 +96,7 @@ To create an account for yourself or your organization, visit [this link](https: | |
## Next steps | ||
|
||
1. Call the function `register` or (e.g. `signinWithDiscoverable()`). | ||
2. Add two endpoints to your backend that integrate to your existing user system (*set cookie, sessions, and more*) and will communicate secrets with our API. | ||
2. Add two endpoints to your backend that integrate to your existing user system (_set cookie, sessions, and more_) and will communicate secrets with our API. | ||
3. Make a request between your clientside code and the verification endpoints on your backend to verify the registration or sign in. | ||
|
||
We've written a more detailed guide, with more language examples and SDKs in the [Passwordless.dev](https://docs.passwordless.dev/guide/) documentation. | ||
|
@@ -100,6 +106,7 @@ We've written a more detailed guide, with more language examples and SDKs in the | |
To talk to the passwordless team, send us an email at [email protected] | ||
|
||
## References | ||
|
||
- [Using the JavaScript client](https://docs.passwordless.dev/guide/frontend/javascript.html) | ||
|
||
## Bitwarden | ||
|
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,13 @@ | ||
import js from '@eslint/js'; | ||
import eslintConfigPrettier from 'eslint-config-prettier'; | ||
|
||
export default [ | ||
js.configs.recommended, | ||
eslintConfigPrettier, | ||
{ | ||
ignores: ['node_modules/'], | ||
rules: { | ||
'no-unused-vars': 'warn' | ||
} | ||
} | ||
]; |
Oops, something went wrong.