Forgot to add name to cache set

This commit is contained in:
Jonathan Barrow
2022-09-24 19:08:48 -04:00
parent 8172c1cac9
commit 754f2fb85c
2 changed files with 5 additions and 5 deletions

View File

@@ -47,13 +47,13 @@ router.get('/service_token/@me', async (request, response) => {
let publicKey = cache.getServicePublicKey(service_name);
if (publicKey === null) {
publicKey = await fs.readFile(`${cryptoPath}/public.pem`);
await cache.setServicePublicKey(publicKey);
await cache.setServicePublicKey(service_name, publicKey);
}
let secretKey = cache.getServiceSecretKey(service_name);
if (secretKey === null) {
secretKey = await fs.readFile(`${cryptoPath}/secret.key`);
await cache.setServiceSecretKey(secretKey);
await cache.setServiceSecretKey(service_name, secretKey);
}
const cryptoOptions = {

View File

@@ -134,7 +134,7 @@ async function decryptToken(token) {
if (aesKey === null) {
const fileBuffer = await fs.readFile(`${cryptoPath}/aes.key`, { encoding: 'utf8' });
aesKey = Buffer.from(fileBuffer, 'hex');
await cache.setServiceAESKey(aesKey);
await cache.setServiceAESKey('account', aesKey);
}
const iv = Buffer.alloc(16);
@@ -150,13 +150,13 @@ async function decryptToken(token) {
let privateKeyBytes = cache.getServicePrivateKey('account');
if (privateKeyBytes === null) {
privateKeyBytes = await fs.readFile(`${cryptoPath}/private.pem`);
await cache.setServicePrivateKey(privateKeyBytes);
await cache.setServicePrivateKey('account', privateKeyBytes);
}
let secretKey = cache.getServiceSecretKey('account');
if (secretKey === null) {
secretKey = await fs.readFile(`${cryptoPath}/secret.key`);
await cache.setServiceSecretKey(secretKey);
await cache.setServiceSecretKey('account', secretKey);
}
const privateKey = new NodeRSA(privateKeyBytes, 'pkcs1-private-pem', {