Skip to content

Commit 583aba3

Browse files
initial commit
0 parents commit 583aba3

18 files changed

+4240
-0
lines changed

.github/workflows/docs.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v2
17+
18+
- name: Install dependencies
19+
run: npm ci
20+
21+
- name: Test to see if the project compiles
22+
run: npm run build:check
23+
24+
- name: Create the docs directory locally in CI
25+
run: npm run docs
26+
27+
- name: Deploy 🚀
28+
uses: JamesIves/github-pages-deploy-action@4.1.4
29+
with:
30+
branch: gh-pages
31+
folder: docs

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
on:
2+
release:
3+
types: [created]
4+
5+
name: Release
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v2
16+
17+
- name: Install dependencies
18+
run: npm ci
19+
20+
- uses: JS-DevTools/npm-publish@v1
21+
with:
22+
token: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout the repository
14+
uses: actions/checkout@v2
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v2
18+
19+
- name: Install dependencies
20+
run: npm ci
21+
22+
- name: Test to see if the project compiles
23+
run: npm run build:check
24+
25+
- name: Check code formatting with ESLint
26+
run: npm run lint:check

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.DS_Store
2+
/node_modules
3+
/dist
4+
/docs

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.github
2+
node_modules
3+
dist
4+
docs
5+
out
6+
.eslintrc.js
7+
*.min.js

.prettierrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
trailingComma: 'es5',
3+
useTabs: true,
4+
tabWidth: 4,
5+
semi: true,
6+
singleQuote: true,
7+
};

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Spire Technology Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# js-webauthn
2+
3+
A TypeScript / JavaScript library for registering and authenticating with WebAuthn.
4+
5+
This library is intended to integrate with the Go backend library [spiretechnology/go-webauthn](https://github.com/spiretechnology/go-webauthn). Together, these two libraries will abstract away the complexities of WebAuthn encoding, decoding, verification, etc.
6+
7+
## Installation
8+
9+
```sh
10+
npm install --save @spiretechnology/js-webauthn
11+
```
12+
13+
## Example usage
14+
15+
```ts
16+
import { WebAuthnClient } from '@spiretechnology/js-webauthn';
17+
18+
const client = new WebAuthnClient();
19+
20+
async function register() {
21+
// Request a challenge from the server
22+
const challenge = //...
23+
24+
// Register a device with the WebAuthn client
25+
const response = await client.register(challenge);
26+
27+
// Send the response to the server
28+
// ...
29+
}
30+
31+
async function authenticate() {
32+
// Request a challenge from the server
33+
const challenge = //...
34+
35+
// Authenticate with the WebAuthn client
36+
const response = await client.authenticate(challenge);
37+
38+
// Send the response to the server
39+
// ...
40+
}
41+
```
42+
43+
## Other resources
44+
45+
- [spiretechnology/go-webauthn](https://github.com/spiretechnology/go-webauthn) - WebAuthn backend library for Go.

jest.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
transform: { '^.+\\.ts?$': 'ts-jest' },
3+
testEnvironment: 'node',
4+
testRegex: '/src/.*\\.(test|spec)?\\.(ts|tsx)$',
5+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
6+
};

0 commit comments

Comments
 (0)