fro.profesional
fro.profesional
DDeno
Created by Tal Mikey on 7/27/2024 in #help
Deno express typescript is not working
There seems to be a version mist match from express and types?
7 replies
DDeno
Created by Sheik on 7/14/2024 in #help
Running Angular SSR on Deno Deploy
If inside the task u are using node to run the file then is not deno right?
7 replies
DDeno
Created by Sheik on 7/14/2024 in #help
Running Angular SSR on Deno Deploy
Then why do u mean by “when I run it locally with deno” U are using node…
7 replies
DDeno
Created by Sheik on 7/14/2024 in #help
Running Angular SSR on Deno Deploy
What does the task do?
7 replies
DDeno
Created by All in. 🥥🌴 on 6/20/2024 in #help
Why does Deno Deploy give you two urls
One is the url of the deployment and the other is latest one after each new deployment
3 replies
DDeno
Created by rzh9b on 6/17/2024 in #help
onClick not staying with preact-render-to-string?
Maybe that can help
9 replies
DDeno
Created by rzh9b on 6/17/2024 in #help
onClick not staying with preact-render-to-string?
9 replies
DDeno
Created by rzh9b on 6/17/2024 in #help
onClick not staying with preact-render-to-string?
But I’m not sure how to do it sorry 😞
9 replies
DDeno
Created by rzh9b on 6/17/2024 in #help
onClick not staying with preact-render-to-string?
Or use fresh which already does that
9 replies
DDeno
Created by rzh9b on 6/17/2024 in #help
onClick not staying with preact-render-to-string?
Hydrate the comoponents that u want on client
9 replies
DDeno
Created by rzh9b on 6/17/2024 in #help
onClick not staying with preact-render-to-string?
You cannot serialize functions with render to string
9 replies
DDeno
Created by MrNKV on 6/3/2024 in #help
Issues with redirects and partials.
What u mean bu redirect? U mean when u actually want to go to a href without f-client-nav?
7 replies
DDeno
Created by Sh (@cannnibaldev) on 3/21/2024 in #help
Help with deployment
Did u connect ur project with deno deploy?
4 replies
DDeno
Created by AwsmBuff on 3/7/2024 in #help
TailwindCSS: Class-Strings build with variables
If you are using fresh
12 replies
DDeno
Created by AwsmBuff on 3/7/2024 in #help
TailwindCSS: Class-Strings build with variables
You can still use twind
12 replies
DDeno
Created by AwsmBuff on 3/7/2024 in #help
TailwindCSS: Class-Strings build with variables
12 replies
DDeno
Created by AwsmBuff on 3/7/2024 in #help
TailwindCSS: Class-Strings build with variables
12 replies
DDeno
Created by AwsmBuff on 3/7/2024 in #help
TailwindCSS: Class-Strings build with variables
12 replies
DDeno
Created by AwsmBuff on 3/7/2024 in #help
TailwindCSS: Class-Strings build with variables
You’ll need to define the full color in the variable or add the list of classes to the tailwind config to always be added
12 replies
DDeno
Created by fro.profesional on 3/6/2024 in #help
How to encrypt and decrypt files from S3 without loading the hole content into memory?
// Encrypts data using AES-GCM
async function encryptData(data: string, key: CryptoKey) {
const encoder = new TextEncoder();
const iv = crypto.getRandomValues(new Uint8Array(12)); // Initialization Vector
const encrypted = await crypto.subtle.encrypt(
{
name: "AES-GCM",
iv: iv,
},
key,
encoder.encode(data),
);

return { encrypted, iv };
}

// Decrypts data using AES-GCM
async function decryptData(
encrypted: ArrayBuffer,
iv: Uint8Array,
key: CryptoKey,
) {
const decrypted = await crypto.subtle.decrypt(
{
name: "AES-GCM",
iv: iv,
},
key,
encrypted,
);

const decoder = new TextDecoder();
return decoder.decode(decrypted);
}

async function generateKeyString(): Promise<string> {
try {
const key = await crypto.subtle.generateKey(
{
name: "AES-GCM",
length: 256,
},
true,
["encrypt", "decrypt"],
);

const exportedKey = await crypto.subtle.exportKey("jwk", key);
return JSON.stringify(exportedKey);
} catch (error) {
console.error("Error generating key:", error);
return "";
}
}

async function generateKeyFromString(
keyString: string,
): Promise<CryptoKey> {
const keyData = JSON.parse(keyString);
const key = await crypto.subtle.importKey(
"jwk",
keyData,
{ name: "AES-GCM", length: 256 },
true,
["encrypt", "decrypt"],
);
return key;
}

// Example usage
async function example() {
const keyString = await generateKeyString();
const cryptoKey = await generateKeyFromString(keyString)!;

const stringToEncrypt = "Hello, world!";

const {
// Save the encrypted data and the IV to DB
encrypted,
iv,
} = await encryptData(stringToEncrypt, cryptoKey);

const decryptedMessage = await decryptData(encrypted, iv, cryptoKey);

console.log("Original:", stringToEncrypt);
console.log("Encrypted:", encrypted);
console.log("Decrypted:", decryptedMessage);
}

example();
// Encrypts data using AES-GCM
async function encryptData(data: string, key: CryptoKey) {
const encoder = new TextEncoder();
const iv = crypto.getRandomValues(new Uint8Array(12)); // Initialization Vector
const encrypted = await crypto.subtle.encrypt(
{
name: "AES-GCM",
iv: iv,
},
key,
encoder.encode(data),
);

return { encrypted, iv };
}

// Decrypts data using AES-GCM
async function decryptData(
encrypted: ArrayBuffer,
iv: Uint8Array,
key: CryptoKey,
) {
const decrypted = await crypto.subtle.decrypt(
{
name: "AES-GCM",
iv: iv,
},
key,
encrypted,
);

const decoder = new TextDecoder();
return decoder.decode(decrypted);
}

async function generateKeyString(): Promise<string> {
try {
const key = await crypto.subtle.generateKey(
{
name: "AES-GCM",
length: 256,
},
true,
["encrypt", "decrypt"],
);

const exportedKey = await crypto.subtle.exportKey("jwk", key);
return JSON.stringify(exportedKey);
} catch (error) {
console.error("Error generating key:", error);
return "";
}
}

async function generateKeyFromString(
keyString: string,
): Promise<CryptoKey> {
const keyData = JSON.parse(keyString);
const key = await crypto.subtle.importKey(
"jwk",
keyData,
{ name: "AES-GCM", length: 256 },
true,
["encrypt", "decrypt"],
);
return key;
}

// Example usage
async function example() {
const keyString = await generateKeyString();
const cryptoKey = await generateKeyFromString(keyString)!;

const stringToEncrypt = "Hello, world!";

const {
// Save the encrypted data and the IV to DB
encrypted,
iv,
} = await encryptData(stringToEncrypt, cryptoKey);

const decryptedMessage = await decryptData(encrypted, iv, cryptoKey);

console.log("Original:", stringToEncrypt);
console.log("Encrypted:", encrypted);
console.log("Decrypted:", decryptedMessage);
}

example();
4 replies