Giter Club home page Giter Club logo

ots-cdk's Introduction

ots-cdk

The official CDK construct for self-hosted ots.

Usage

Create a new CDK app if you don't already have one:

> mkdir dev; cd dev
dev> npx cdk init app --language typescript
dev> npx cdk bootstrap 'aws://123456789012/us-east-1' --profile dev

Make sure you're authenticated with the GitHub registry using a PAT:

> npm config set @sniptt-official:registry https://npm.pkg.github.com
> npm config set -- '//npm.pkg.github.com/:_authToken' $GITHUB_TOKEN

Install the ots-aws construct:

dev> npm i @sniptt-official/ots-cdk

Add to your stack:

import { Ots } from '@sniptt-official/ots-cdk';
import { Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';

export class DevStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    // When you run `ots new` the resulting "View URL" will be composed
    // using this value. For example:
    //
    // https://my-ots-web-view.com/burn-secret?id=xxx#xxx
    //
    // Make sure this web view implements client-side decryption of the secret.
    const webViewUrl = 'https://my-ots-web-view.com/burn-secret';
    const ots = new Ots(this, 'Ots', { webViewUrl });
  }
}

Deploy:

> npx cdk deploy DevStack --profile dev

Grab the resulting API Gateway URL and API key and configure your ots cli via ~/.ots.yaml:

apiUrl: https://YOUR_API_ID.execute-api.YOUR_REGION.amazonaws.com/prod/secrets
apiKey: YOUR_API_KEY

Use ots as before:

> ots new -x 2h
Using config file: /Users/xxx/.ots.yaml
Enter your secret: ***
Your secret is now available on the below URL.

https://my-ots-web-view.com/burn-secret?id=xxx&ref=ots-cli&region=us-east-1&v=debug#xxx

You should only share this URL with the intended recipient.

Please note that once retrieved, the secret will no longer
be available for viewing. If not viewed, the secret will
automatically expire at approximately xx xxx xxxx xx:xx:xx.

Contributing

Build

> npm ci
> npm run build

ots-cdk's People

Contributors

semantic-release-bot avatar slavovojacek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

noobbase

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.