1.0.0 • Published 6 years ago

@alicloud/kms v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

kms client for alicloud

Install

npm i @alicloud/kms

Usage

const KMSClient = require('@alicloud/kms');

const client = new KMSClient({
  accessKeyId: 'your accessKeyId',
  accessKeySecret: 'your accessKeySecret',
  // must be https url
  endpoint: 'https://kms.{region}.aliyuncs.com', // e.g.: 'https://kms.cn-hangzhou.aliyuncs.com'
});

(async () => {

  const plainText = 'Hello KMS';
  const encryptText = await client.encrypt('my key id', plainText);
  console.log('%s => %s', plainText, encryptText);
  assert.equal(await client.decrypt(encryptText), plainText);

})().catch(err => console.error(err));

Endpoints

see https://help.aliyun.com/document_detail/69006.html