battochon / passwordless-postgrestore Goto Github PK
View Code? Open in Web Editor NEWPostgreSQL TokenStore for Passwordless
License: MIT License
PostgreSQL TokenStore for Passwordless
License: MIT License
There is only one version on the npm registry right now and that's the version using the old version of bcrypt. I want to use this but am unable to install from npm since this current 1.0.0
version is not published to the npm registry.
I installed the latest bcrypt (v1.0.2), but I'm getting the error:
Failed at the [email protected] install script 'node-gyp rebuild'.
Does this npm package require bcrypt version 0.7.8 or is there some other issue?
The entire error log is quite long so I didn't include it all, but there are messages such as this:
../src/bcrypt_node.cc:54:18: error: no member named 'Dispose' in 'v8::Persistent<v8::Function, v8::NonCopyablePersistentTraits<v8::Function> >' callback.Dispose();
Maybe I'm missing something, but in this function:
PostgreStore.prototype.disconnect = function() {
if(!this._pgDone) {
this._pgDone();
}
};
Shouldn't this always fail, since functions are truthy, so this will only call _pgDone()
if it's null or undefined?
Should this be:
PostgreStore.prototype.disconnect = function() {
if(this._pgDone) {
this._pgDone();
}
};
Right now you do this:
self._client.query('INSERT INTO ' + self._table + '(uid,token, origin, ttl) VALUES($1, $2, $3, $4)',[uid, hashedToken, originUrl, (Date.now() + msToLive)], function(err) {
if(err){
self._client.query('UPDATE ' + self._table + ' SET token=$1, origin=$2, ttl=$3 WHERE uid=$4',[hashedToken, originUrl, (Date.now() + msToLive), uid], function(err) {
This ignores all errors in the INSERT
, and also requires two round trips.
It would be better to do a single query with an ON CONFLICT (uid) DO UPDATE ...
.
npm run test
fails on the following
1) should callback in the format of callback(null, true, "") in case of a null referrer
To fix, the origin
column must be nullable with a default value of ''
CREATE TABLE passwordless (
id serial NOT NULL,
uid character varying(160),
token character varying(60) NOT NULL,
origin text default '',
ttl bigint,
CONSTRAINT passwordless_pkey PRIMARY KEY (id),
CONSTRAINT passwordless_token_key UNIQUE (token),
CONSTRAINT passwordless_uid_key UNIQUE (uid)
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.