Checkpoint adding crypto metadata

This commit is contained in:
Tuan Dang
2023-05-04 20:35:06 +03:00
parent c766686670
commit 5eeda6272c
9 changed files with 40 additions and 37 deletions
-6
View File
@@ -13,7 +13,6 @@ export interface IBackupPrivateKey {
tag: string;
salt: string;
algorithm: string;
keySize: number;
keyEncoding: 'base64' | 'utf8';
verifier: string;
}
@@ -45,11 +44,6 @@ const backupPrivateKeySchema = new Schema<IBackupPrivateKey>(
enum: [ALGORITHM_AES_256_GCM],
required: true
},
keySize: { // the size of the key used in the algorithm
type: Number,
enum: [256],
required: true
},
keyEncoding: {
type: String,
enum: [
-6
View File
@@ -16,7 +16,6 @@ export interface IBot {
iv: string;
tag: string;
algorithm: 'aes-256-gcm';
keySize: 256;
keyEncoding: 'base64' | 'utf8';
}
@@ -60,11 +59,6 @@ const botSchema = new Schema<IBot>(
enum: [ALGORITHM_AES_256_GCM],
required: true
},
keySize: { // the size of the key used in the algorithm
type: Number,
enum: [256],
required: true
},
keyEncoding: {
type: String,
enum: [
+1 -7
View File
@@ -35,8 +35,7 @@ export interface IIntegrationAuth extends Document {
accessIV?: string;
accessTag?: string;
algorithm?: 'aes-256-gcm';
keySize?: 256;
keyEncoding: 'utf8' | 'base64';
keyEncoding?: 'utf8' | 'base64';
accessExpiresAt?: Date;
}
@@ -120,11 +119,6 @@ const integrationAuthSchema = new Schema<IIntegrationAuth>(
enum: [ALGORITHM_AES_256_GCM],
required: true
},
keySize: { // the size of the key used in the algorithm
type: Number,
enum: [256],
required: true
},
keyEncoding: {
type: String,
enum: [
+18
View File
@@ -2,6 +2,9 @@ import { Schema, model, Types } from 'mongoose';
import {
SECRET_SHARED,
SECRET_PERSONAL,
ALGORITHM_AES_256_GCM,
ENCODING_SCHEME_UTF8,
ENCODING_SCHEME_BASE64
} from '../variables';
import { ROOT_FOLDER_PATH } from '../utils/folder';
@@ -25,6 +28,8 @@ export interface ISecret {
secretCommentIV?: string;
secretCommentTag?: string;
secretCommentHash?: string;
algorithm: 'aes-256-gcm';
keyEncoding: 'utf8' | 'base64';
tags?: string[];
path?: string;
folder?: Types.ObjectId;
@@ -111,6 +116,19 @@ const secretSchema = new Schema<ISecret>(
type: String,
required: false
},
algorithm: { // the encryption algorithm used
type: String,
enum: [ALGORITHM_AES_256_GCM],
required: true
},
keyEncoding: {
type: String,
enum: [
ENCODING_SCHEME_UTF8,
ENCODING_SCHEME_BASE64
],
required: true
},
// the full path to the secret in relation to folders
path: {
type: String,
@@ -12,7 +12,6 @@ export interface ISecretBlindIndexData extends Document {
saltIV: string;
saltTag: string;
algorithm: 'aes-256-gcm';
keySize: 256;
keyEncoding: 'base64' | 'utf8'
}
@@ -40,11 +39,6 @@ const secretBlindIndexDataSchema = new Schema<ISecretBlindIndexData>(
enum: [ALGORITHM_AES_256_GCM],
required: true
},
keySize: {
type: Number,
enum: [256],
required: true
},
keyEncoding: {
type: String,
enum: [