All Projects → pyramation → Totp

pyramation / Totp

Licence: mit
RFC6238 TOTP implementation in pure PostgreSQL plpgsql

Labels

Projects that are alternatives of or similar to Totp

Synapse scripts
Tools for maintaining a matrix synapse chat server // SEEKING MAINTAINERS
Stars: ✭ 58 (-40.82%)
Mutual labels:  plpgsql
Pg bitemporal
Bitemporal tables in Postgres
Stars: ✭ 70 (-28.57%)
Mutual labels:  plpgsql
Cartodb Postgresql
PostgreSQL extension for CartoDB
Stars: ✭ 90 (-8.16%)
Mutual labels:  plpgsql
Pg
PostgreSQL experiments
Stars: ✭ 60 (-38.78%)
Mutual labels:  plpgsql
Ora migrator
Tools for Oracle to PostgreSQL migration
Stars: ✭ 66 (-32.65%)
Mutual labels:  plpgsql
Openquerystore
OpenQueryStore
Stars: ✭ 75 (-23.47%)
Mutual labels:  plpgsql
Pgformatter
A PostgreSQL SQL syntax beautifier that can work as a console program or as a CGI. On-line demo site at http://sqlformat.darold.net/
Stars: ✭ 1,085 (+1007.14%)
Mutual labels:  plpgsql
Pg permission
A simple set of views to see ALL permissions in a PostgreSQL database
Stars: ✭ 92 (-6.12%)
Mutual labels:  plpgsql
Postgrest Example
Migrations for an example conference API
Stars: ✭ 69 (-29.59%)
Mutual labels:  plpgsql
Evergreen
Evergreen ILS
Stars: ✭ 85 (-13.27%)
Mutual labels:  plpgsql
Docker Postgis
This repository contains Docker image builds for PostgreSQL / PostGIS
Stars: ✭ 62 (-36.73%)
Mutual labels:  plpgsql
Basketball
Public subset of my basketball github
Stars: ✭ 65 (-33.67%)
Mutual labels:  plpgsql
R Server Hospital Length Of Stay
Hospital length of stay prediction solution with Microsoft R Server
Stars: ✭ 76 (-22.45%)
Mutual labels:  plpgsql
Pg Clone Schema
Postgres clone schema utility without need of going outside of database. Makes developers life easy by running single function to clone schema with all objects. It is very handy on Postgres RDS. Utility is sponsored by http://elephas.io/
Stars: ✭ 59 (-39.8%)
Mutual labels:  plpgsql
Postgresql Anyarray
PostgeSQL extension adding highly desirable, data-type independent array functionality.
Stars: ✭ 91 (-7.14%)
Mutual labels:  plpgsql
Pgulid
Universally Unique Lexicographically Sortable Identifier (ULID) for PostgreSQL
Stars: ✭ 56 (-42.86%)
Mutual labels:  plpgsql
Openmaptiles
OpenMapTiles Vector Tile Schema Implementation
Stars: ✭ 1,175 (+1098.98%)
Mutual labels:  plpgsql
Qt Client
This repository contains the source code for the Desktop client. The Desktop client is built using the Qt framework for C++. The client can be extended or customized using JavaScript. This client is used by all editions of xTuple ERP.
Stars: ✭ 93 (-5.1%)
Mutual labels:  plpgsql
Pg Semver
A semantic version data type for PostgreSQL
Stars: ✭ 91 (-7.14%)
Mutual labels:  plpgsql
Ssis Queries
A set of queries useful to easily extract monitoring and package performance data from SSISDB database
Stars: ✭ 79 (-19.39%)
Mutual labels:  plpgsql

totp Build Status

TOTP implementation in pure PostgreSQL plpgsql

This extension provides the HMAC Time-Based One-Time Password Algorithm (TOTP) as specfied in RFC 6238/4226 as pure plpgsql functions.

Usage

totp.generate

SELECT totp.generate('mysecret');

-- you can also specify totp_interval, and totp_length
SELECT totp.generate('mysecret', 30, 6);

In this case, produces a TOTP code of length 6

013438

totp.verify

SELECT totp.verify('mysecret', '765430');

-- you can also specify totp_interval, and totp_length
SELECT totp.verify('mysecret', '765430', 30, 6);

Depending on input, returns TRUE/FALSE

totp.url

-- totp.url ( email text, totp_secret text, totp_interval int, totp_issuer text )
SELECT totp.url(
    '[email protected]',
    'mysecret',
    30,
    'Acme Inc'
);

Will produce a URL-encoded string

otpauth://totp/[email protected]?secret=mysecret&period=30&issuer=Acme%20Inc

caveats

  • Currently only supports sha1
  • Currently only supports 20 byte secrets

pull requests welcome!

credits

Thanks to

https://tools.ietf.org/html/rfc6238

https://www.youtube.com/watch?v=VOYxF12K1vE

https://pgxn.org/dist/otp/

Development

start the postgres db process

First you'll want to start the postgres docker (you can also just use docker-compose up -d):

make up

install modules

Install modules

yarn install

install the Postgres extensions

Now that the postgres process is running, install the extensions:

make install

This basically sshs into the postgres instance with the packages/ folder mounted as a volume, and installs the bundled sql code as pgxn extensions.

testing

Testing will load all your latest sql changes and create fresh, populated databases for each sqitch module in packages/.

yarn test:watch

building new modules

Create a new folder in packages/

lql init

Then, run a generator:

lql generate

You can also add arguments if you already know what you want to do:

lql generate schema --schema myschema
lql generate table --schema myschema --table mytable

deploy code as extensions

cd into packages/<module>, and run lql package. This will make an sql file in packages/<module>/sql/ used for CREATE EXTENSION calls to install your sqitch module as an extension.

recursive deploy

You can also deploy all modules utilizing versioning as sqtich modules. Remove --createdb if you already created your db:

lql deploy awesome-db --yes --recursive --createdb
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].