otp

This Release
otp 1.0.0
Date
Status
Stable
Abstract
Implementation of TOTP which is compatible with google authenticator app.
Description
Implementation of TOTP which is compatible with google authenticator app.
Released By
asio
License
PostgreSQL
Resources
Special Files

Extensions

otp 1.0.0
Implementation of TOTP which is compatible with google authenticator app.

README

otp

Description

Implementation of TOTP which is compatible with google authenticator app.

Usage

CREATE EXTENSION otp;

CREATE TABLE users (
  email text not null,
  secret   text not null,
  interval int not null default 30,
  length   int not null default 6
);
INSERT INTO users (email, secret) VALUES ('foo@example.com', random_base32());

SELECT generate_totp(secret, interval, length)
FROM users WHERE email = 'foo@example.com';

SELECT verify_totp(secret, interval, '380092')
FROM users
WHERE email = 'foo@example.com';

SELECT provisioning_url(email, secret, interval, 'Company Name')
FROM users
WHERE email = 'foo@example.com';

Author

Marcel Asio

Copyright and License

Copyright © 2015 Marcel Asio.