fix: fix archive body encryption trying to encode/decode the archive as JSON
This commit is contained in:
parent
ba4c54c41b
commit
ea95f3af18
1 changed files with 3 additions and 3 deletions
|
@ -11,8 +11,8 @@ import {
|
||||||
guildToTemplateSafeGuild,
|
guildToTemplateSafeGuild,
|
||||||
userToTemplateSafeUser,
|
userToTemplateSafeUser,
|
||||||
} from "../utils/templateSafeObjects";
|
} from "../utils/templateSafeObjects";
|
||||||
import { decryptJson, encryptJson } from "../utils/cryptHelpers";
|
|
||||||
import { SavedMessage } from "./entities/SavedMessage";
|
import { SavedMessage } from "./entities/SavedMessage";
|
||||||
|
import { decrypt, encrypt } from "../utils/crypt";
|
||||||
|
|
||||||
const DEFAULT_EXPIRY_DAYS = 30;
|
const DEFAULT_EXPIRY_DAYS = 30;
|
||||||
|
|
||||||
|
@ -35,13 +35,13 @@ export class GuildArchives extends BaseGuildRepository<ArchiveEntry> {
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.body = await decryptJson(entity.body as unknown as string);
|
entity.body = await decrypt(entity.body);
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async _processEntityToDB(entity: Partial<ArchiveEntry>) {
|
protected async _processEntityToDB(entity: Partial<ArchiveEntry>) {
|
||||||
if (entity.body) {
|
if (entity.body) {
|
||||||
entity.body = (await encryptJson(entity.body)) as any;
|
entity.body = await encrypt(entity.body);
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue