1.0.4 • Published 7 months ago

@types/cryptex v1.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
7 months ago

Installation

npm install --save @types/cryptex

Summary

This package contains type definitions for cryptex (https://github.com/technologyadvice/cryptex).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cryptex.

index.d.ts

// Type definitions for cryptex 1.0
// Project: https://github.com/technologyadvice/cryptex
// Definitions by: Robert Brownstein <https://github.com/brownstein>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2

// this is the config structure for a given env
// typically, you find these in cryptex.json
export interface CryptexConfig {
    keySource: string;
    keySourceOpts?: {
        dataKey?: string | undefined;
        region?: string | undefined;
    } | undefined;
    algorithm?: string | undefined;
    secretEncoding?: string | undefined;
    secrets: object;
}
// constructor and update params
export interface CryptexOpts {
    file?: string | undefined;
    env?: string | undefined;
    cacheKey?: boolean | undefined;
    cacheKeyTimeout?: number | undefined;
    config?: CryptexConfig | undefined;
}
// cryptex exports a module-level instance by default
export function decrypt(data: string, encoding?: string): Promise<string>;
export function encrypt(data: string, encoding?: string): Promise<string>;
export function getSecret(secret: string, optional?: boolean): Promise<string>;
export function getSecrets(secrets: string[], optional?: boolean): Promise<string[]>;
export function update(opts: CryptexOpts): void;

// but you can still create individual instances
export class Cryptex {
    constructor(opts: CryptexOpts)
    decrypt(data: string, encoding?: string): string;
    encrypt(data: string, encoding?: string): string;
    getSecret(secret: string, optional?: boolean): Promise<string>;
    getSecrets(secrets: string[], optional?: boolean): Promise<string[]>;
    update(opts: CryptexOpts): void;
}

Additional Details

  • Last updated: Thu, 08 Jul 2021 09:08:23 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Robert Brownstein.

1.0.2

9 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.1

3 years ago

1.0.0

5 years ago