Skip to content

Commit c5a2857

Browse files
committed
Improvements that have been pending a while.
I never got around to pushing these improvements because I didn't finish making examples or unit tests, but it's been sitting long enough to justify pushing it.
1 parent 32a7e77 commit c5a2857

26 files changed

+1305
-348
lines changed

.gitignore

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

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# 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).
2+
This is an implementation of the SRP-6a protocol.
3+
4+
This library supports standard RFC2945 SRP-6a (needs validation,) SRPTools-compatible SRP, which is the same as RFC2945 but without the hash interleave, and [opencoff/go-srp](https://github.com/opencoff/go-srp), whose differences are quoted here, from the [opencoff/go-srp README](https://github.com/opencoff/go-srp#differences-from-srp-6a-and-rfc-5054).
35

46
> Differences from SRP-6a and RFC 5054
57
>
@@ -9,7 +11,7 @@ This is an implementation of the SRP-6a protocol with modifications to provide c
911
> - We hash the user passphrase p; this expands shorter passphrase into longer ones and extends the alphabet used in the passphrase.
1012
> - 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).
1113
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.
14+
Blake2b is not currently supported because it is not offered by WebCrypto; instead, you can choose between the overlapping supported hash functions between Go and WebCrypto.
1315

1416
Currently, only client functionality is implemented.
1517

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

examples/browser-esbuild/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Srp, Mode, Hash } from "js-srp";
2+
3+
console.log(new Srp(Mode.SRPTools, Hash.SHA1, 1024));

examples/browser-esbuild/package-lock.json

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "js-srp-browser-esbuild-example",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "esbuild --minify --bundle --platform=browser --outfile=dist/index.js index.js && tsc"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"js-srp": "file:../.."
13+
}
14+
}

examples/nodejs-cjs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules

examples/nodejs-cjs/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const { Srp, Mode, Hash } = require("js-srp");
2+
3+
console.log(new Srp(Mode.SRPTools, Hash.SHA1, 1024));

examples/nodejs-cjs/package-lock.json

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/nodejs-cjs/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "js-srp-nodejs-cjs-example",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "node index.js && tsc"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"js-srp": "file:../.."
13+
}
14+
}

0 commit comments

Comments
 (0)