Skip to content

Commit

Permalink
feat: electron v6.x runtime support
Browse files Browse the repository at this point in the history
Testing using electron to ensure electron is a first-class citizen
runtime.
  • Loading branch information
panva committed Aug 13, 2019
1 parent 23138c1 commit 65ec619
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 36 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,11 @@ matrix:
- nvm i node
- npm i
script: npm test
- name: "Test Suite - Electron - 6.0.0"
language: node_js
node_js: stable
script: xvfb-run npx electron@6.0.0 ./test/electron
- name: "Test Suite - Electron - ^6.0.0"
language: node_js
node_js: stable
script: xvfb-run npx electron@6 ./test/electron
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ client.callback('https://client.example.com/callback', params, { nonce }) // =>
});
```

## Electron Support

Electron v6.x runtime is supported to the extent of the crypto engine BoringSSL feature parity with
standard Node.js OpenSSL.

## FAQ

#### Semver?
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ the following are valid values for `token_endpoint_auth_method`.
header as described in [RFC6749](https://tools.ietf.org/html/rfc6749#section-2.3.1)
- `client_secret_post` - client_id and client_secret is sent in the request body as described in
[RFC6749](https://tools.ietf.org/html/rfc6749#section-2.3.1)
- `client_secret_jwt` - using `client_secret` as a shared symmetrical secret a `client_assertion` is
- `client_secret_jwt` - using `client_secret` as a shared symmetric secret a `client_assertion` is
sent in the request body
- `private_key_jwt` - using the asymmetric keys provided via `jwks` a `client_assertion` is sent
in the request body
Expand Down
6 changes: 3 additions & 3 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1279,8 +1279,8 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base
'',
].join('.');
} else {
const symmetrical = alg.startsWith('HS');
if (symmetrical) {
const symmetric = alg.startsWith('HS');
if (symmetric) {
key = await this.joseSecret();
} else {
const keystore = instance(this).get('keystore');
Expand All @@ -1296,7 +1296,7 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base

signed = jose.JWS.sign(payload, key, {
...header,
kid: symmetrical ? undefined : key.kid,
kid: symmetric ? undefined : key.kid,
});
}

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
"client",
"connect",
"dynamic",
"electron",
"hybrid",
"identity",
"implicit",
"oauth",
"oauth2",
"oidc",
"openid",
"relying party",
"passport",
"relying party",
"strategy"
],
"homepage": "https://github.com/panva/node-openid-client",
Expand All @@ -36,7 +37,7 @@
"test": "mocha"
},
"dependencies": {
"@panva/jose": "^1.3.0",
"@panva/jose": "^1.6.1",
"base64url": "^3.0.1",
"got": "^9.6.0",
"lodash": "^4.17.13",
Expand Down
76 changes: 46 additions & 30 deletions test/client/client_instance.test.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions test/electron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable */

const { app } = require('electron');

const { Base } = require('mocha/lib/reporters');

const orig = Base.prototype.epilogue;

Base.prototype.epilogue = function epilogue() {
orig.call(this);
const { stats: { failures } } = this;

app.exit(failures ? 1 : 0);
}

require('../node_modules/.bin/mocha');

0 comments on commit 65ec619

Please sign in to comment.