Created
December 31, 2020 12:59
-
-
Save andreasvirkus/412c32772aec4d596d17ca64289b19ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crypto from 'crypto' | |
const generateChecksum = str => | |
crypto | |
.createHash('sha256') | |
.update(str, 'utf8') | |
.digest('base64') | |
const script = | |
'if (localStorage.getItem("theme")) document.documentElement.dataset.theme = localStorage.getItem("theme")' | |
console.info(`sha256-${generateChecksum(script)}`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment