@vizamodo/aws-sts-core 0.3.48 → 0.3.50
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.
- package/dist/sts/issue.js +17 -15
- 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
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
72
|
+
cachedSigningKey = await signingKeyPromise;
|
|
73
|
+
cachedCertBase64 = certBase64;
|
|
74
|
+
cachedPrivateKeyBase64 = privateKeyPkcs8Base64;
|
|
75
|
+
return cachedSigningKey;
|
|
83
76
|
}
|
|
84
77
|
// ── Session TTL ────────────────────────────────────────────────────────────
|
|
85
78
|
function resolveSessionTtl(profile) {
|
|
@@ -140,6 +133,10 @@ async function fetchCredentials(input) {
|
|
|
140
133
|
"X-Amz-X509": normalizedCert,
|
|
141
134
|
"Authorization": `${ALGORITHM} Credential=${certSerialDec}/${credentialScope}, SignedHeaders=${signedHeaders}, Signature=${signatureHex}`,
|
|
142
135
|
});
|
|
136
|
+
// 🔍 DEBUG signing output (temporary)
|
|
137
|
+
console.debug("[aws-debug] canonicalRequest", canonicalRequest);
|
|
138
|
+
console.debug("[aws-debug] stringToSign", stringToSign);
|
|
139
|
+
console.debug("[aws-debug] authorization", finalHeaders.get("Authorization"));
|
|
143
140
|
let res;
|
|
144
141
|
try {
|
|
145
142
|
res = await fetch(`https://${host}${PATH}`, {
|
|
@@ -153,7 +150,12 @@ async function fetchCredentials(input) {
|
|
|
153
150
|
throw new InternalError("aws_unreachable");
|
|
154
151
|
}
|
|
155
152
|
if (!res.ok) {
|
|
156
|
-
|
|
153
|
+
const text = await res.text().catch(() => "<no-body>");
|
|
154
|
+
console.error("[aws-rejected]", {
|
|
155
|
+
status: res.status,
|
|
156
|
+
body: text,
|
|
157
|
+
region,
|
|
158
|
+
});
|
|
157
159
|
throw new InternalError("aws_rejected");
|
|
158
160
|
}
|
|
159
161
|
const json = await res.json();
|