Karta.BIMI.SVG (Karta v1.0.0)

Checks a BIMI logo against SVG Tiny Portable/Secure, the profile of SVG Tiny 1.2 that BIMI requires (draft-svg-tiny-ps-abrotman-13, October 2026), before Karta stores and serves it (Karta.BIMI).

Parsing. OTP's SAX parser (:xmerl_sax_parser), which reports names as strings (no atoms are made from the file), with entity declarations refused, external entities never read and undeclared references an error. A document type declaration, a processing instruction (other than the XML declaration) or anything after the root element makes the file invalid. At most 32 KB (the profile's limit).

The profile.

  • The root is <svg> in the SVG namespace with version="1.2" and baseProfile="tiny-ps", without x= or y=, with a square viewBox (mailbox providers show the logo in a square or a circle).
  • Its first child is a <title> that is not empty (the brand's name); there is one.
  • Only the profile's elements (allowed_elements/0): no <script>, no animation, no <image> (raster images), no <a>, no <foreignObject>, no <style>, no elements of other namespaces; <metadata> holds text only.
  • Only the profile's attributes: no event handlers (onload=), no style=, no attributes of other namespaces; <use> refers only to an element of the file (href="#id"); a paint or other value with url(…) refers only to an element of the file (url(#id)); the fixed values of zoomAndPan, externalResourcesRequired, focusable, snapshotTime, playbackOrder, timelineBegin and editable.

Not checked: that the logo has at least two colours, and that its title is at most 64 characters (both "should" in the profile).

Summary

Functions

The elements the profile allows.

{:ok, %{title: title}} for a logo that meets the profile, or {:error, problems}: at most ten sentences, each saying what to change.

The largest logo accepted, in bytes (32 KB).

Functions

allowed_elements()

@spec allowed_elements() :: [String.t()]

The elements the profile allows.

check(svg)

@spec check(binary()) :: {:ok, %{title: String.t()}} | {:error, [String.t()]}

{:ok, %{title: title}} for a logo that meets the profile, or {:error, problems}: at most ten sentences, each saying what to change.

max_size()

@spec max_size() :: pos_integer()

The largest logo accepted, in bytes (32 KB).