@vizamodo/aws-sts-core 0.3.48 → 0.3.49

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 +7 -14
  2. package/package.json +1 -1
package/dist/sts/issue.js CHANGED
@@ -58,28 +58,21 @@ async function getSigningMaterial(certBase64, privateKeyPkcs8Base64) {
58
58
  cachedPrivateKeyBase64 === privateKeyPkcs8Base64) {
59
59
  return cachedSigningKey;
60
60
  }
61
- // If material changed reset cached key + promise (once)
62
- if (cachedCertBase64 !== certBase64 ||
63
- cachedPrivateKeyBase64 !== privateKeyPkcs8Base64) {
64
- cachedSigningKey = null;
65
- signingKeyPromise = null;
66
- }
67
- // Deduplicate concurrent imports
61
+ // Material rotated discard stale state and re-import.
62
+ signingKeyPromise = null;
63
+ cachedSigningKey = null;
68
64
  if (!signingKeyPromise) {
69
65
  signingKeyPromise = crypto.subtle
70
66
  .importKey("pkcs8", base64ToBytes(privateKeyPkcs8Base64), { name: "ECDSA", namedCurve: "P-256" }, false, ["sign"])
71
- .then((key) => {
72
- cachedSigningKey = key;
73
- cachedCertBase64 = certBase64;
74
- cachedPrivateKeyBase64 = privateKeyPkcs8Base64;
75
- return key;
76
- })
77
67
  .catch(() => {
78
68
  signingKeyPromise = null; // allow retry
79
69
  throw new InternalError("invalid_signing_material");
80
70
  });
81
71
  }
82
- return signingKeyPromise;
72
+ cachedSigningKey = await signingKeyPromise;
73
+ cachedCertBase64 = certBase64;
74
+ cachedPrivateKeyBase64 = privateKeyPkcs8Base64;
75
+ return cachedSigningKey;
83
76
  }
84
77
  // ── Session TTL ────────────────────────────────────────────────────────────
85
78
  function resolveSessionTtl(profile) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizamodo/aws-sts-core",
3
- "version": "0.3.48",
3
+ "version": "0.3.49",
4
4
  "description": "Pure AWS STS + SigV4 (X509 Roles Anywhere) core logic",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",