1.2.0 • Published 8 years ago

pan-domain-public-keys v1.2.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 years ago

Utility functions to fetch pan domain public keys.

fetchKey

Fetch the public key of a given stage. It will make a network request on every call.

import {fetchKey} from 'pan-domain-public-keys';

fetchKey('PROD').then(key => {
	console.log(key);
	// Single line base 64 key as stored in the file:
	// abcdef0123456789abcdef...
})

You can either pass a stage to fetchKey (case insensitive) or a full domain. When using a stage, it assumes gutools domain.

fetchPEM

Fetch the public key of a given stage and convert to PEM. It will make a network request on every call.

import {fetchPEM} from 'pan-domain-public-keys';

fetchPEM('PROD').then(key => {
	console.log(key);
	// PEM formatted key:
	/*
		-----BEGIN PUBLIC KEY-----
		abcdef0123456789abcdef...
		-----END PUBLIC KEY-----
	 */
})

getKey

Same as fetchKey but uses an internal cache. It will make a network call only on cache miss.

getPEM

Same as fetchPEM but uses an internal cache. It will make a network call only on cache miss.

configure

Configure the module

import {configure} from 'pan-domain-public-keys';

configure({
	expires: 60 * 1000 // milliseconds after which cached keys expire, default 1hour
});
1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago