Skip to content

Commit 32a7e77

Browse files
committed
Initial commit.
0 parents  commit 32a7e77

File tree

9 files changed

+764
-0
lines changed

9 files changed

+764
-0
lines changed

.github/workflows/nodejs.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Node.JS
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
name: Run Build
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [18.x]
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v2
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
cache: 'npm'
23+
- run: npm ci
24+
- run: npm run build

.github/workflows/publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: NPM.JS Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
strategy:
15+
matrix:
16+
node-version: [18.x]
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@main
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v1
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
registry-url: 'https://registry.npmjs.org'
25+
- name: Install
26+
run: npm ci
27+
- name: Build
28+
run: npm run build
29+
- name: Publish Package
30+
run: npm publish --access public
31+
env:
32+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/node_modules
2+
/index.js
3+
/index.js.map

LICENSE

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ISC License
2+
3+
Copyright © 2022, John Chadwick <john@jchw.io>
4+
5+
Permission to use, copy, modify, and/or distribute this software for any purpose
6+
with or without fee is hereby granted, provided that the above copyright notice
7+
and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
11+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
13+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
14+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
15+
THIS SOFTWARE.

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# js-srp
2+
This is an implementation of the SRP-6a protocol with modifications to provide compatibility with [opencoff/go-srp](https://github.com/opencoff/go-srp). These differences are quoted here, from the [opencoff/go-srp README](https://github.com/opencoff/go-srp#differences-from-srp-6a-and-rfc-5054).
3+
4+
> Differences from SRP-6a and RFC 5054
5+
>
6+
> We differ from the SRP-6a spec and RFC 5054 in a couple of key ways:
7+
>
8+
> - We hash the identity I; this provides some (minimal) protection against dictionary attacks on the username.
9+
> - We hash the user passphrase p; this expands shorter passphrase into longer ones and extends the alphabet used in the passphrase.
10+
> - We differ from RFC 5054 in our choice of hash function; we use Blake-2b. SHA-1 is getting long in the tooth, Blake2b is the current state-of-the art. Equivalently, one may use SHA3 (see below for using a user supplied hash function).
11+
12+
The only difference is that Blake2b is not supported because it is not offered by WebCrypto; instead, you can choose between the overlapping supported hash functions between opencoff/go-srp and WebCrypto.
13+
14+
Currently, only client functionality is implemented.
15+
16+
This library does not have any external runtime dependencies. It requires a JavaScript runtime that supports w3c Typed Arrays, BigInt, and WebCrypto, which includes the majority of web browsers and JavaScript engines.

0 commit comments

Comments
 (0)