This file contains 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 { auth } from "./src/js/nhost.js"; | |
import { initClient, getClient } from "./src/js/graphqlClient.js"; | |
export default { | |
auth: { | |
checkRole: (requiredRole) => { | |
//Used by pageql:authRole directive | |
//Return false if user's role fails to hit specifications | |
//Returning false hides the component |
This file contains 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 fetch from 'cross-fetch' | |
import jwtDecode from 'jwt-decode' | |
import moment from 'moment' | |
import { NextPageContext } from 'next' | |
import { destroyCookie, parseCookies, setCookie } from 'nookies' | |
export class AuthClient { | |
baseUrl = 'https://backend-[whatev].nhost.app' | |
stateChangeCallbacks: (() => void)[] = [] | |
context?: NextPageContext |
This file contains 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
<?php | |
// Because I don’t use PHP often enough to remember it instantly | |
$opts = array( | |
'http'=>array( | |
'method'=>"GET", | |
'header'=>"Accept: application/json" | |
) | |
); | |
$context = stream_context_create($opts); |
This file contains 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
#!/usr/bin/env python | |
import base64 | |
from Crypto import Random | |
from Crypto.Cipher import AES | |
BS = 16 | |
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS) | |
unpad = lambda s : s[0:-ord(s[-1])] |