brightspace-auth-keys-dynamodb-store
v8.2.1
Published
DynamoDB based public key store implementation for brightspace-auth-keys
Downloads
24
Readme
brightspace-auth-keys-dynamodb-store
DynamoDB based public key store implementation for brightspace-auth-keys.
Install
npm install brightspace-auth-keys brightspace-auth-keys-dynamodb-store --save
Usage
const KeyGenerator = require('brightspace-auth-keys').KeyGenerator;
const AWS = require('aws-sdk');
const DynamoDbPublicKeyStore = require('brightspace-auth-keys-dynamodb-store');
const db = new AWS.DynamoDB();
const tableName = 'auth_public_keys';
module.exports = new KeyGenerator({
publicKeyStore: new DynamoDbPublicKeyStore(
db,
tableName
),
// see brightspace-auth-keys for the full set of options
});
Setup
For convenience the DynamoDB table can automatically be created in code, doing nothing if the table already exists so that it can be added to initialization code. It will be created with the TTL for the rows set on the ExpiresAt column.
const AWS = require('aws-sdk');
const DynamoDbPublicKeyStore = require('brightspace-auth-keys-dynamodb-store');
const db = new AWS.DynamoDB();
const tableName = 'auth_public_keys';
const readCapacity = 20; /* optional, default 5 */
const writeCapacity = 10; /* optional, default 5 */
DynamoDbPublicKeyStore.createTable(db, tableName, readCapacity, writeCapacity);