ex_bank_id v0.2.1 ExBankID.PayloadHelpers View Source

Checkers for Payload options

https://www.bankid.com/assets/bankid/rp/bankid-relying-party-guidelines-v3.4.pdf

Link to this section Summary

Functions

Returns {:ok, ip_addres} or {:error, reason} for IP address validity

Returns {:ok, nil} when personal number is omitted

Returns {:ok, nil} when requirement is anything besides a map or nil

Returns {:error, "Invalid requirement"} when key, value is anything else besides above permitted

Returns false when arg is anything other than a string

Link to this section Functions

Link to this function

check_ip_address(ip_address)

View Source

Returns {:ok, ip_addres} or {:error, reason} for IP address validity

Examples

iex> ExBankID.PayloadHelpers.check_ip_address("1.1.1.1")
{:ok, "1.1.1.1"}

iex> ExBankID.PayloadHelpers.check_ip_address("345.0.0.0")
{:error, "Invalid ip address: 345.0.0.0"}
Link to this function

check_personal_number(personal_number)

View Source

Returns {:ok, nil} when personal number is omitted

Examples

iex> ExBankID.PayloadHelpers.check_personal_number(nil)
{:ok, nil}
Link to this function

check_requirement(requirement)

View Source

Returns {:ok, nil} when requirement is anything besides a map or nil

Examples

iex> ExBankID.PayloadHelpers.check_requirement("something")
{:error, "Invalid requirement"}
Link to this function

check_requirement(arg1, value)

View Source
This function is deprecated. Will not be possible to use in future versions of the RP API. Use tokenStartRequired..

Returns {:error, "Invalid requirement"} when key, value is anything else besides above permitted

Examples

iex> ExBankID.PayloadHelpers.check_requirement(:foo, "bar")
{:error, "Invalid requirement"}

Returns false when arg is anything other than a string

Examples

iex> ExBankID.PayloadHelpers.oid?(:foo)
false