@vizamodo/aws-sts-core 0.3.37 → 0.3.38

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.
@@ -13,7 +13,6 @@ export async function buildFederationLoginUrl(input) {
13
13
  const tokenHash = await sha256Hex(input.sessionToken);
14
14
  console.debug("[signin] key input", {
15
15
  accessKeyId: input.accessKeyId,
16
- sessionKey: input.secretAccessKey,
17
16
  tokenHash,
18
17
  intent: input.intent,
19
18
  region: input.region,
@@ -25,14 +24,14 @@ export async function buildFederationLoginUrl(input) {
25
24
  const SigninToken = await getCachedOrFetch(cacheKey, async () => {
26
25
  const tokenResp = await fetch(`https://signin.aws.amazon.com/federation?Action=getSigninToken&Session=${encoded}`);
27
26
  if (!tokenResp.ok) {
28
- // best-effort: skip cache, let caller retry upstream if needed
29
- return "";
27
+ // best-effort: do not cache failures
28
+ throw new Error("[signin] failed to fetch SigninToken");
30
29
  }
31
30
  const json = await tokenResp.json();
32
31
  const token = json?.SigninToken;
33
32
  if (!token) {
34
- // best-effort: skip cache
35
- return "";
33
+ // do not cache invalid response
34
+ throw new Error("[signin] empty SigninToken");
36
35
  }
37
36
  // SigninToken TTL ~15 minutes (AWS behavior)
38
37
  const SIGNIN_TOKEN_TTL_SEC = 15 * 60;
@@ -44,7 +43,7 @@ export async function buildFederationLoginUrl(input) {
44
43
  return token;
45
44
  }
46
45
  return wrapResult(token, new Date(Date.now() + effectiveTtlSec * 1000).toISOString());
47
- }, { ttlSec: 60, forceRefresh: input.forceRefresh } // allow caller-controlled retry
46
+ }, { ttlSec: 60, ...(input.forceRefresh !== undefined ? { forceRefresh: input.forceRefresh } : {}) } // allow caller-controlled retry
48
47
  );
49
48
  if (!SigninToken) {
50
49
  throw new Error("[federation] unable to obtain SigninToken");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizamodo/aws-sts-core",
3
- "version": "0.3.37",
3
+ "version": "0.3.38",
4
4
  "description": "Pure AWS STS + SigV4 (X509 Roles Anywhere) core logic",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",