This project serves as a playground for experimenting with Node.js cryptographic libraries.
Some of the code examples require an Auth0 with an API connection that issues OAuth access tokens.
Some of the code examples require the creation of an AWS Cognito user pool that issues OAuth access tokens. The AWS Cloud Development Kit (CDK) is used to create all of the necessary AWS Cognito resources.
Ensure the following requirements are met prior to usage:
- Node.js 18 or higher
- An active Auth0 account
- An active Amazon Web Services (AWS) account
- Clone the repository:
git clone git@github.com:tgillus/node-crypto-playground.git
- Install the project dependencies:
cd node-crypto-playground
npm install
- Create a
.env
in the root of the project based on the.env.example
file and add values for each of the environment variables:
cp .env.example .env
The environment variables have place holder values that need to be replaced with actual values.
NOTE: The .env
file is used to store sensitive information such as OAuth client id and client secret values. Do not commit the .env
file to source control.
Command | Description |
---|---|
npm run build |
Check for TypeScript errors. |
npm run watch |
Watch for changes and check for TypeScript errors. |
npm run test |
Execute unit tests. |
npm run cdk deploy |
Deploy a CDK stack to AWS. |
npm run cdk diff |
Compare a deployed stack with current state. |
npm run cdk destroy |
Delete a CDK stack (and its associated resources) from AWS. |
npm run cdk synth |
Emit synethesize CloudFormation template for a CDK stack. |
npm run format |
Format source files. |
npm run lint |
Run linter against source files. |
npm run lint:fix |
Lint source files and fix issues disovered by the linter. |
npm run cdk deploy -- --all
npx tsx src/playground/crypto/oauth/auth0/auth0.ts
npx tsx src/playground/crypto/oauth/cognito/openid-client.ts
npm run cdk destroy -- --all --force