Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (25 sloc) 966 Bytes

node-pgp-postgres is a PostgreSQL backend for node-pgp. It provides an implementation of the Keyring class that stores keys in database tables.

Use the following code to create an instance of the Keyring class:

var pgpPg = require("node-pgp-postgres");
pgpPg.getKeyring("postgres://postgres@localhost/database", function(err, keyring) {
	if(err)
		; // An error occurred

	// Now we do some stuff with the keyring

	// Once we are finished, we release the database connection:
	keyring.done();
}, true); // If the last parameter is set to true, the database layout will be initialised automatically

The connection string uses the format of node-postgres. It may also be specified as an object of the following format:

{
	user: "postgres",
	password: "password",
	host: "localhost",
	port: 1234,
	database: "database",
	schema: "public"
}