ExBankID (ex_bank_id v0.2.2) View Source

Simple abstraction over the swedish BankID API.

Link to this section Summary

Functions

Initiates a new BankID authentication session.

Attempts to cancel a ongoing authentication/signing session.

Attempts to collect the status of an ongoing authentication/signing session. See: BankID Relying party guidelines section 14.2

Initiates a new BankID signing session.

Link to this section Functions

Link to this function

auth(ip_address, opts \\ [])

View Source

Specs

auth(String.t(), Keyword.t()) ::
  {:error, %ExBankID.Error.Api{details: term(), errorCode: term()} | binary()}
  | {:error, NimbleOptions.ValidationError.t()}
  | {:ok,
     %ExBankID.Auth.Response{
       autoStartToken: term(),
       orderRef: term(),
       qrStartSecret: term(),
       qrStartToken: term()
     }}

Initiates a new BankID authentication session.

Supported options:

  • :url - The default value is "https://appapi2.test.bankid.com/rp/v5.1/".

  • :cert_file - If no certificate path is specified, the publicly available test certificate will be used. The default value is "/home/anfly/code/elixir/bankid/bankid_api_client/lib/ex_bank_id/../../assets/test.pem".

  • :personal_number - This option can be used to specify the personal number of the person authenticating. See: BankID Relying party guidelines section 14.1

  • :requirement - See: BankID Relying party guidelines section 14.5

  • :http_client - Specify a custom http client. Should be a module that implements ExBankID.Http.Client. The default value is ExBankID.Http.Default.

  • :json_handler - Specify a custom json handler. Should be a module that implements ExBankID.Json.Handler. The default value is ExBankID.Json.Default.

Link to this function

cancel(order_ref, opts \\ [])

View Source

Specs

cancel(
  String.t()
  | %ExBankID.Sign.Response{
      autoStartToken: term(),
      orderRef: term(),
      qrStartSecret: term(),
      qrStartToken: term()
    }
  | %ExBankID.Auth.Response{
      autoStartToken: term(),
      orderRef: term(),
      qrStartSecret: term(),
      qrStartToken: term()
    },
  Keyword.t()
) ::
  {:error, %ExBankID.Error.Api{details: term(), errorCode: term()} | binary()}
  | {:error, NimbleOptions.ValidationError.t()}
  | {:ok, %{}}

Attempts to cancel a ongoing authentication/signing session.

Supported options:

  • :url - The default value is "https://appapi2.test.bankid.com/rp/v5.1/".

  • :cert_file - If no certificate path is specified, the publicly available test certificate will be used. The default value is "/home/anfly/code/elixir/bankid/bankid_api_client/lib/ex_bank_id/../../assets/test.pem".

  • :http_client - Specify a custom http client. Should be a module that implements ExBankID.Http.Client. The default value is ExBankID.Http.Default.

  • :json_handler - Specify a custom json handler. Should be a module that implements ExBankID.Json.Handler. The default value is ExBankID.Json.Default.

Link to this function

collect(order_ref, opts \\ [])

View Source

Specs

collect(
  String.t()
  | %ExBankID.Sign.Response{
      autoStartToken: term(),
      orderRef: term(),
      qrStartSecret: term(),
      qrStartToken: term()
    }
  | %ExBankID.Auth.Response{
      autoStartToken: term(),
      orderRef: term(),
      qrStartSecret: term(),
      qrStartToken: term()
    },
  Keyword.t()
) ::
  {:error, %ExBankID.Error.Api{details: term(), errorCode: term()} | binary()}
  | {:error, NimbleOptions.ValidationError.t()}
  | {:ok,
     %ExBankID.Collect.Response{
       completionData: term(),
       hintCode: term(),
       orderRef: term(),
       status: term()
     }}

Attempts to collect the status of an ongoing authentication/signing session. See: BankID Relying party guidelines section 14.2

Supported options:

  • :url - The default value is "https://appapi2.test.bankid.com/rp/v5.1/".

  • :cert_file - If no certificate path is specified, the publicly available test certificate will be used. The default value is "/home/anfly/code/elixir/bankid/bankid_api_client/lib/ex_bank_id/../../assets/test.pem".

  • :http_client - Specify a custom http client. Should be a module that implements ExBankID.Http.Client. The default value is ExBankID.Http.Default.

  • :json_handler - Specify a custom json handler. Should be a module that implements ExBankID.Json.Handler. The default value is ExBankID.Json.Default.

Link to this function

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

View Source

Specs

sign(String.t(), String.t(), Keyword.t()) ::
  {:error, %ExBankID.Error.Api{details: term(), errorCode: term()} | binary()}
  | {:error, NimbleOptions.ValidationError.t()}
  | {:ok,
     %ExBankID.Sign.Response{
       autoStartToken: term(),
       orderRef: term(),
       qrStartSecret: term(),
       qrStartToken: term()
     }}

Initiates a new BankID signing session.

Supported options:

  • :url - The default value is "https://appapi2.test.bankid.com/rp/v5.1/".

  • :cert_file - If no certificate path is specified, the publicly available test certificate will be used. The default value is "/home/anfly/code/elixir/bankid/bankid_api_client/lib/ex_bank_id/../../assets/test.pem".

  • :personal_number - This option can be used to specify the personal number of the person signing. See: BankID Relying party guidelines section 14.1

  • :requirement - See: BankID Relying party guidelines section 14.5

  • :user_non_visible_data - Typically used to include a hash/digest of a document that is to be signed. See: BankID Relying party guidelines section 12

  • :http_client - Specify a custom http client. Should be a module that implements ExBankID.Http.Client. The default value is ExBankID.Http.Default.

  • :json_handler - Specify a custom json handler. Should be a module that implements ExBankID.Json.Handler. The default value is ExBankID.Json.Default.

Specs

static_qr(
  %ExBankID.Sign.Response{
    autoStartToken: term(),
    orderRef: term(),
    qrStartSecret: term(),
    qrStartToken: term()
  }
  | %ExBankID.Auth.Response{
      autoStartToken: term(),
      orderRef: term(),
      qrStartSecret: term(),
      qrStartToken: term()
    }
) :: <<_::64, _::_*8>>

See ExBankID.Qr.static_qr/1.