implement cryptography for FileTransfer

This commit is contained in:
marlon-erler
2024-07-27 17:41:54 +02:00
parent 95b74a5012
commit 8a56c0aab2
4 changed files with 56 additions and 8 deletions
+7
View File
@@ -4,6 +4,13 @@ export interface Stringifiable {
toString(): string;
}
// crypto
export function generateRandomToken(length: number): string {
const array = new Uint8Array(length);
crypto.getRandomValues(array);
return array.join("");
}
// date
export function createTimestamp(): string {
return new Date().toISOString();