0.1.10 • Published 1 year ago
@ji-constructs/ecs-jwt-keypair v0.1.10
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
1 year ago
0.1.8
2 years ago
0.1.9
2 years ago
0.1.7
3 years ago
0.1.7-alpha.4
3 years ago
0.1.7-alpha.3
3 years ago
0.1.7-alpha.2
3 years ago
0.1.7-alpha.1
3 years ago
0.1.7-alpha.0
3 years ago
0.1.6
3 years ago
0.1.5
3 years ago
0.1.4
3 years ago
0.1.3
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.1.0
3 years ago