???
This commit is contained in:
parent
50ff8d7a68
commit
83e70a4322
2 changed files with 3 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
FROM oven/bun:1 as base
|
FROM oven/bun as base
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
FROM base AS install
|
FROM base AS install
|
||||||
|
@ -19,5 +19,4 @@ COPY --from=prerelease /usr/src/app/build/garf-api .
|
||||||
|
|
||||||
USER bun
|
USER bun
|
||||||
EXPOSE 3000/tcp
|
EXPOSE 3000/tcp
|
||||||
RUN ls -lah
|
|
||||||
CMD [ "./garf-api" ]
|
CMD [ "./garf-api" ]
|
||||||
|
|
|
@ -14,7 +14,7 @@ function scryptAsync(password: string, length: number) {
|
||||||
|
|
||||||
export async function encrypt(data: string) {
|
export async function encrypt(data: string) {
|
||||||
const iv = randomBytes(16);
|
const iv = randomBytes(16);
|
||||||
const cipher = createCipheriv("aes-256-ccm", KEY, iv);
|
const cipher = createCipheriv("aes-256-cbc", KEY, iv);
|
||||||
|
|
||||||
let encrypted = cipher.update(data, "utf8", "base64url");
|
let encrypted = cipher.update(data, "utf8", "base64url");
|
||||||
encrypted += cipher.final("base64url");
|
encrypted += cipher.final("base64url");
|
||||||
|
@ -24,7 +24,7 @@ export async function encrypt(data: string) {
|
||||||
|
|
||||||
export async function decrypt(data: string, iv: string) {
|
export async function decrypt(data: string, iv: string) {
|
||||||
const ivBuf = Buffer.from(iv, "hex");
|
const ivBuf = Buffer.from(iv, "hex");
|
||||||
const decipher = createDecipheriv("aes-256-ccm", KEY, ivBuf);
|
const decipher = createDecipheriv("aes-256-cbc", KEY, ivBuf);
|
||||||
|
|
||||||
let decrypted = decipher.update(data, "base64url", "utf-8");
|
let decrypted = decipher.update(data, "base64url", "utf-8");
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue