Weavr.AuthenticationFactors (Weavr v1.0.0)

Copy Markdown View Source

Authentication factor enrolment — register a device or channel for multi-factor authentication.

This is distinct from Weavr.StepUp (which manages per-operation challenges). Authentication factors are one-time setup that enrols the user's device so that step-up challenges can be sent to it.

Confirmed endpoints (from Weavr error-handling docs and curl examples)

  • POST /authentication_factors/otp/{channel} — initiate enrolment OTP
  • POST /authentication_factors/otp/{channel}/verify — verify enrolment

Channels

Currently supported: "SMS", "AUTHY" (Twilio Authy).

Sandbox note

On Sandbox, the verification code is always "123456".

Summary

Functions

Initiates enrolment of an authentication factor channel.

The supported authentication factor channels.

Verifies the OTP code to complete authentication factor enrolment.

Functions

enrol(config, auth_token, channel)

@spec enrol(Weavr.Config.t(), String.t(), String.t()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}

Initiates enrolment of an authentication factor channel.

POST /authentication_factors/otp/{channel}

This triggers an OTP to be sent to the user via the given channel. On Sandbox, the code is always "123456".

supported_channels()

@spec supported_channels() :: [String.t()]

The supported authentication factor channels.

verify_enrolment(config, auth_token, channel, verification_code)

@spec verify_enrolment(Weavr.Config.t(), String.t(), String.t(), String.t()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}

Verifies the OTP code to complete authentication factor enrolment.

POST /authentication_factors/otp/{channel}/verify

On Sandbox, the code is always "123456".