cloud connection save

This commit is contained in:
SPRINX0\prochazka
2025-05-26 16:46:04 +02:00
parent cc930a3ff9
commit afde0a7423
5 changed files with 83 additions and 29 deletions

View File

@@ -271,7 +271,7 @@ async function callCloudApiPost(endpoint, body, signinHolder = null) {
async function getCloudFolderEncryptor(folid) {
const { encryptionKey } = await callCloudApiGet(`folder-key/${folid}`);
if (!encryptionKey) {
throw new Error('No encryption key');
throw new Error('No encryption key for folder: ' + folid);
}
return simpleEncryptor.createEncryptor(encryptionKey);
}
@@ -336,6 +336,11 @@ async function loadCachedCloudConnection(folid, cntid) {
return cloudConnectionCache[cacheKey];
}
function removeCloudCachedConnection(folid, cntid) {
const cacheKey = `${folid}|${cntid}`;
delete cloudConnectionCache[cacheKey];
}
module.exports = {
createDbGateIdentitySession,
startCloudTokenChecking,
@@ -349,4 +354,5 @@ module.exports = {
getCloudContent,
loadCachedCloudConnection,
putCloudContent,
removeCloudCachedConnection,
};