@cryptoket/secret-credential
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

SecretCredential

module to manage secret credentials stored somewhere in the aws, or local file.

import * as Credential from '@cryptoket/secret-credential'
interface MyCredential {
  AWS: {
    ACCESS_KEY_ID: string;
    SECRET_ACCESS_KEY: string;
  }
}
async function main(){
  const credential = new Credential.FromFile<MyCredential>('path/to/your/file.json');
  const { AWS } = await credential.content();
  // ACCESS_KEY_ID and SECRET_ACCESS_KEY
  const { ACCESS_KEY_ID, SECRET_ACCESS_KEY } =  await credential.get('AWS');
  // maybe if you need it, this can be done as well.
}

SecretCredential.FromEncryptedS3

import * as aws from 'aws-sdk';
import * as Credential from '@cryptoket/secret-credential';

const kms = new aws.KMS({ /** your aws credentials, and region goes here */ });
const s3 = new aws.S3({ /** your aws credentials, and region goes here */ });
async function main() {
  const credential = new Credential.FromEncryptedS3({ s3, kms, })
}

Readme

Keywords

none

Package Sidebar

Install

npm i @cryptoket/secret-credential

Weekly Downloads

1

Version

1.0.5

License

ISC

Unpacked Size

110 kB

Total Files

59

Last publish

Collaborators

  • cryptoket