mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
e7fba40fad
Added a boilerplate from [this original repository](https://github.com/platyplus/authentication-server) based on the discussions in [this issue](https://github.com/hasura/graphql-engine/issues/1420) and [this issue](https://github.com/hasura/graphql-engine/issues/1446). [skip ci]
15 lines
498 B
JavaScript
15 lines
498 B
JavaScript
var fs = require('fs')
|
||
var fnv = require('fnv-plus')
|
||
|
||
// TODO: why does rsaPemToJwk work with a file but not with a variable?
|
||
exports.key = (
|
||
process.env.AUTH_PRIVATE_KEY || fs.readFileSync('private.pem').toString()
|
||
).replace(/\\n/g, '\n')
|
||
|
||
exports.publicKey = (
|
||
process.env.AUTH_PUBLIC_KEY || fs.readFileSync('public.pem').toString()
|
||
).replace(/\\n/g, '\n')
|
||
|
||
// Key Identifier – Acts as an ‘alias’ for the key
|
||
exports.kid = process.env.AUTH_KEY_ID || fnv.hash(this.publicKey, 128).hex()
|