From 59ea100c08ce376baeb5c416d1b0f54fd0576864 Mon Sep 17 00:00:00 2001 From: Kevin F Date: Tue, 22 Nov 2022 03:42:20 +0000 Subject: [PATCH] Added strong user ID generation that works in tor browser --- index.html | 2 +- main.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 822890f..e6ebcc9 100644 --- a/index.html +++ b/index.html @@ -100,7 +100,7 @@ __ __ _____ __ __ _____ - +

diff --git a/main.js b/main.js index 84af8a1..edb11f9 100644 --- a/main.js +++ b/main.js @@ -3,7 +3,14 @@ const { createApp } = Vue let app = createApp({ computed: { - crypto: () => window.crypto, + randomID: () => { + let buf2hex = function(buffer) { // buffer is an ArrayBuffer + return [...new Uint8Array(buffer)] + .map(x => x.toString(16).padStart(2, '0')) + .join(''); + } + return buf2hex(window.crypto.getRandomValues(new Uint8Array(25))) + }, onLine: () => window.navigator.onLine }, data() {