smallwat3r/shhh

View on GitHub
docs/swagger.yaml

Summary

Maintainability
Test Coverage
swagger: "2.0"
info:
  description: Share sensitive info without leaving a trace in your chat logs or email accounts.
  version: 1.0.0
  title: Shhh API documentation

externalDocs:
  description: Source code repository
  url: https://github.com/smallwat3r/shhh

paths:
  /api/secret:
    get:
      summary: Read a secret
      description: Decrypt a secret using a passphrase
      operationId: readSecret
      produces:
        - application/json
      parameters:
        - in: query
          type: string
          name: slug
          description: The secret Id
          required: true
        - in: query
          name: passphrase
          type: string
          description: The passphrase to decrypt the secret
          required: true
      responses:
        200:
          description: OK
        401:
          description: The passphrase is not valid
        404:
          description: No secret found
        422:
          description: There is an error in the querystring parameters
    post:
      summary: Create a secret
      description: Encrypt a secret using a passphrase, and set up an expiration policy
      operationId: createSecret
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: body
          name: payload
          description: Secret
          schema:
            $ref: "#/definitions/createSecret"
      responses:
        201:
          description: Created
        422:
          description: There is an error in the request parameters

definitions:
  createSecret:
    type: object
    required:
      - secret
      - passphrase
    properties:
      secret:
        type: string
        description: The secret message to encrypt (max. 250 chars)
        example: "This is a secret message"
      passphrase:
        type: string
        description: The passphrase to open the secret (min. 8 chars, 1 uppercase, 1 number)
        example: "HuDgde723g8f"
      expire:
        type: string
        default: 3d
        description: How long to keep the secret alive (10m, 30m, 1h, 3h, 6h, 1d, 2d, 3d, 5d or 7d)
        example: 30m
      tries:
        type: integer
        default: 5
        description: The number of tries to open the secret before it gets deleted (3, 5 or 10)
        example: 3