Skip to content

Instantly share code, notes, and snippets.

View divarvel's full-sized avatar

Clément Delafargue divarvel

View GitHub Profile
{
"name": "Iris Rev. 7",
"vendorProductId": 3406852694,
"macros": ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
"layers": [
[
"KC_MUTE",
"KC_1",
"KC_2",
"KC_3",
theme = "tokyonight_storm"
[editor]
rulers = [80,120]
auto-format = true
whitespace.render = "all"
file-picker.hidden = false
soft-wrap.enable = true
soft-wrap.wrap-at-text-width = true

Rust like a champ

  • leverage the type system
  • move constraints upstream
  • parse don't validate
  • make invalid states unrepresentable
  • type-driven dev
  • hexagonal architecture of sorts
  • DTOs / DAOs
@divarvel
divarvel / biscuit-datalog.kak
Created April 6, 2023 07:55
Kakoune support for biscuit datalog
# http://https://datalog-biscuit-lang.org
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# Detection
# ‾‾‾‾‾‾‾‾‾
hook global BufCreate .*\.biscuit-datalog %{
set-option buffer filetype biscuitdl
}

+++ title = "Biscuit 3.0" description = "Version 3.0.0 of the biscuit reference implementation has been released" date = 2023-03-29T00:09:00+02:00 draft = false template = "blog/page.html"

[taxonomies] authors = ["clementd"]

import {Biscuit, Authorizer} from '@biscuit-auth/biscuit-wasm';
export function middleware(pubkey) {
return function(mkAuthorizer) {
return function(req, res, next) {
if(req.query.token) {
let parsed;
try {
let authorizer;
if(typeof mkAuthorizer === "function") {
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TypeFamilies#-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE NoImplicitPrelude #-}
module MyLib (main) where
import Relude
import Servant hiding (throwError)
❯ biscuit keypair
Generating a new random keypair
Private key: 53a4d7e7c10b186135b43fe231fa5f91923571a9619654091a23a5ae09d45d08
Public key: d0def12aeaaccd02cdfbab78f41e833085606e4dde78614a7e4bc87bc64a6126
❯ biscuit keypair --from-private-key 53a4d7e7c10b186135b43fe231fa5f91923571a9619654091a23a5ae09d45d08
Generating a keypair for the provided private key
Private key: 53a4d7e7c10b186135b43fe231fa5f91923571a9619654091a23a5ae09d45d08
Public key: d0def12aeaaccd02cdfbab78f41e833085606e4dde78614a7e4bc87bc64a6126
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
module Biscuit
( authHandler
, RequireBiscuit
, checkBiscuit
, genBiscuitCtx
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
module Inline where
import Data.ByteString (ByteString, copy, packCStringLen)
import Foreign.Marshal.Alloc
import qualified Language.C.Inline as C
C.context (C.baseCtx <> C.bsCtx)