TransparencyAndConsent v0.1.0 TransparencyAndConsent View Source

IAB Transparency and Consent Framework v1.1 & v2.0 String Decoding.

Currently only decodes the "version" and the "vendor consents" parts of the "core" segment.

Link to this section Summary

Functions

Decodes TCF strings.

Checks if the provided vendor_id is in the list of vendor_consents

Link to this section Types

Specs

t() :: %TransparencyAndConsent{
  vendor_consents: [vendor_id()],
  version: pos_integer()
}

Specs

vendor_id() :: pos_integer()

Link to this section Functions

Specs

decode(binary()) ::
  {:ok, t()} | {:error, TransparencyAndConsent.DecodeError.t()}

Decodes TCF strings.

Examples

iex> TransparencyAndConsent.decode("COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw")
{:ok, %TransparencyAndConsent{version: 2, vendor_consents: [8, 6, 2]}}
Link to this function

vendor_has_consent?(map, vendor_id)

View Source

Specs

vendor_has_consent?(t(), vendor_id()) :: boolean()

Checks if the provided vendor_id is in the list of vendor_consents

Examples

iex> TransparencyAndConsent.vendor_has_consent?(%TransparencyAndConsent{vendor_consents: [8, 6, 2]}, 8)
true

iex> TransparencyAndConsent.vendor_has_consent?(%TransparencyAndConsent{vendor_consents: [8, 6, 2]}, 123)
false