Make connections react on changes of users; this works wonderfully

This commit is contained in:
Philipp Heckel 2022-03-03 20:07:35 -05:00
parent 08846e4cc2
commit 695e029147
4 changed files with 49 additions and 31 deletions

View file

@ -90,6 +90,12 @@ export const encodeBase64Url = (s) => {
.replaceAll('=', '');
}
// https://jameshfisher.com/2017/10/30/web-cryptography-api-hello-world/
export const sha256 = async (s) => {
const buf = await crypto.subtle.digest("SHA-256", new TextEncoder("utf-8").encode(s));
return Array.prototype.map.call(new Uint8Array(buf), x=>(('00'+x.toString(16)).slice(-2))).join('');
}
export const formatShortDateTime = (timestamp) => {
return new Intl.DateTimeFormat('default', {dateStyle: 'short', timeStyle: 'short'})
.format(new Date(timestamp * 1000));