Proca.Contact (proca v3.4.1)

Schema holding personal data (PII). Belongs to action page that collected the data, and to organisation which the data is sent to. Contains consent information. Can be encrypted. There can be many Contact records per one supporter.

Fields:

  • payload a JSON with PII or encrypted JSON with PII

  • crypto_nonce the nonce of used encryption (if NULL, there is not encryption)

  • public_key, sign_key - keys used for encryption (optional)

  • communication_consent - consent to receive email (or other communication) - given on the widget

  • communication_scopes - media over which the consent to communicate was given (we only use email)

  • delivery_consent - consent to process the PII (sync to CRM)

Link to this section Summary

Functions

Encrypt this contact changeset for a list of keys. Returns lists of Contact records with payload encrypted for each key.

If necessary, update and unencrypted contact with active key

Link to this section Functions

Link to this function

add_consent(contact_ch, consent)

Link to this function

add_encryption(contact_ch, org)

Specs

add_encryption(Ecto.Changeset.t(Proca.Contact), %Proca.Org{
  __meta__: term(),
  action_pages: term(),
  action_schema_version: term(),
  campaigns: term(),
  config: term(),
  contact_schema: term(),
  custom_action_confirm: term(),
  custom_action_deliver: term(),
  custom_event_deliver: term(),
  custom_supporter_confirm: term(),
  detail_backend: term(),
  detail_backend_id: term(),
  doi_thank_you: term(),
  email_backend: term(),
  email_backend_id: term(),
  email_from: term(),
  event_backend: term(),
  event_backend_id: term(),
  high_security: term(),
  id: term(),
  inserted_at: term(),
  name: term(),
  public_keys: term(),
  push_backend: term(),
  push_backend_id: term(),
  services: term(),
  staffers: term(),
  storage_backend: term(),
  storage_backend_id: term(),
  supporter_confirm: term(),
  supporter_confirm_template: term(),
  title: term(),
  updated_at: term()
}) :: Ecto.Changeset.t(Proca.Contact)
Link to this function

base_decode(encoded)

Link to this function

base_encode(data)

Link to this function

build(contact_data)

Specs

build(struct()) ::
  Ecto.Changeset.t(%Proca.Contact{
    __meta__: term(),
    communication_consent: term(),
    communication_scopes: term(),
    crypto_nonce: term(),
    delivery_consent: term(),
    id: term(),
    inserted_at: term(),
    org: term(),
    org_id: term(),
    payload: term(),
    public_key: term(),
    public_key_id: term(),
    sign_key: term(),
    sign_key_id: term(),
    supporter: term(),
    supporter_id: term(),
    updated_at: term()
  })
Link to this function

change_for_org(contacts, org, attrs)

Link to this function

encrypt(contact_ch, list)

Specs

encrypt(Ecto.Changeset.t(Proca.Contact), [
  %Proca.PublicKey{
    __meta__: term(),
    active: term(),
    expired: term(),
    id: term(),
    inserted_at: term(),
    name: term(),
    org: term(),
    org_id: term(),
    private: term(),
    public: term(),
    updated_at: term()
  }
]) :: [Ecto.Changeset.t(Proca.Contact)]

Encrypt this contact changeset for a list of keys. Returns lists of Contact records with payload encrypted for each key.

Link to this function

ensure_encrypted!(contact)

If necessary, update and unencrypted contact with active key

Link to this function

spread(new_contact, list)