Loading repository data…
Loading repository data…
OptionFlowStudio / repository
kagiforge-libraries This is a collection of open-source libraries created by OptionFlow and used on the website https://kagiforge.com These are unique libraries for encryption, QR code generation, and converting JSON into the Toon format to reduce token usage in LLMs. An NPM package will be available soon!
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
This repository contains three TypeScript utility libraries:
keyGenerator.ts: cryptographic/random key material generatorqrGenerator.ts: QR matrix + SVG generatortoonConverter.ts: JSON-like value encoder into a compact text format ("Toon")keyGenerator.tsGenerates:
algorithms: preset algorithm catalogBIT_OPTIONS, PIN_OPTIONS, PASSPHRASE_OPTIONS, RECOVERY_OPTIONS, PASSWORD_LENGTHSbuildInitialKeyBitsByAlg()supportsBitSelection(alg)generateKey(params)import { algorithms, generateKey } from './keyGenerator';
const jwtAlg = algorithms.find((a) => a.value === 'jwt-secret')!;
const jwtSecret = await generateKey({ algorithm: jwtAlg });
// => { kind: 'single', value: '...' }
const rsaAlg = algorithms.find((a) => a.value === 'rsa-pss')!;
const rsaPair = await generateKey({ algorithm: rsaAlg });
// => { kind: 'pair', pair: { publicKey: '-----BEGIN PUBLIC KEY-----...', privateKey: '...' } }
crypto.getRandomValues and crypto.subtle.kagi_key_.Math.random() internally.qrGenerator.tsBuilds QR module data from input text and renders it as an SVG string.
createQrModules(input, errorCorrectionLevel?)buildQrSvgString(modules, color)QrModules typeimport { createQrModules, buildQrSvgString } from './qrGenerator';
const modules = createQrModules('https://example.com', 'H');
const svg = buildQrSvgString(modules, '#0f172a');
// Write svg to file or inject in HTML
qrcode (import QRCode from 'qrcode').L | M | Q | H.rx/ry = 0.2) and fixed output size 256x256.toonConverter.tsEncodes unknown input into a deterministic text format:
true, 42, "text" when needed)[N]: a,b,c)key: value blocksencodeToon(input, opts?)opts:
sanitizeJs?: boolean (default false)indentSize?: number (default 2)import { encodeToon } from './toonConverter';
const input = {
team: 'platform',
flags: [true, false, true],
users: [
{ id: 1, name: 'Ada' },
{ id: 2, name: 'Lin' }
]
};
const out = encodeToon(input, { sanitizeJs: true, indentSize: 2 });
console.log(out);
sanitizeJs: false), non-JSON values throw.sanitizeJs: true):
undefined object fields are droppedundefined array items become nullnullbigint becomes stringDate becomes ISO string// Example index.ts
import { generateKey, algorithms } from './keyGenerator';
import { createQrModules, buildQrSvgString } from './qrGenerator';
import { encodeToon } from './toonConverter';
async function main() {
const key = await generateKey({
algorithm: algorithms.find((a) => a.value === 'api-key')!,
});
const qr = buildQrSvgString(
createQrModules(key.kind === 'single' ? key.value : key.pair.publicKey),
'#111827'
);
const debug = encodeToon({ generated: key, hasQr: Boolean(qr) }, { sanitizeJs: true });
console.log(debug);
}
main();