TelepathyIM / telepathy-qt

Telepathy Qt bindings
https://telepathy.freedesktop.org
GNU Lesser General Public License v2.1
25 stars 14 forks source link

Add support for One-Time Password authentication #6

Open Kaffeine opened 8 years ago

Kaffeine commented 8 years ago

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:

Read only.

AvailableMethods - as (array of strings).

Read only, can be changed.

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


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:


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)

gkiagia commented 8 years ago

Hey, why not open a ticket for this in the freedesktop bugzilla against telepathy-spec? I would have never noticed it here...

First of all, a very discouraging question :P Why not just use Chan.I.SASLAuthentication? It seems to me that they are a lot similar, we just need to define new 'mechanisms'. The only problem seems to be that the available methods can change here, while SASLAuthentication doesn't allow that. This could be changed, though...

Some things that I don't understand:

Some requests:

Kaffeine commented 8 years ago

@gkiagia I decided to open the issue only after wrote the mail to you. Firstly I thought to polish it alone (because I'm the only developer of the interested component (telepathy-morse)).

Why not just use Chan.I.SASLAuthentication?

I thought a lot on this idea, but then decided that a different, clear interface would be better, than overloaded SASL. "Specific API" vs "SASL fit all".

Like SASL, this interface can be used for anything (not only auth) at any time of connection.

Please provide a use scenario. I would like to understand exactly how the user is going to interact with this.

Done. The first section is "Use case" now.

Please think about how this would apply to other protocols that use similar mechanisms for authentication, supposing they could be supported in telepathy.

This is why I added Phone Number argument to UseMethod(). Telegram requires phone number to be an account parameter, but other protocols might need phone verification for any random reason. E.g. we have "Account balance" interface. It is pretty possible to use phone verification to add some money to the balance. The phone can be not associated with the account.