feat(gaurds): use better smartguards to verify action authorization
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import * as paths from './paths.js';
|
||||
import { logger } from './cloudly.logging.js';
|
||||
import { logger } from './logger.js';
|
||||
import type { Cloudly } from './classes.cloudly.js';
|
||||
|
||||
/**
|
||||
@@ -56,19 +56,8 @@ export class CloudlyConfig {
|
||||
],
|
||||
});
|
||||
|
||||
this.smartjwtInstance = new plugins.smartjwt.SmartJwt();
|
||||
const kvStore = await this.appData.getKvStore();
|
||||
|
||||
const existingJwtKeys: plugins.tsclass.network.IJwtKeypair = await kvStore.readKey('jwtKeys');
|
||||
|
||||
if (!existingJwtKeys) {
|
||||
await this.smartjwtInstance.createNewKeyPair();
|
||||
const newJwtKeys = this.smartjwtInstance.getKeyPairAsJson();
|
||||
await kvStore.writeKey('jwtKeys', newJwtKeys);
|
||||
} else {
|
||||
this.smartjwtInstance.setKeyPairAsJson(existingJwtKeys);
|
||||
}
|
||||
|
||||
this.data = await kvStore.readAll();
|
||||
const missingKeys = await this.appData.logMissingKeys();
|
||||
if (missingKeys.length > 0) {
|
||||
|
Reference in New Issue
Block a user