0.1.10 • Published 3 months ago

@ji-constructs/ecs-jwt-keypair v0.1.10

Weekly downloads
-
License
-
Repository
-
Last release
3 months ago

ecs-jwt-keypair

This is an AWS CDK L3 Construct for creating PEM format keypairs in AWS Secrets Manager which can be used for RS256 JWT signing/verification.

Usage in Stack

class MyStack extends Construct {
  constructor() {
    const jwtKeys = new EcsJwtKeyPair(this, 'JwtKeys');

    const apiContainer = taskDefinition.addContainer('api', {
      secrets: {
        JWT_PRIVATE_KEY: jwtKeys.ecsSecrets.privateKey,
        JWT_PUBLIC_KEY: jwtKeys.ecsSecrets.publicKey,
      },
    });
  }
}

Usage in Application

import { sign as signToken } from 'jsonwebtoken';

const { JWT_PRIVATE_KEY } = process.env;

signToken({ sub: 'abc123' }, JWT_PRIVATE_KEY, { algorithm: 'RS256' });
import { verify as verifyToken } from 'jsonwebtoken';

const { JWT_PUBLIC_KEY } = process.env;

verifyToken(token, JWT_PUBLIC_KEY, { algorithms: ['RS256'] });

This library was generated with Nx.

Running unit tests

Run nx test ecs-jwt-keypair to execute the unit tests via Jest.

Running lint

Run nx lint ecs-jwt-keypair to execute the lint via ESLint.

0.1.10

3 months ago

0.1.8

1 year ago

0.1.9

1 year ago

0.1.7

2 years ago

0.1.7-alpha.4

2 years ago

0.1.7-alpha.3

2 years ago

0.1.7-alpha.2

2 years ago

0.1.7-alpha.1

2 years ago

0.1.7-alpha.0

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago