feat(shared): Initial implementation of Oauth flow
This commit is contained in:
parent
70b8fdd703
commit
01ef6c9896
24 changed files with 1077 additions and 172 deletions
|
@ -445,3 +445,14 @@ export const horFlexClassesNoSm =
|
|||
* A method that check that a var is not empty
|
||||
*/
|
||||
export const notEmpty = (thing) => `${thing}`.length > 0
|
||||
|
||||
/*
|
||||
* Generates a random string (used in Oauth flow)
|
||||
*/
|
||||
const dec2hex = (dec) => dec.toString(16).padStart(2, '0')
|
||||
export const randomString = (len = 42) => {
|
||||
if (typeof window === 'undefined') return '' // Not used in SSR
|
||||
const arr = new Uint8Array(len / 2)
|
||||
window.crypto.getRandomValues(arr)
|
||||
return Array.from(arr, dec2hex).join('')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue