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);