UnicodeSecurity.Result (UnicodeSecurity v0.1.0)

Copy Markdown View Source

Analysis facts and policy findings for the original input.

policy is the effective preset. Uncomputed facts remain nil for partial results, while valid_input? distinguishes malformed, oversized, or invalid domain input from fully analyzed input. domain holds original-label and IDNA facts for explicit domain analysis and is nil for other types.

input is unchanged, including nonbinary items in an audit. scripts lists observed ordinary Script values; mixed_script? uses augmented Script_Extensions. mixed_number? counts decimal zero representatives. restriction_level is the raw standards level even when profile punctuation changes the policy decision. skeleton is a comparison key, never a replacement value. unicode_version versions these pinned-data facts.

Nonbinary audit items, malformed UTF-8 and input over 4,096 original bytes have valid_input?: false and nil scripts, mixed flags, restriction level and skeleton. Empty input has valid_input?: true, scripts: [], false mixed flags, restriction_level: :ascii, and skeleton: "", plus a high empty-input reason for generic types. Domain input must pass IDNA and hostname validity before whole-name facts or a key are available. Policy danger alone does not make valid_input? false.

The highest reason severity determines verdict. Field meanings and the documented atom values are public contracts.

Summary

Types

input_type()

@type input_type() :: :username | :tenant_slug | :organization_name | :domain

preset()

@type preset() :: :strict | :default | :permissive

restriction_level()

@type restriction_level() ::
  :ascii
  | :single_script_restrictive
  | :highly_restrictive
  | :moderately_restrictive
  | :minimally_restrictive
  | :unrestricted

t()

@type t() :: %UnicodeSecurity.Result{
  domain: UnicodeSecurity.DomainResult.t() | nil,
  input: term(),
  mixed_number?: boolean() | nil,
  mixed_script?: boolean() | nil,
  policy: preset() | nil,
  reasons: [UnicodeSecurity.Reason.t()],
  restriction_level: restriction_level() | nil,
  scripts: [atom()] | nil,
  skeleton: binary() | nil,
  type: input_type() | nil,
  unicode_version: binary() | nil,
  valid_input?: boolean(),
  verdict: verdict() | nil
}

verdict()

@type verdict() :: :safe | :suspicious | :dangerous