Get public/private key from env
This commit is contained in:
parent
827128aca3
commit
4fdf5e9674
@ -1,2 +1,4 @@
|
|||||||
APP_URL=http://localhost:4000
|
APP_URL=http://localhost:4000
|
||||||
ENTITY_ID=https://saml.example.com/entityid
|
ENTITY_ID=https://saml.example.com/entityid
|
||||||
|
PUBLIC_KEY= # Base64 encoded value of public key `cat public.crt | base64`
|
||||||
|
PRIVATE_KEY=# Base64 encoded value of private key `cat key.pem | base64`
|
||||||
@ -1,13 +1,11 @@
|
|||||||
import { promises as fs } from 'fs';
|
|
||||||
import { asn1, pki, util } from 'node-forge';
|
import { asn1, pki, util } from 'node-forge';
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
const fetchPublicKey = async (): Promise<string> => {
|
const fetchPublicKey = (): string => {
|
||||||
return await fs.readFile(path.join('data', 'public.crt'), 'ascii');
|
return Buffer.from(process.env.PUBLIC_KEY!, 'base64').toString('ascii');
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchPrivateKey = async (): Promise<string> => {
|
const fetchPrivateKey = (): string => {
|
||||||
return await fs.readFile(path.join('data', 'key.pem'), 'ascii');
|
return Buffer.from(process.env.PRIVATE_KEY!, 'base64').toString('ascii');
|
||||||
};
|
};
|
||||||
|
|
||||||
function getPublicKeyPemFromCertificate(x509Certificate: string) {
|
function getPublicKeyPemFromCertificate(x509Certificate: string) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user