@blueshit/aliyun-sts
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

@blueshit/aliyun-sts

轻量级阿里云STS客户端,不依赖任何第三方库,体验飞一般的感觉

安装

npm i @blueshit/aliyun-sts -S

使用

import { STS } from "@blueshit/aliyun-sts";

const sts = new STS({
  accessKeyId: ENV_ACCESS_KEY_ID,
  accessKeySecret: ENV_ACCESS_KEY_SECRET,
});
const policy = {
  Statement: [
    {
      Effect: "Allow",
      Action: ["oss:GetObject", "oss:PutObject"],
      Resource: [`acs:oss:*:*:${ENV_BUCKET}/*`],
    },
  ],
  Version: "1",
};

const credentials = await sts.assumeRole(ENV_ACS_RAM, policy, 15 * 60, "RoleSessionName");
console.log(credentials);

授权协议

The MIT License

Readme

Keywords

Package Sidebar

Install

npm i @blueshit/aliyun-sts

Weekly Downloads

5

Version

1.0.3

License

MIT

Unpacked Size

9.44 kB

Total Files

5

Last publish

Collaborators

  • leizongmin
  • yourtion