@vizamodo/aws-sts-core 0.3.11 → 0.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/sts/issue.js +15 -0
  2. package/package.json +1 -1
package/dist/sts/issue.js CHANGED
@@ -136,15 +136,30 @@ export async function issueAwsCredentials(input) {
136
136
  // ---- STS credential cache lookup (using certificate serial) ----
137
137
  cacheKey = `${region}|${roleArn}|${profileArn}|${trustAnchorArn}|${certSerialDec}`;
138
138
  const cachedEntry = stsCredentialCache.get(cacheKey);
139
+ if (cachedEntry) {
140
+ console.log("[sts-cache] hit", {
141
+ cacheKey,
142
+ expiresAt: cachedEntry.expiresAt,
143
+ now: Date.now(),
144
+ });
145
+ }
146
+ else {
147
+ console.log("[sts-cache] miss", { cacheKey });
148
+ }
139
149
  // Only reuse cached credentials if they still have >10p remaining
140
150
  const MIN_REMAINING_MS = 5 * 60 * 1000;
141
151
  if (cachedEntry) {
142
152
  // If refresh already in-flight → await the same promise
143
153
  if (cachedEntry.expiresAt === 0) {
154
+ console.log("[sts-cache] reuse-inflight-refresh", { cacheKey });
144
155
  return cachedEntry.promise;
145
156
  }
146
157
  // If credentials still valid with safe remaining window → reuse
147
158
  if (cachedEntry.expiresAt > Date.now() + MIN_REMAINING_MS) {
159
+ console.log("[sts-cache] reuse-valid-credentials", {
160
+ cacheKey,
161
+ expiresAt: cachedEntry.expiresAt,
162
+ });
148
163
  return cachedEntry.promise;
149
164
  }
150
165
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizamodo/aws-sts-core",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "Pure AWS STS + SigV4 (X509 Roles Anywhere) core logic",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",