@vizamodo/aws-sts-core 0.3.15 → 0.3.17

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.
@@ -1,4 +1,3 @@
1
- import type { AwsCredentialResult } from "../types";
2
1
  /**
3
2
  * Generic edge cache GET helper
4
3
  */
@@ -7,8 +6,3 @@ export declare function getEdgeCache<T>(key: string): Promise<T | null>;
7
6
  * Generic edge cache SET helper
8
7
  */
9
8
  export declare function setEdgeCache(key: string, value: unknown, ttlSec: number): Promise<void>;
10
- /**
11
- * ---- STS credential cache helpers ----
12
- */
13
- export declare function getCachedCredentials(cacheKey: string): Promise<AwsCredentialResult | null>;
14
- export declare function setCachedCredentials(cacheKey: string, result: AwsCredentialResult): Promise<void>;
@@ -1,5 +1,4 @@
1
1
  const CACHE_KEY_PREFIX = "https://edge-cache.internal/";
2
- const CACHE_TTL_BUFFER_SEC = 5 * 60; // 5 minutes safety buffer
3
2
  /**
4
3
  * Generic edge cache GET helper
5
4
  */
@@ -45,18 +44,3 @@ export async function setEdgeCache(key, value, ttlSec) {
45
44
  // cache write failure is non-fatal
46
45
  }
47
46
  }
48
- /**
49
- * ---- STS credential cache helpers ----
50
- */
51
- export async function getCachedCredentials(cacheKey) {
52
- return getEdgeCache(cacheKey);
53
- }
54
- export async function setCachedCredentials(cacheKey, result) {
55
- if (!result.expiration)
56
- return;
57
- const expiresAt = Date.parse(result.expiration);
58
- if (!Number.isFinite(expiresAt))
59
- return;
60
- const ttlSec = Math.floor((expiresAt - Date.now()) / 1000) - CACHE_TTL_BUFFER_SEC;
61
- await setEdgeCache(cacheKey, result, ttlSec);
62
- }
package/dist/sts/issue.js CHANGED
@@ -233,7 +233,7 @@ export async function issueAwsCredentials(input) {
233
233
  if (result.expiration) {
234
234
  const expiresAt = Date.parse(result.expiration);
235
235
  if (Number.isFinite(expiresAt)) {
236
- const ttlSec = Math.floor((expiresAt - Date.now()) / 1000) - (5 * 60);
236
+ const ttlSec = Math.floor((expiresAt - Date.now()) / 1000) - (15 * 60);
237
237
  setEdgeCache(cacheKey, result, ttlSec).catch(() => { });
238
238
  }
239
239
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizamodo/aws-sts-core",
3
- "version": "0.3.15",
3
+ "version": "0.3.17",
4
4
  "description": "Pure AWS STS + SigV4 (X509 Roles Anywhere) core logic",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",