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
),
});
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;
const writeCapacity = 10;
DynamoDbPublicKeyStore.createTable(db, tableName, readCapacity, writeCapacity);