ExBankID.Sign.Payload (ex_bank_id v0.2.2) View Source

Provides the struct used when initiating a signing of data

Link to this section Summary

Functions

Constructs a new Sign Payload with the given ip-address, user visible data, and optionally personal number and user non visible data. user_visible_data and user_non_visible_data will be properly encode

Link to this section Functions

Link to this function

new(ip_address, user_visible_data, opts \\ [])

View Source

Specs

new(binary(), binary(),
  personal_number: String.t(),
  requirement: map(),
  user_non_visible_data: String.t()
) ::
  {:error, String.t()}
  | %ExBankID.Sign.Payload{
      endUserIp: term(),
      personalNumber: term(),
      requirement: term(),
      userNonVisibleData: term(),
      userVisibleData: term()
    }

Constructs a new Sign Payload with the given ip-address, user visible data, and optionally personal number and user non visible data. user_visible_data and user_non_visible_data will be properly encode

Examples

iex> ExBankID.Sign.Payload.new("1.1.1.1", "This will be visible in the bankID app")
%ExBankID.Sign.Payload{endUserIp: "1.1.1.1", userVisibleData: "VGhpcyB3aWxsIGJlIHZpc2libGUgaW4gdGhlIGJhbmtJRCBhcHA="}

iex> ExBankID.Sign.Payload.new("1.1.1.1", "This will be visible in the bankID app", personal_number: "190000000000")
%ExBankID.Sign.Payload{endUserIp: "1.1.1.1", personalNumber: "190000000000", userVisibleData: "VGhpcyB3aWxsIGJlIHZpc2libGUgaW4gdGhlIGJhbmtJRCBhcHA="}

iex> ExBankID.Sign.Payload.new("1.1.1.1", "This will be visible in the bankID app", requirement: %{allowFingerprint: :false})
%ExBankID.Sign.Payload{endUserIp: "1.1.1.1", userVisibleData: "VGhpcyB3aWxsIGJlIHZpc2libGUgaW4gdGhlIGJhbmtJRCBhcHA=", requirement: %{allowFingerprint: :false}}

iex> ExBankID.Sign.Payload.new("Not a valid ip address", "This will be visible in the bankID app", personal_number: "190000000000")
{:error, "Invalid ip address: Not a valid ip address"}