UnicodeSecurity.Comparison (UnicodeSecurity v0.1.0)

Copy Markdown View Source

Facts about two original identifiers under the pinned Unicode data.

left_scripts and right_scripts contain ordinary observed Script properties. Resolved scripts contain the augmented Script_Extensions intersection used to classify confusables; :all denotes wholly neutral input. A matching skeleton is a comparison fact, never an identity or authorization verdict. For explicit domain comparisons, changed IDNA labels determine the confusable class and mapping records cover original labels and separators.

Summary

Types

class()

@type class() ::
  :none
  | :single_script_confusable
  | :whole_script_confusable
  | :mixed_script_confusable

mapping()

@type mapping() :: %{
  side: :left | :right,
  byte_offset: non_neg_integer(),
  byte_length: pos_integer(),
  codepoint_index: non_neg_integer(),
  codepoint_count: non_neg_integer(),
  codepoints: [non_neg_integer()],
  skeleton_spans: [skeleton_span()],
  mapping: binary()
}

resolved_scripts()

@type resolved_scripts() :: :all | [atom()]

skeleton_span()

@type skeleton_span() :: %{
  codepoint_index: non_neg_integer(),
  codepoint_count: non_neg_integer()
}

t()

@type t() :: %UnicodeSecurity.Comparison{
  canonically_equivalent?: boolean() | nil,
  class: class() | nil,
  confusable?: boolean() | nil,
  left_resolved_scripts: resolved_scripts() | nil,
  left_scripts: [atom()] | nil,
  left_skeleton: binary() | nil,
  mappings: [mapping()],
  right_resolved_scripts: resolved_scripts() | nil,
  right_scripts: [atom()] | nil,
  right_skeleton: binary() | nil,
  same_skeleton?: boolean() | nil,
  unicode_version: binary() | nil
}