Skip to content
Snippets Groups Projects
Commit 5c081211 authored by Markin Igor's avatar Markin Igor
Browse files

Fix bug with creation of device hash.

parent 8d4674be
No related branches found
No related tags found
1 merge request!14138 information for devices clients
......@@ -4,8 +4,9 @@ export const createDeviceHash = async (publicKey) => {
try {
const stringToEncode = publicKey + navigator.userAgent;
const crypto = getCrypto();
const buffer = new window.TextEncoder("utf-8").encode(stringToEncode);
return window.btoa(await crypto.digest({ name: "SHA-1" }, buffer));
const buffer = new window.TextEncoder().encode(stringToEncode);
const hash = await crypto.digest({ name: "SHA-1" }, buffer);
return window.btoa(String.fromCharCode(...new Uint8Array(hash)));
} catch (error) {
console.warn(error); // eslint-disable-line no-console
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment