@cloudbase/cloud-api
Advanced tools
+1
-1
| { | ||
| "name": "@cloudbase/cloud-api", | ||
| "version": "0.3.2", | ||
| "version": "0.3.3", | ||
| "description": "The cloud api request package.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
+7
-1
@@ -77,2 +77,3 @@ import crypto from 'crypto'; | ||
| token?: string; | ||
| tokenExpired?: number; | ||
| } | ||
@@ -91,2 +92,6 @@ | ||
| // token 将在 n 分钟内过期 | ||
| const isTokenExpired = (credential: Credential, gap = 120) => | ||
| credential.tokenExpired && Number(credential.tokenExpired) < Date.now() + gap * 1000; | ||
| export class CloudApiService { | ||
@@ -210,3 +215,4 @@ // 缓存请求实例 | ||
| if (!this.credential?.secretId) { | ||
| // 不存在密钥,或临时密钥过期 | ||
| if (!this.credential?.secretId || isTokenExpired(this.credential)) { | ||
| if (!this.getCredential) { | ||
@@ -213,0 +219,0 @@ throw new CloudBaseError('You must provide credential info!'); |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
34229
0.88%808
0.62%