Skip to content

Instantly share code, notes, and snippets.

View timkinsman's full-sized avatar
🤡
Clownin' around

Tim Kinsman timkinsman

🤡
Clownin' around
View GitHub Profile
@paulswail
paulswail / api-client.ts
Last active May 1, 2024 08:18
AppSync GraphQL CodeGenerator Config with Lambda resolver types, Nodejs operation functions and React hooks
// frontend lib module which is injected into the codegen'd hooks
import { getAuthToken } from './auth'
export const API_URL = process.env.REACT_APP_API_URL!
/**
* Custom fetcher used by codegen'd hooks to first load auth token, then make the fetch request.
*/
export const fetcher = <TData, TVariables>(query: string, variables?: TVariables) => {
return async (): Promise<TData> => {
@junderw
junderw / aesWebCrypto.js
Created March 26, 2019 02:10
Using web crypto API for AES-GCM encryption and decryption.
async function aesEncrypt(data, password, difficulty = 10) {
const hashKey = await grindKey(password, difficulty)
const iv = await getIv(password, data)
const key = await window.crypto.subtle.importKey(
'raw',
hashKey, {
name: 'AES-GCM',
},
false,