These libraries are experimental. APIs may change without notice. Generated from source with koruc 0.1.7 on 11/4/2026.

Rails

@korulang/rails@0.0.1

ActiveSupport-compatible message signing for Koru — SignedId, Turbo stream names, signed cookies, masked CSRF tokens

rails/index.kz · 0 tors

rails — ActiveSupport-compatible message signing. · 26 more lines
rails — ActiveSupport-compatible message signing. Implements the wire protocols a Rails twin speaks, parameterized over the application's purposes and names: - id.sign / id.verify: ActiveRecord::SignedId — envelope {"_rails":{"data":N,"pur":P[,"exp"→ordering per upstream]}} as urlsafe-base64 unpadded, HMAC-SHA256 hex sig, joined "--". Key PBKDF2-HMAC-SHA256(SECRET_KEY_BASE, "active_record/signed_id", 1000, 64). - stream.sign / stream.verify: Turbo::StreamsChannel signed_stream_name / verified_stream_name — the name JSON-dumped, strict-base64'd (no metadata envelope), signed HMAC-SHA256 with the key derived under "turbo/signed_stream_verifier_key". - cookie.*: ActionDispatch::Cookies legacy envelope (NullSerializer) — {"_rails":{"message":<strict-b64 of JSON-dumped value>, "exp":<iso8601(3) utc>|null,"pur":"cookie.<name>"}} strict-b64'd, "--"-joined to a HEX HMAC-SHA1 digest (signed_cookie_digest unset — SHA1 — even though the key is PBKDF2-SHA256-derived, salt "signed cookie", 1000 iters, 64B). Rack-escaped on the wire. - csrf.*: Rails's masked-authenticity-token discipline — one-time-pad XOR over a 32-byte real secret; the binding of `real` (session, derived key, …) is the caller's. SECRET_KEY_BASE comes from the environment like the reference; unset renders an empty signature — a visibly broken URL, never a silent substitute.