Module: Baseh::Profile

Defined in:
lib/baseh/profile.rb

Overview

Profile validation and derived values, spec section 2.2. Validation runs once at construction, never per encode/decode.

Profiles are plain hashes with symbol keys:

profile_id:, body_alphabet:, body_length:, checksum_alphabet:,
checksum_length:, case_sensitive:, separator:, grouping:, aliases:,
permutation: { enabled: true, algorithm: "feistel-v1", key_id:,
             key_bytes:, rounds: } or { enabled: false },
profanity: { mode: "none" | "no-vowels" | "blocklist",
           words: [...], extra_words: [...] } (optional, spec 18)

Defined Under Namespace

Classes: Prepared

Constant Summary collapse

ASCII_ONLY =
/\A[\x20-\x7e]*\z/.freeze

Class Method Summary collapse

Class Method Details

.prepare(profile) ⇒ Object

Validates a profile hash and returns a Prepared instance. Raises BasehError with code INVALID_PROFILE on any violation.



265
266
267
# File 'lib/baseh/profile.rb', line 265

def self.prepare(profile)
  Prepared.new(profile)
end