Initiates, verifies, and inspects one-time passcode transactions.
OTP delivery and verification are separate steps. Initiation returning successfully means the
transaction was accepted, not that the recipient received or verified the code. Keep the
returned transaction ID and submit the user-provided code through verify/3.
Summary
Functions
Generate a one-time password and deliver it by SMS. Store the returned transaction ID and use it with the recipient's submitted code at the verification endpoint. Retry an uncertain initiation with the same idempotency key and body.
Retrieve the delivery, verification, and expiry state of an OTP transaction by ID. The generated token is never returned by this endpoint.
Check the code submitted by the recipient and record the attempt. A completed request returns a pass or fail verdict; retry an uncertain verification with the same idempotency key and body.
Functions
@spec initiate(Inttegro.Client.t(), Inttegro.Otp.InitiateRequest.t(), keyword()) :: {:ok, Inttegro.Otp.Transaction.t()} | {:error, Exception.t()}
Generate a one-time password and deliver it by SMS. Store the returned transaction ID and use it with the recipient's submitted code at the verification endpoint. Retry an uncertain initiation with the same idempotency key and body.
Parameters
client— an authenticatedInttegro.Client.request— aInttegro.Otp.InitiateRequestcontaining the operation input.options— request options such as:idempotency_keyand additional:headers.
Returns
Returns {:ok, Inttegro.Otp.Transaction.t()} when Inttegro accepts and decodes the operation. Returns
{:error, exception} for API, transport, or decoding failures. A successful API response can
still describe an asynchronous resource that has not reached its terminal state.
Example
request = Inttegro.Otp.InitiateRequest.new!(request_attributes)
case Inttegro.Otp.initiate(client, request) do
{:ok, result} -> result
{:error, error} -> {:error, error}
end
@spec lookup(Inttegro.Client.t(), Inttegro.Otp.LookupRequest.t(), keyword()) :: {:ok, Inttegro.Otp.Transaction.t()} | {:error, Exception.t()}
Retrieve the delivery, verification, and expiry state of an OTP transaction by ID. The generated token is never returned by this endpoint.
Parameters
client— an authenticatedInttegro.Client.request— aInttegro.Otp.LookupRequestcontaining the operation input.options— request options such as:idempotency_keyand additional:headers.
Returns
Returns {:ok, Inttegro.Otp.Transaction.t()} when Inttegro accepts and decodes the operation. Returns
{:error, exception} for API, transport, or decoding failures. A successful API response can
still describe an asynchronous resource that has not reached its terminal state.
Example
request = Inttegro.Otp.LookupRequest.new!(request_attributes)
case Inttegro.Otp.lookup(client, request) do
{:ok, result} -> result
{:error, error} -> {:error, error}
end
@spec verify(Inttegro.Client.t(), Inttegro.Otp.VerifyRequest.t(), keyword()) :: {:ok, Inttegro.Otp.Verification.t()} | {:error, Exception.t()}
Check the code submitted by the recipient and record the attempt. A completed request returns a pass or fail verdict; retry an uncertain verification with the same idempotency key and body.
Parameters
client— an authenticatedInttegro.Client.request— aInttegro.Otp.VerifyRequestcontaining the operation input.options— request options such as:idempotency_keyand additional:headers.
Returns
Returns {:ok, Inttegro.Otp.Verification.t()} when Inttegro accepts and decodes the operation. Returns
{:error, exception} for API, transport, or decoding failures. A successful API response can
still describe an asynchronous resource that has not reached its terminal state.
Example
request = Inttegro.Otp.VerifyRequest.new!(request_attributes)
case Inttegro.Otp.verify(client, request) do
{:ok, result} -> result
{:error, error} -> {:error, error}
end