Skip to content

Add support for One-Time Password authentication #6

Open
@Kaffeine

Description

@Kaffeine

Add Channel.Interface.OTPAuthentication

The interface is inspired by Channel.Interface.SASLAuthentication.

The description is outdated (written for Channel.Interface.PhoneVerification, which would be generalised to One-time password Authentication).

Use case

The interface would be exposed by telepathy-morse (telegram connection manager). Sign in process would be follow:

  • User setups an account. The only required parameter is phone number.
  • User sets presence to online.
  • Morse creates an OTP channel:
    • VerificationStatus (Not_Started)
    • AvailableMethods("sms")
    • CanTryAgain (true)
    • DefaultPhoneNumber (the user phone number)
  • ktp-auth-handler handles the channel:
    • Calls UseMethod("sms", "") and informs user, that verification code would be sent via sms (because it is the only available method)
      or
    • Show a button box with sms and call actions with the last one disabled.
    • Connects via DBus to KDEConnect signal about incoming sms
  • Morse:
    • Makes request for sms.
    • Changes VerificationStatus to In_Progress
    • On server respond, Morse emits PasswordSent signal with details:
      • PasswordRegexp is a five digits after a space
      • SenderRegexp is "Telegram" or "TeleVerify"
      • CallTimeout (received from server. Something like 30 sec)
  • ktp-auth-handler:
    • shows countdown if password details have "Expiration" property.
    • waits for KDEConnect incoming sms signal
    • on KDEConnect signal, ktp-auth-handler match sender with SenderRegexp and then match the message for PasswordRegexp. If both check succeed, then either automatically call Respond with the password, or, at least, insert it to the input line and waits for user action.
  • Morse (optionally):
    • adds "call" method to the available method list.
  • ktp-auth-handler:
    • shows buttons for all available methods ("Request an SMS", "Request a call")
  • Morse (if two-factor authentication is enabled (which the most popular case)):
    • creates a SASLAuthentication channel...

Properties

VerificationStatus - Verification_Status.

Read only.

AvailableMethods - as (array of strings).

Read only, can be changed.

Method list depends on protocol and server. Well-known values would be:

  • "sms" (the server would send a text message with a code to the "phone number")
  • "call" (there would be a voice call to the "phone number" and someone (probably robot) would tell the code)
  • Telegram also have "app" method, which means that the code would be send as a message in application. You can read it, if you have an already authenticated client.

CanTryAgain - b (bool)

Since v2

DefaultPhoneNumber - s (string)

Since v2

Read only, can be empty.
Predefined phone number, which will receive the message or the call.


Signals

VerificationStatusChanged(Verification_Status newStatus)

AvailableMethodsChanged(as newAvailableMethods)

Sometimes you can get a call only if you already tried to get sms and not received it yet (Telegram case).

PasswordSent(a{sv} details)

Possible optional keys:

  • PasswordRegexp
  • SenderRegexp
  • Expiration
  • CallTimeout
  • ResendTimeout

Methods

UseMethod(string method, string phone) -> void

Activate the "method" to get a code on passed phone number.
The phone argument can be not associated with the account, or can be not permanent for some protocol/server/etc.

Probably this argument would be needed by Telegram CM to perform change of the user phone number.
Artificial use case can be phone verification to connect to some room in jabber, or (as we have "Account balance" interface), it is pretty possible to use phone verification to add some money to the balance. You send phone number, server replies you with a code, you send it back and ooop - you just confirmed a transfer of 5$ from the phone number balance.

Respond(string code) -> void

Try to complete verification with the "code".

Types

Verification_Status - u (uint)

  • Not_Started
  • In_Progress
  • Succeeded
  • Failed

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions