mozilla/fxa-auth-db-mysql

TOTP MFA Management API

Closed this issue · 0 comments

Connects with #297

Totp Table

Column Description Options Datatype
uid account's uid UNIQUE NOT NULL BINARY(16)
shared_secret secret used to calulate hash NOT NULL VARCHAR(80)
epoch initial time since epoch used to calulate hash NOT NULL BIGINT UNSIGNED
createdAt time token was created NOT NULL BIGINT UNSIGNED

New stored procedures

.createTotpToken(uid, shared_secret, epoch)

Parameters:

  • uid - (Buffer16) the uid of the account
  • shared_secret - (string) the shared secret used to caluate hash
  • epoch - (integer) epoch used to calulate hash, defaults to 0

Returns:

  • resolves with:
    • an empty object {}
  • rejects: with one of:
    • any error from the underlying storage engine

.getTotpToken(uid)

Parameters:

  • uid - (Buffer16) the uid of the account

Returns:

  • resolves with:
    • an object
    • sharedSecret
    • epoch
  • rejects: with one of:
    • error.notFound()
    • any error from the underlying storage engine

.deleteTotpToken(uid)

Parameters:

  • uid - (Buffer16) the uid of the account

Returns:

  • resolves with:
    • an empty object {}
  • rejects: with one of:
    • error.notFound()
    • any error from the underlying storage engine

New endpoints

Create TOTP Token

  • Method : PUT
  • Path : /totp/<uid>
    • uid : hex128
  • Params
    • shared_secret : string
    • epoch : epoch

Delete TOTP Token

  • Method : DEL
  • Path : /totp/<uid>
    • uid : hex128

Get TOTP Token

  • Method : GET
  • Path : /totp/<uid>
    • uid : hex128