Skip to content

Instantly share code, notes, and snippets.

View Jordan-Hall's full-sized avatar
💭
Faced with tyranny by the big corporation, open source becomes the resistance.

Jordan Upton Jordan-Hall

💭
Faced with tyranny by the big corporation, open source becomes the resistance.
  • Mansfield woodhouse
View GitHub Profile
@Jordan-Hall
Jordan-Hall / vite.config.js
Created February 20, 2022 11:55
vite test angular?
import { defineConfig } from 'vite';
import { AngularPlugin } from '@nxext/angular/plugins/angular-vite-compiler';
export default defineConfig({
plugins: [
AngularPlugin(),
],
resolve: {
preserveSymlinks: true,
},
@Jordan-Hall
Jordan-Hall / jwt.ts
Created December 20, 2020 01:16
Alosaur Session JWT
import { AuthClaims, AuthenticationScheme, Identity } from "https://deno.land/x/alosaur@v0.26.0/src/security/authentication/core/mod.ts";
import { Content } from "https://deno.land/x/alosaur@v0.26.0/mod.ts";
import { SecurityContext } from "https://deno.land/x/alosaur@v0.26.0/src/security/context/security-context.ts";
import { verify as verifySignature } from "https://deno.land/x/djwt@v1.9/_signature.ts";
import { create, decode, getNumericDate } from "https://deno.land/x/djwt@v1.9/mod.ts";
import { Algorithm } from "https://deno.land/x/djwt@v1.9/_algorithm.ts";
import { DAYS_30 } from "../../../auth/environmental.ts";
export const IdentityKey = "__identity_jwt";
const AuthorizationHeader = "Authorization";
import { connect, Redis } from "https://deno.land/x/redis/mod.ts";
import { SessionStore } from "https://deno.land/x/alosaur@v0.26.0/src/security/session/src/store/store.interface.ts";
type StringKeyObject = { [key: string]: unknown };
export class RedisSession<T = StringKeyObject> implements SessionStore {
private redis?: Redis;
private allSid: string[] = [];
if (typeof globalThis.randomUUID !== 'function') {
globalThis.randomUUID = () => {
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
);
}
}
@Jordan-Hall
Jordan-Hall / decorator-options.d.ts
Last active December 28, 2021 22:46
Memoize Decorator
interface MemoizeDecoratorOptions {
type: Storage;
ttl: number;
}