@pagoda-tools/cos-node
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

COS

makeCosCredential

  • 描述:生成鉴权相关信息
  • 类型:MakeCosCredential
interface MakeCosCredentialOpt {
  region: string;
  bucket: string;
  prefix: string;
  secretId: string;
  secretKey: string;
}

type MakeCosCredential = (options: MakeCosCredentialOpt) => Promise<{
  startTime: number;
  expiredTime: number;
  credentials: {
    tmpSecretId: string;
    tmpSecretKey: string;
    sessionToken: string;
  };
}>;
  • 示例代码
import { makeCosCredential } from '@pagoda-tools/node-helper';
const data = await makeCosCredential({
  region: 'xxx',
  bucket: 'xxx',
  prefix: 'xxxx',
  secretId: 'xxxx',
  secretKey: 'xxxx',
});

/*
{
  startTime: 1634030589,
  expiredTime: 1634032389,
  credentials: {
    tmpSecretId: 'xxxxxx',
    tmpSecretKey: 'xxxxx',
    sessionToken: 'xxxxxx'
  };
}
*/
console.log(data);

Readme

Keywords

none

Package Sidebar

Install

npm i @pagoda-tools/cos-node

Weekly Downloads

5

Version

1.0.1

License

none

Unpacked Size

2.75 MB

Total Files

5

Last publish

Collaborators

  • xwjweb
  • aaron-zm
  • ckang1229