@types/cryptex
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

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

// 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: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: none

Credits

These definitions were written by Robert Brownstein.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/cryptex

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

5.39 kB

Total Files

5

Last publish

Collaborators

  • types