@xivdyetools/crypto
v1.1.0
Published
Shared cryptographic utilities for the xivdyetools ecosystem
Downloads
191
Maintainers
Readme
@xivdyetools/crypto
Shared cryptographic utilities for the xivdyetools ecosystem.
Installation
npm install @xivdyetools/cryptoUsage
import {
base64UrlEncode,
base64UrlDecode,
base64UrlEncodeBytes,
base64UrlDecodeBytes,
hexToBytes,
bytesToHex,
} from '@xivdyetools/crypto';
// Base64URL encoding (for JWT)
const encoded = base64UrlEncode('{"alg":"HS256"}');
const decoded = base64UrlDecode(encoded);
// Byte encoding
const bytes = base64UrlDecodeBytes(encoded);
const reencoded = base64UrlEncodeBytes(bytes);
// Hex encoding
const hex = bytesToHex(bytes);
const backToBytes = hexToBytes(hex);API
Base64URL (RFC 4648)
base64UrlEncode(str: string): string- Encode UTF-8 string to Base64URLbase64UrlDecode(str: string): string- Decode Base64URL to UTF-8 stringbase64UrlEncodeBytes(bytes: Uint8Array): string- Encode bytes to Base64URLbase64UrlDecodeBytes(str: string): Uint8Array- Decode Base64URL to bytes
Hexadecimal
hexToBytes(hex: string): Uint8Array- Convert hex string to bytesbytesToHex(bytes: Uint8Array): string- Convert bytes to hex string
Connect With Me
Flash Galatine | Midgardsormr (Aether)
🎮 FFXIV: Lodestone Character 📝 Blog: Project Galatine 💻 GitHub: @FlashGalatine 📺 Twitch: flashgalatine 🌐 BlueSky: projectgalatine.com ❤️ Patreon: ProjectGalatine ☕ Ko-Fi: flashgalatine 💬 Discord: Join Server
License
MIT © 2025-2026 Flash Galatine
