ly
ly
Explore posts from servers
DTDrizzle Team
Created by ly on 10/18/2024 in #help
could not determine data type of parameter $2
export function duration(duration: string) {
return sql`now() + interval '${duration}'`;
}
export function duration(duration: string) {
return sql`now() + interval '${duration}'`;
}
Whats wrong?
4 replies
DDeno
Created by ly on 8/17/2023 in #help
bad resource id with node:crypto
function test() {
const key = randomBytes(32);
const iv = randomBytes(16);
const cipher = createCipheriv("aes-256-cbc", key, iv);
const decipher = createDecipheriv("aes-256-cbc", key, iv);
const data = "Hello World";
const encrypted =
cipher.update(data, "utf8", "base64") + cipher.final("base64");
const decrypted =
decipher.update(encrypted, "base64", "utf8") + decipher.final("utf8");
console.dir({ data, encrypted, decrypted });
}

test();
function test() {
const key = randomBytes(32);
const iv = randomBytes(16);
const cipher = createCipheriv("aes-256-cbc", key, iv);
const decipher = createDecipheriv("aes-256-cbc", key, iv);
const data = "Hello World";
const encrypted =
cipher.update(data, "utf8", "base64") + cipher.final("base64");
const decrypted =
decipher.update(encrypted, "base64", "utf8") + decipher.final("utf8");
console.dir({ data, encrypted, decrypted });
}

test();
error: Uncaught BadResource: Bad resource ID
cipher.update(data, "utf8", "base64") + cipher.final("base64");
^
at Cipheriv.final (ext:deno_node/internal/crypto/cipher.ts:35:13)
error: Uncaught BadResource: Bad resource ID
cipher.update(data, "utf8", "base64") + cipher.final("base64");
^
at Cipheriv.final (ext:deno_node/internal/crypto/cipher.ts:35:13)
10 replies