@parmana/crypto 0.0.0-stage → 0.1.0
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/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +16 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/ApprovalArtifactCrypto.d.ts +33 -0
- package/dist/ApprovalArtifactCrypto.d.ts.map +1 -0
- package/dist/ApprovalArtifactCrypto.js +54 -0
- package/dist/ApprovalArtifactCrypto.js.map +1 -0
- package/dist/ArtifactSigner.d.ts +22 -0
- package/dist/ArtifactSigner.d.ts.map +1 -0
- package/dist/ArtifactSigner.js +29 -0
- package/dist/ArtifactSigner.js.map +1 -0
- package/dist/AuditEventCrypto.d.ts +39 -0
- package/dist/AuditEventCrypto.d.ts.map +1 -0
- package/dist/AuditEventCrypto.js +57 -0
- package/dist/AuditEventCrypto.js.map +1 -0
- package/dist/AuthorizationSigner.d.ts +56 -0
- package/dist/AuthorizationSigner.d.ts.map +1 -0
- package/dist/AuthorizationSigner.js +103 -0
- package/dist/AuthorizationSigner.js.map +1 -0
- package/dist/AuthorizationVerifier.d.ts +53 -0
- package/dist/AuthorizationVerifier.d.ts.map +1 -0
- package/dist/AuthorizationVerifier.js +66 -0
- package/dist/AuthorizationVerifier.js.map +1 -0
- package/dist/CallerAuditChainVerifier.d.ts +62 -0
- package/dist/CallerAuditChainVerifier.d.ts.map +1 -0
- package/dist/CallerAuditChainVerifier.js +97 -0
- package/dist/CallerAuditChainVerifier.js.map +1 -0
- package/dist/CanonicalSerializer.d.ts +26 -0
- package/dist/CanonicalSerializer.d.ts.map +1 -0
- package/dist/CanonicalSerializer.js +78 -0
- package/dist/CanonicalSerializer.js.map +1 -0
- package/dist/CryptoBootstrap.d.ts +27 -0
- package/dist/CryptoBootstrap.d.ts.map +1 -0
- package/dist/CryptoBootstrap.js +70 -0
- package/dist/CryptoBootstrap.js.map +1 -0
- package/dist/CryptoBuilder.d.ts +27 -0
- package/dist/CryptoBuilder.d.ts.map +1 -0
- package/dist/CryptoBuilder.js +42 -0
- package/dist/CryptoBuilder.js.map +1 -0
- package/dist/ExecutableContentHasher.d.ts +22 -0
- package/dist/ExecutableContentHasher.d.ts.map +1 -0
- package/dist/ExecutableContentHasher.js +25 -0
- package/dist/ExecutableContentHasher.js.map +1 -0
- package/dist/ExecutionChainCrypto.d.ts +78 -0
- package/dist/ExecutionChainCrypto.d.ts.map +1 -0
- package/dist/ExecutionChainCrypto.js +165 -0
- package/dist/ExecutionChainCrypto.js.map +1 -0
- package/dist/ExecutionChainHasher.d.ts +10 -0
- package/dist/ExecutionChainHasher.d.ts.map +1 -0
- package/dist/ExecutionChainHasher.js +13 -0
- package/dist/ExecutionChainHasher.js.map +1 -0
- package/dist/ExecutionIntentCanonicalView.d.ts +28 -0
- package/dist/ExecutionIntentCanonicalView.d.ts.map +1 -0
- package/dist/ExecutionIntentCanonicalView.js +29 -0
- package/dist/ExecutionIntentCanonicalView.js.map +1 -0
- package/dist/ExecutionIntentCrypto.d.ts +21 -0
- package/dist/ExecutionIntentCrypto.d.ts.map +1 -0
- package/dist/ExecutionIntentCrypto.js +47 -0
- package/dist/ExecutionIntentCrypto.js.map +1 -0
- package/dist/ExecutionTrustRecordCanonicalView.d.ts +89 -0
- package/dist/ExecutionTrustRecordCanonicalView.d.ts.map +1 -0
- package/dist/ExecutionTrustRecordCanonicalView.js +106 -0
- package/dist/ExecutionTrustRecordCanonicalView.js.map +1 -0
- package/dist/HybridSignatureProvider.d.ts +48 -0
- package/dist/HybridSignatureProvider.d.ts.map +1 -0
- package/dist/HybridSignatureProvider.js +90 -0
- package/dist/HybridSignatureProvider.js.map +1 -0
- package/dist/KeyBootstrap.d.ts +23 -0
- package/dist/KeyBootstrap.d.ts.map +1 -0
- package/dist/KeyBootstrap.js +37 -0
- package/dist/KeyBootstrap.js.map +1 -0
- package/dist/KeyExpiry.d.ts +34 -0
- package/dist/KeyExpiry.d.ts.map +1 -0
- package/dist/KeyExpiry.js +66 -0
- package/dist/KeyExpiry.js.map +1 -0
- package/dist/KeyPair.d.ts +25 -0
- package/dist/KeyPair.d.ts.map +1 -0
- package/dist/KeyPair.js +37 -0
- package/dist/KeyPair.js.map +1 -0
- package/dist/KeyProvider.d.ts +98 -0
- package/dist/KeyProvider.d.ts.map +1 -0
- package/dist/KeyProvider.js +57 -0
- package/dist/KeyProvider.js.map +1 -0
- package/dist/KeyStore.d.ts +35 -0
- package/dist/KeyStore.d.ts.map +1 -0
- package/dist/KeyStore.js +2 -0
- package/dist/KeyStore.js.map +1 -0
- package/dist/OfflineVerifier.d.ts +74 -0
- package/dist/OfflineVerifier.d.ts.map +1 -0
- package/dist/OfflineVerifier.js +263 -0
- package/dist/OfflineVerifier.js.map +1 -0
- package/dist/PolicyChangeCrypto.d.ts +44 -0
- package/dist/PolicyChangeCrypto.d.ts.map +1 -0
- package/dist/PolicyChangeCrypto.js +79 -0
- package/dist/PolicyChangeCrypto.js.map +1 -0
- package/dist/PolicyChangeStepUpAuthorizationCrypto.d.ts +55 -0
- package/dist/PolicyChangeStepUpAuthorizationCrypto.d.ts.map +1 -0
- package/dist/PolicyChangeStepUpAuthorizationCrypto.js +107 -0
- package/dist/PolicyChangeStepUpAuthorizationCrypto.js.map +1 -0
- package/dist/ReceiptCrypto.d.ts +44 -0
- package/dist/ReceiptCrypto.d.ts.map +1 -0
- package/dist/ReceiptCrypto.js +84 -0
- package/dist/ReceiptCrypto.js.map +1 -0
- package/dist/ReceiptHasher.d.ts +10 -0
- package/dist/ReceiptHasher.d.ts.map +1 -0
- package/dist/ReceiptHasher.js +13 -0
- package/dist/ReceiptHasher.js.map +1 -0
- package/dist/RefusalCrypto.d.ts +35 -0
- package/dist/RefusalCrypto.d.ts.map +1 -0
- package/dist/RefusalCrypto.js +73 -0
- package/dist/RefusalCrypto.js.map +1 -0
- package/dist/SignatureCommitment.d.ts +33 -0
- package/dist/SignatureCommitment.d.ts.map +1 -0
- package/dist/SignatureCommitment.js +42 -0
- package/dist/SignatureCommitment.js.map +1 -0
- package/dist/SignatureVerifier.d.ts +20 -0
- package/dist/SignatureVerifier.d.ts.map +1 -0
- package/dist/SignatureVerifier.js +25 -0
- package/dist/SignatureVerifier.js.map +1 -0
- package/dist/Signer.d.ts +49 -0
- package/dist/Signer.d.ts.map +1 -0
- package/dist/Signer.js +2 -0
- package/dist/Signer.js.map +1 -0
- package/dist/SignerBootstrap.d.ts +37 -0
- package/dist/SignerBootstrap.d.ts.map +1 -0
- package/dist/SignerBootstrap.js +52 -0
- package/dist/SignerBootstrap.js.map +1 -0
- package/dist/TrustRecordHasher.d.ts +18 -0
- package/dist/TrustRecordHasher.d.ts.map +1 -0
- package/dist/TrustRecordHasher.js +23 -0
- package/dist/TrustRecordHasher.js.map +1 -0
- package/dist/VerificationCrypto.d.ts +132 -0
- package/dist/VerificationCrypto.d.ts.map +1 -0
- package/dist/VerificationCrypto.js +229 -0
- package/dist/VerificationCrypto.js.map +1 -0
- package/dist/errors/CryptoError.d.ts +14 -0
- package/dist/errors/CryptoError.d.ts.map +1 -0
- package/dist/errors/CryptoError.js +18 -0
- package/dist/errors/CryptoError.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/models/HybridCryptoProvider.d.ts +9 -0
- package/dist/models/HybridCryptoProvider.d.ts.map +1 -0
- package/dist/models/HybridCryptoProvider.js +2 -0
- package/dist/models/HybridCryptoProvider.js.map +1 -0
- package/dist/providers/CryptoProvider.d.ts +15 -0
- package/dist/providers/CryptoProvider.d.ts.map +1 -0
- package/dist/providers/CryptoProvider.js +2 -0
- package/dist/providers/CryptoProvider.js.map +1 -0
- package/dist/providers/HashProvider.d.ts +17 -0
- package/dist/providers/HashProvider.d.ts.map +1 -0
- package/dist/providers/HashProvider.js +2 -0
- package/dist/providers/HashProvider.js.map +1 -0
- package/dist/providers/HashRegistry.d.ts +11 -0
- package/dist/providers/HashRegistry.d.ts.map +1 -0
- package/dist/providers/HashRegistry.js +18 -0
- package/dist/providers/HashRegistry.js.map +1 -0
- package/dist/providers/ProviderFactory.d.ts +11 -0
- package/dist/providers/ProviderFactory.d.ts.map +1 -0
- package/dist/providers/ProviderFactory.js +13 -0
- package/dist/providers/ProviderFactory.js.map +1 -0
- package/dist/providers/SignatureProvider.d.ts +25 -0
- package/dist/providers/SignatureProvider.d.ts.map +1 -0
- package/dist/providers/SignatureProvider.js +2 -0
- package/dist/providers/SignatureProvider.js.map +1 -0
- package/dist/providers/SignatureRegistry.d.ts +11 -0
- package/dist/providers/SignatureRegistry.d.ts.map +1 -0
- package/dist/providers/SignatureRegistry.js +18 -0
- package/dist/providers/SignatureRegistry.js.map +1 -0
- package/dist/providers/SignerKeyProviderAdapter.d.ts +50 -0
- package/dist/providers/SignerKeyProviderAdapter.d.ts.map +1 -0
- package/dist/providers/SignerKeyProviderAdapter.js +66 -0
- package/dist/providers/SignerKeyProviderAdapter.js.map +1 -0
- package/dist/providers/hash/SHA256HashProvider.d.ts +10 -0
- package/dist/providers/hash/SHA256HashProvider.d.ts.map +1 -0
- package/dist/providers/hash/SHA256HashProvider.js +12 -0
- package/dist/providers/hash/SHA256HashProvider.js.map +1 -0
- package/dist/providers/key/FileKeyProvider.d.ts +85 -0
- package/dist/providers/key/FileKeyProvider.d.ts.map +1 -0
- package/dist/providers/key/FileKeyProvider.js +163 -0
- package/dist/providers/key/FileKeyProvider.js.map +1 -0
- package/dist/providers/signature/Dilithium3SignatureProvider.d.ts +23 -0
- package/dist/providers/signature/Dilithium3SignatureProvider.d.ts.map +1 -0
- package/dist/providers/signature/Dilithium3SignatureProvider.js +33 -0
- package/dist/providers/signature/Dilithium3SignatureProvider.js.map +1 -0
- package/dist/providers/signature/Ed25519SignatureProvider.d.ts +17 -0
- package/dist/providers/signature/Ed25519SignatureProvider.d.ts.map +1 -0
- package/dist/providers/signature/Ed25519SignatureProvider.js +40 -0
- package/dist/providers/signature/Ed25519SignatureProvider.js.map +1 -0
- package/dist/providers/signature/assertKeyType.d.ts +14 -0
- package/dist/providers/signature/assertKeyType.d.ts.map +1 -0
- package/dist/providers/signature/assertKeyType.js +19 -0
- package/dist/providers/signature/assertKeyType.js.map +1 -0
- package/dist/providers/signer/KmsSigner.d.ts +71 -0
- package/dist/providers/signer/KmsSigner.d.ts.map +1 -0
- package/dist/providers/signer/KmsSigner.js +270 -0
- package/dist/providers/signer/KmsSigner.js.map +1 -0
- package/dist/providers/signer/LocalFileSigner.d.ts +28 -0
- package/dist/providers/signer/LocalFileSigner.d.ts.map +1 -0
- package/dist/providers/signer/LocalFileSigner.js +38 -0
- package/dist/providers/signer/LocalFileSigner.js.map +1 -0
- package/dist/support/MlDsaSupport.d.ts +9 -0
- package/dist/support/MlDsaSupport.d.ts.map +1 -0
- package/dist/support/MlDsaSupport.js +23 -0
- package/dist/support/MlDsaSupport.js.map +1 -0
- package/package.json +45 -4
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { sign, verify } from "node:crypto";
|
|
2
|
+
import { SignatureAlgorithms } from "@parmana/shared";
|
|
3
|
+
import { assertKeyType } from "./assertKeyType.js";
|
|
4
|
+
import { commitmentMessage, requiresCommitment, } from "../../SignatureCommitment.js";
|
|
5
|
+
const NODE_KEY_TYPE = "ed25519";
|
|
6
|
+
/**
|
|
7
|
+
* Ed25519 Signature Provider.
|
|
8
|
+
*
|
|
9
|
+
* Stateless implementation of Ed25519 signing.
|
|
10
|
+
*
|
|
11
|
+
* Key management is delegated to a KeyProvider.
|
|
12
|
+
*/
|
|
13
|
+
export class Ed25519SignatureProvider {
|
|
14
|
+
algorithm = SignatureAlgorithms.ED25519;
|
|
15
|
+
constructor() {
|
|
16
|
+
Object.freeze(this);
|
|
17
|
+
}
|
|
18
|
+
async sign(data, privateKey) {
|
|
19
|
+
assertKeyType(privateKey, NODE_KEY_TYPE, "sign");
|
|
20
|
+
const signature = sign(null, Buffer.from(data), privateKey);
|
|
21
|
+
return signature.toString("base64");
|
|
22
|
+
}
|
|
23
|
+
async verify(data, signature, publicKey) {
|
|
24
|
+
assertKeyType(publicKey, NODE_KEY_TYPE, "verify");
|
|
25
|
+
const signatureBytes = Buffer.from(signature, "base64");
|
|
26
|
+
if (verify(null, Buffer.from(data), publicKey, signatureBytes)) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
//
|
|
30
|
+
// A message over the KMS raw limit may have been signed as a fixed
|
|
31
|
+
// size commitment (see SignatureCommitment.ts). Only for such large
|
|
32
|
+
// messages: a commitment signature over a small message is rejected.
|
|
33
|
+
//
|
|
34
|
+
if (requiresCommitment(data)) {
|
|
35
|
+
return verify(null, Buffer.from(commitmentMessage(data)), publicKey, signatureBytes);
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=Ed25519SignatureProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ed25519SignatureProvider.js","sourceRoot":"","sources":["../../../src/providers/signature/Ed25519SignatureProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAkB,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAA2B,MAAM,iBAAiB,CAAC;AAG/E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,OAAO,wBAAwB;IACnB,SAAS,GAAuB,mBAAmB,CAAC,OAAO,CAAC;IAE5E;QACE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAgB,EAAE,UAAqB;QAChD,aAAa,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;QAEjD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;QAE5D,OAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,MAAM,CACV,IAAgB,EAChB,SAAiB,EACjB,SAAoB;QAEpB,aAAa,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;QAElD,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAExD,IAAI,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,cAAc,CAAC,EAAE,CAAC;YAC/D,OAAO,IAAI,CAAC;QACd,CAAC;QAED,EAAE;QACF,mEAAmE;QACnE,oEAAoE;QACpE,qEAAqE;QACrE,EAAE;QACF,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,OAAO,MAAM,CACX,IAAI,EACJ,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,EACpC,SAAS,EACT,cAAc,CACf,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { KeyObject } from "node:crypto";
|
|
2
|
+
/**
|
|
3
|
+
* Asserts that a supplied KeyObject matches the
|
|
4
|
+
* signature provider's expected native key type.
|
|
5
|
+
*
|
|
6
|
+
* node:crypto's sign()/verify() dispatch on the key's
|
|
7
|
+
* own asymmetricKeyType, not on which SignatureProvider
|
|
8
|
+
* happens to be configured. Without this check, a
|
|
9
|
+
* dilithium3-configured process holding Ed25519 PEMs on
|
|
10
|
+
* disk would silently sign with Ed25519 while labeling
|
|
11
|
+
* the envelope "dilithium3".
|
|
12
|
+
*/
|
|
13
|
+
export declare function assertKeyType(key: KeyObject, expected: string, operation: "sign" | "verify"): void;
|
|
14
|
+
//# sourceMappingURL=assertKeyType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertKeyType.d.ts","sourceRoot":"","sources":["../../../src/providers/signature/assertKeyType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,QAAQ,GAC3B,IAAI,CAON"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CryptoError } from "../../errors/CryptoError.js";
|
|
2
|
+
/**
|
|
3
|
+
* Asserts that a supplied KeyObject matches the
|
|
4
|
+
* signature provider's expected native key type.
|
|
5
|
+
*
|
|
6
|
+
* node:crypto's sign()/verify() dispatch on the key's
|
|
7
|
+
* own asymmetricKeyType, not on which SignatureProvider
|
|
8
|
+
* happens to be configured. Without this check, a
|
|
9
|
+
* dilithium3-configured process holding Ed25519 PEMs on
|
|
10
|
+
* disk would silently sign with Ed25519 while labeling
|
|
11
|
+
* the envelope "dilithium3".
|
|
12
|
+
*/
|
|
13
|
+
export function assertKeyType(key, expected, operation) {
|
|
14
|
+
if (key.asymmetricKeyType !== expected) {
|
|
15
|
+
throw new CryptoError(`${operation}() expected a "${expected}" key but received "${key.asymmetricKeyType}". ` +
|
|
16
|
+
"The configured signature algorithm does not match the supplied key material.");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=assertKeyType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertKeyType.js","sourceRoot":"","sources":["../../../src/providers/signature/assertKeyType.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAC3B,GAAc,EACd,QAAgB,EAChB,SAA4B;IAE5B,IAAI,GAAG,CAAC,iBAAiB,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,IAAI,WAAW,CACnB,GAAG,SAAS,kBAAkB,QAAQ,uBAAuB,GAAG,CAAC,iBAAiB,KAAK;YACrF,8EAA8E,CACjF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type KeyObject } from "node:crypto";
|
|
2
|
+
import { type KeyMetadata } from "../../KeyProvider.js";
|
|
3
|
+
import type { Signer } from "../../Signer.js";
|
|
4
|
+
/**
|
|
5
|
+
* How long a public key or a DescribeKey answer is reused before KMS is
|
|
6
|
+
* asked again. Only successful answers are cached: a missing key or a
|
|
7
|
+
* failed call is never remembered, so creating an alias takes effect on
|
|
8
|
+
* the next request. Five minutes bounds how long a repointed alias can
|
|
9
|
+
* keep serving its previous key's public key.
|
|
10
|
+
*/
|
|
11
|
+
export declare const KMS_KEY_CACHE_TTL_MS: number;
|
|
12
|
+
/**
|
|
13
|
+
* Maps a Parmana logical keyId (e.g. "default", "tenant.acme") to the
|
|
14
|
+
* identifier AWS KMS's own APIs actually accept -- a key ID (UUID), a
|
|
15
|
+
* full ARN, or an alias name/ARN (which must carry the "alias/"
|
|
16
|
+
* prefix). Every call site in this codebase passes a bare logical
|
|
17
|
+
* keyId straight from KeyProvider.DEFAULT_KEY_ID / TenantKeyResolver
|
|
18
|
+
* (e.g. "default", "tenant.acme"); none of those are valid KMS
|
|
19
|
+
* identifiers on their own, so passing them through unchanged (this
|
|
20
|
+
* class's original behavior) always fails against real AWS with
|
|
21
|
+
* ValidationException/NotFoundException. Mirrors FileKeyProvider's own
|
|
22
|
+
* keyId -> "<keyId>.private.pem" filename convention: here, keyId ->
|
|
23
|
+
* "alias/<keyId>", with each "." replaced by "/" because KMS alias
|
|
24
|
+
* names allow letters, digits, "/", "_" and "-" but not ".". So the
|
|
25
|
+
* tenant key "tenant.acme" is "alias/tenant/acme". A logical keyId
|
|
26
|
+
* never contains "/", so the mapping cannot make two keyIds collide.
|
|
27
|
+
* An explicit "alias/<name>" is passed through unchanged, so it is
|
|
28
|
+
* never double-prefixed. An alias under AWS's reserved "alias/aws/"
|
|
29
|
+
* prefix is refused.
|
|
30
|
+
*
|
|
31
|
+
* A full ARN is refused, and a UUID shaped keyId is treated as an
|
|
32
|
+
* alias name like any other logical id, never as a raw key ID. A keyId often comes
|
|
33
|
+
* from the artifact being verified (a record's signature.keyId, a
|
|
34
|
+
* request body on POST /audit/verify or /refusal/verify), and an ARN
|
|
35
|
+
* can name a key in another AWS account: one whose key policy lets
|
|
36
|
+
* anyone read its public key would make a record signed by that key
|
|
37
|
+
* verify as valid. An alias always resolves in this deployment's own
|
|
38
|
+
* account and region.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveKmsKeyId(keyId: string): string;
|
|
41
|
+
export declare class KmsSigner implements Signer {
|
|
42
|
+
private readonly client;
|
|
43
|
+
private readonly region;
|
|
44
|
+
private constructor();
|
|
45
|
+
/**
|
|
46
|
+
* Async factory, not a plain constructor: resolving credentials may
|
|
47
|
+
* require a dynamic `import()` of the optional
|
|
48
|
+
* @vercel/oidc-aws-credentials-provider peer dependency (this
|
|
49
|
+
* package is ESM; there is no synchronous `require()` available to
|
|
50
|
+
* load it lazily).
|
|
51
|
+
*/
|
|
52
|
+
static create(region?: string): Promise<KmsSigner>;
|
|
53
|
+
sign(keyId: string, data: Uint8Array): Promise<string>;
|
|
54
|
+
getPublicKey(keyId: string): Promise<KeyObject>;
|
|
55
|
+
getMetadata(keyId: string): Promise<KeyMetadata>;
|
|
56
|
+
private cacheKey;
|
|
57
|
+
private describeKeySpec;
|
|
58
|
+
/**
|
|
59
|
+
* The signing keys this deployment publishes: the default key and the
|
|
60
|
+
* current verification key (PARMANA_VERIFICATION_KEY_ID), each only
|
|
61
|
+
* if its alias exists. KMS has no cheap, scoped way to enumerate every
|
|
62
|
+
* key in an account, and an account wide list would publish keys that
|
|
63
|
+
* have nothing to do with Parmana, so this lists the logical ids this
|
|
64
|
+
* process signs with. Lets GET /.well-known/jwks.json answer under
|
|
65
|
+
* KEY_PROVIDER=aws-kms instead of 501. A record signed under an older
|
|
66
|
+
* PARMANA_VERIFICATION_KEY_ID is still served by GET /keys/:keyId.
|
|
67
|
+
*/
|
|
68
|
+
listKeys(): Promise<string[]>;
|
|
69
|
+
hasKey(keyId: string): Promise<boolean>;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=KmsSigner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KmsSigner.d.ts","sourceRoot":"","sources":["../../../src/providers/signer/KmsSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAY9D,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAsB9C;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,QAAgB,CAAC;AAQlD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAsBrD;AA4CD,qBAAa,SAAU,YAAW,MAAM;IAEpC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFzB,OAAO,eAGH;IAEJ;;;;;;OAMG;IACH,OAAa,MAAM,CAAC,MAAM,GAAE,MAAwB,GAAG,OAAO,CAAC,SAAS,CAAC,CAUxE;IAEK,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAuB3D;IAEK,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAoBpD;IAEK,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAOrD;IAED,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,eAAe;IAUvB;;;;;;;;;OASG;IACG,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAYlC;IAEK,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAoB5C;CACF"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { createPublicKey } from "node:crypto";
|
|
2
|
+
import { DescribeKeyCommand, GetPublicKeyCommand, KMSClient, NotFoundException, SignCommand, } from "@aws-sdk/client-kms";
|
|
3
|
+
import { SignatureAlgorithms } from "@parmana/shared";
|
|
4
|
+
import { DEFAULT_KEY_ID, currentVerificationKeyId, } from "../../KeyProvider.js";
|
|
5
|
+
import { CryptoError } from "../../errors/CryptoError.js";
|
|
6
|
+
import { commitmentMessage, requiresCommitment, } from "../../SignatureCommitment.js";
|
|
7
|
+
/**
|
|
8
|
+
* The only KMS key spec / signing algorithm pair this class supports
|
|
9
|
+
* today, matching Parmana's existing PRIMARY_SIGNATURE_PROVIDER=ed25519
|
|
10
|
+
* default -- AWS KMS added Ed25519 support (ECC_NIST_EDWARDS25519 /
|
|
11
|
+
* ED25519_SHA_512, MessageType RAW) in November 2025, so no signature
|
|
12
|
+
* algorithm migration is needed to adopt it (ADR-0009).
|
|
13
|
+
*/
|
|
14
|
+
const SUPPORTED_KEY_SPEC = "ECC_NIST_EDWARDS25519";
|
|
15
|
+
const SIGNING_ALGORITHM = "ED25519_SHA_512";
|
|
16
|
+
/**
|
|
17
|
+
* A Parmana logical keyId: the same characters FileKeyProvider accepts.
|
|
18
|
+
*/
|
|
19
|
+
const LOGICAL_KEY_ID_PATTERN = /^[A-Za-z0-9._-]+$/;
|
|
20
|
+
/**
|
|
21
|
+
* How long a public key or a DescribeKey answer is reused before KMS is
|
|
22
|
+
* asked again. Only successful answers are cached: a missing key or a
|
|
23
|
+
* failed call is never remembered, so creating an alias takes effect on
|
|
24
|
+
* the next request. Five minutes bounds how long a repointed alias can
|
|
25
|
+
* keep serving its previous key's public key.
|
|
26
|
+
*/
|
|
27
|
+
export const KMS_KEY_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
28
|
+
/**
|
|
29
|
+
* AWS reserves alias names starting with "alias/aws/" for AWS managed
|
|
30
|
+
* keys, which never sign for Parmana.
|
|
31
|
+
*/
|
|
32
|
+
const RESERVED_ALIAS_PREFIX = "alias/aws/";
|
|
33
|
+
/**
|
|
34
|
+
* Maps a Parmana logical keyId (e.g. "default", "tenant.acme") to the
|
|
35
|
+
* identifier AWS KMS's own APIs actually accept -- a key ID (UUID), a
|
|
36
|
+
* full ARN, or an alias name/ARN (which must carry the "alias/"
|
|
37
|
+
* prefix). Every call site in this codebase passes a bare logical
|
|
38
|
+
* keyId straight from KeyProvider.DEFAULT_KEY_ID / TenantKeyResolver
|
|
39
|
+
* (e.g. "default", "tenant.acme"); none of those are valid KMS
|
|
40
|
+
* identifiers on their own, so passing them through unchanged (this
|
|
41
|
+
* class's original behavior) always fails against real AWS with
|
|
42
|
+
* ValidationException/NotFoundException. Mirrors FileKeyProvider's own
|
|
43
|
+
* keyId -> "<keyId>.private.pem" filename convention: here, keyId ->
|
|
44
|
+
* "alias/<keyId>", with each "." replaced by "/" because KMS alias
|
|
45
|
+
* names allow letters, digits, "/", "_" and "-" but not ".". So the
|
|
46
|
+
* tenant key "tenant.acme" is "alias/tenant/acme". A logical keyId
|
|
47
|
+
* never contains "/", so the mapping cannot make two keyIds collide.
|
|
48
|
+
* An explicit "alias/<name>" is passed through unchanged, so it is
|
|
49
|
+
* never double-prefixed. An alias under AWS's reserved "alias/aws/"
|
|
50
|
+
* prefix is refused.
|
|
51
|
+
*
|
|
52
|
+
* A full ARN is refused, and a UUID shaped keyId is treated as an
|
|
53
|
+
* alias name like any other logical id, never as a raw key ID. A keyId often comes
|
|
54
|
+
* from the artifact being verified (a record's signature.keyId, a
|
|
55
|
+
* request body on POST /audit/verify or /refusal/verify), and an ARN
|
|
56
|
+
* can name a key in another AWS account: one whose key policy lets
|
|
57
|
+
* anyone read its public key would make a record signed by that key
|
|
58
|
+
* verify as valid. An alias always resolves in this deployment's own
|
|
59
|
+
* account and region.
|
|
60
|
+
*/
|
|
61
|
+
export function resolveKmsKeyId(keyId) {
|
|
62
|
+
let alias;
|
|
63
|
+
if (keyId.startsWith("alias/")) {
|
|
64
|
+
const name = keyId.slice("alias/".length);
|
|
65
|
+
if (name !== "" && LOGICAL_KEY_ID_PATTERN.test(name.replace(/\//g, ""))) {
|
|
66
|
+
alias = keyId;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else if (LOGICAL_KEY_ID_PATTERN.test(keyId)) {
|
|
70
|
+
alias = `alias/${keyId.replace(/\./g, "/")}`;
|
|
71
|
+
}
|
|
72
|
+
if (alias !== undefined && !alias.startsWith(RESERVED_ALIAS_PREFIX)) {
|
|
73
|
+
return alias;
|
|
74
|
+
}
|
|
75
|
+
throw new CryptoError(`Invalid KMS keyId ${JSON.stringify(keyId)}: expected a logical key id ` +
|
|
76
|
+
'(for example "default" or "tenant.acme") or an "alias/" name. ' +
|
|
77
|
+
'A key ARN is not accepted, nor an "alias/aws/" name.');
|
|
78
|
+
}
|
|
79
|
+
function algorithmFromKeySpec(keySpec) {
|
|
80
|
+
if (keySpec === SUPPORTED_KEY_SPEC) {
|
|
81
|
+
return SignatureAlgorithms.ED25519;
|
|
82
|
+
}
|
|
83
|
+
throw new CryptoError(`KmsSigner only supports ${SUPPORTED_KEY_SPEC} keys; got KeySpec=${JSON.stringify(keySpec)}.`);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* AWS KMS Signer.
|
|
87
|
+
*
|
|
88
|
+
* Sign-without-release: the private key material for an asymmetric
|
|
89
|
+
* KMS key never leaves KMS -- this class only ever calls the Sign and
|
|
90
|
+
* GetPublicKey APIs, never anything that would export key material.
|
|
91
|
+
* A fully compromised process holding valid AWS credentials for this
|
|
92
|
+
* key can request signatures, but cannot exfiltrate the key itself,
|
|
93
|
+
* unlike LocalFileSigner/FileKeyProvider.
|
|
94
|
+
*
|
|
95
|
+
* Credentials: no static AWS access keys. If AWS_ROLE_ARN is set, uses
|
|
96
|
+
* @vercel/oidc-aws-credentials-provider to exchange Vercel's
|
|
97
|
+
* per-invocation OIDC token for short-lived STS credentials (first-
|
|
98
|
+
* party, vercel.com/docs/oidc/aws). Otherwise falls back to the AWS
|
|
99
|
+
* SDK's own default credential provider chain (~/.aws/credentials
|
|
100
|
+
* locally, an instance/task role elsewhere) -- this class never reads
|
|
101
|
+
* or accepts a static access key/secret pair.
|
|
102
|
+
*/
|
|
103
|
+
/**
|
|
104
|
+
* Successful GetPublicKey and DescribeKey answers, by region and
|
|
105
|
+
* resolved KMS alias, for KMS_KEY_CACHE_TTL_MS. Module level, not per
|
|
106
|
+
* instance, because SignerBootstrap builds a new KmsSigner for each
|
|
107
|
+
* call (GET /keys/:keyId does so per request). Those routes and
|
|
108
|
+
* GET /.well-known/jwks.json are unauthenticated, and every
|
|
109
|
+
* verification looks up a public key, so without this each request
|
|
110
|
+
* cost up to three KMS calls against the account's shared quota.
|
|
111
|
+
* Concurrent lookups of the same key share one call. Sign is never
|
|
112
|
+
* cached.
|
|
113
|
+
*/
|
|
114
|
+
const publicKeyCache = new Map();
|
|
115
|
+
const keySpecCache = new Map();
|
|
116
|
+
export class KmsSigner {
|
|
117
|
+
client;
|
|
118
|
+
region;
|
|
119
|
+
constructor(client, region) {
|
|
120
|
+
this.client = client;
|
|
121
|
+
this.region = region;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Async factory, not a plain constructor: resolving credentials may
|
|
125
|
+
* require a dynamic `import()` of the optional
|
|
126
|
+
* @vercel/oidc-aws-credentials-provider peer dependency (this
|
|
127
|
+
* package is ESM; there is no synchronous `require()` available to
|
|
128
|
+
* load it lazily).
|
|
129
|
+
*/
|
|
130
|
+
static async create(region = requireRegion()) {
|
|
131
|
+
const credentials = await resolveCredentials();
|
|
132
|
+
return new KmsSigner(new KMSClient({
|
|
133
|
+
region,
|
|
134
|
+
...(credentials !== undefined ? { credentials } : {}),
|
|
135
|
+
}), region);
|
|
136
|
+
}
|
|
137
|
+
async sign(keyId, data) {
|
|
138
|
+
//
|
|
139
|
+
// KMS rejects a raw Ed25519 message over 4096 bytes. A larger message
|
|
140
|
+
// (for example a full Execution Trust Record) is signed as a fixed
|
|
141
|
+
// size commitment instead, see SignatureCommitment.ts. Messages at or
|
|
142
|
+
// below the limit are signed raw, unchanged.
|
|
143
|
+
//
|
|
144
|
+
const message = requiresCommitment(data) ? commitmentMessage(data) : data;
|
|
145
|
+
const response = await this.client.send(new SignCommand({
|
|
146
|
+
KeyId: resolveKmsKeyId(keyId),
|
|
147
|
+
Message: message,
|
|
148
|
+
MessageType: "RAW",
|
|
149
|
+
SigningAlgorithm: SIGNING_ALGORITHM,
|
|
150
|
+
}));
|
|
151
|
+
if (!response.Signature) {
|
|
152
|
+
throw new CryptoError(`KMS Sign returned no signature for key ${keyId}.`);
|
|
153
|
+
}
|
|
154
|
+
return Buffer.from(response.Signature).toString("base64");
|
|
155
|
+
}
|
|
156
|
+
async getPublicKey(keyId) {
|
|
157
|
+
const kmsKeyId = resolveKmsKeyId(keyId);
|
|
158
|
+
return cached(publicKeyCache, this.cacheKey(kmsKeyId), async () => {
|
|
159
|
+
const response = await this.client.send(new GetPublicKeyCommand({ KeyId: kmsKeyId }));
|
|
160
|
+
if (!response.PublicKey) {
|
|
161
|
+
throw new CryptoError(`KMS GetPublicKey returned no key material for ${keyId}.`);
|
|
162
|
+
}
|
|
163
|
+
return createPublicKey({
|
|
164
|
+
key: Buffer.from(response.PublicKey),
|
|
165
|
+
format: "der",
|
|
166
|
+
type: "spki",
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
async getMetadata(keyId) {
|
|
171
|
+
return {
|
|
172
|
+
keyId,
|
|
173
|
+
algorithm: algorithmFromKeySpec(await this.describeKeySpec(resolveKmsKeyId(keyId))),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
cacheKey(kmsKeyId) {
|
|
177
|
+
return `${this.region}\u0000${kmsKeyId}`;
|
|
178
|
+
}
|
|
179
|
+
describeKeySpec(kmsKeyId) {
|
|
180
|
+
return cached(keySpecCache, this.cacheKey(kmsKeyId), async () => {
|
|
181
|
+
const response = await this.client.send(new DescribeKeyCommand({ KeyId: kmsKeyId }));
|
|
182
|
+
return response.KeyMetadata?.KeySpec;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* The signing keys this deployment publishes: the default key and the
|
|
187
|
+
* current verification key (PARMANA_VERIFICATION_KEY_ID), each only
|
|
188
|
+
* if its alias exists. KMS has no cheap, scoped way to enumerate every
|
|
189
|
+
* key in an account, and an account wide list would publish keys that
|
|
190
|
+
* have nothing to do with Parmana, so this lists the logical ids this
|
|
191
|
+
* process signs with. Lets GET /.well-known/jwks.json answer under
|
|
192
|
+
* KEY_PROVIDER=aws-kms instead of 501. A record signed under an older
|
|
193
|
+
* PARMANA_VERIFICATION_KEY_ID is still served by GET /keys/:keyId.
|
|
194
|
+
*/
|
|
195
|
+
async listKeys() {
|
|
196
|
+
const candidates = [
|
|
197
|
+
...new Set([DEFAULT_KEY_ID, currentVerificationKeyId()]),
|
|
198
|
+
];
|
|
199
|
+
const present = await Promise.all(candidates.map(async (keyId) => (await this.hasKey(keyId)) ? keyId : undefined));
|
|
200
|
+
return present.filter((keyId) => keyId !== undefined);
|
|
201
|
+
}
|
|
202
|
+
async hasKey(keyId) {
|
|
203
|
+
let kmsKeyId;
|
|
204
|
+
try {
|
|
205
|
+
kmsKeyId = resolveKmsKeyId(keyId);
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
await this.describeKeySpec(kmsKeyId);
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
if (error instanceof NotFoundException) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
throw error;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Returns the cached answer for `key` while it is fresh, otherwise
|
|
224
|
+
* loads it. The pending promise is stored at once so concurrent callers
|
|
225
|
+
* share one load, and removed again if the load fails, so a failure is
|
|
226
|
+
* never served from the cache.
|
|
227
|
+
*/
|
|
228
|
+
function cached(cache, key, load) {
|
|
229
|
+
const now = Date.now();
|
|
230
|
+
const entry = cache.get(key);
|
|
231
|
+
if (entry !== undefined && entry.expiresAt > now) {
|
|
232
|
+
return entry.value;
|
|
233
|
+
}
|
|
234
|
+
const value = load();
|
|
235
|
+
cache.set(key, { value, expiresAt: now + KMS_KEY_CACHE_TTL_MS });
|
|
236
|
+
value.catch(() => {
|
|
237
|
+
if (cache.get(key)?.value === value) {
|
|
238
|
+
cache.delete(key);
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
return value;
|
|
242
|
+
}
|
|
243
|
+
function requireRegion() {
|
|
244
|
+
const region = process.env.AWS_REGION;
|
|
245
|
+
if (!region) {
|
|
246
|
+
throw new CryptoError("KmsSigner requires AWS_REGION to be set.");
|
|
247
|
+
}
|
|
248
|
+
return region;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Resolves AWS credentials without ever accepting a static access
|
|
252
|
+
* key/secret pair from this codebase's own configuration. When
|
|
253
|
+
* AWS_ROLE_ARN is set, exchanges Vercel's OIDC token for short-lived
|
|
254
|
+
* STS credentials; @vercel/oidc-aws-credentials-provider is an
|
|
255
|
+
* optional peer dependency, dynamically imported so environments that
|
|
256
|
+
* don't use Vercel OIDC federation (and haven't installed it) aren't
|
|
257
|
+
* affected.
|
|
258
|
+
*/
|
|
259
|
+
async function resolveCredentials() {
|
|
260
|
+
const roleArn = process.env.AWS_ROLE_ARN;
|
|
261
|
+
if (!roleArn) {
|
|
262
|
+
// undefined defers to the AWS SDK's own default credential
|
|
263
|
+
// provider chain (~/.aws/credentials locally, an instance/task
|
|
264
|
+
// role elsewhere).
|
|
265
|
+
return undefined;
|
|
266
|
+
}
|
|
267
|
+
const { awsCredentialsProvider } = await import("@vercel/oidc-aws-credentials-provider");
|
|
268
|
+
return awsCredentialsProvider({ roleArn });
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=KmsSigner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KmsSigner.js","sourceRoot":"","sources":["../../../src/providers/signer/KmsSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkB,MAAM,aAAa,CAAC;AAE9D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,SAAS,EACT,iBAAiB,EACjB,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAA2B,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EACL,cAAc,EACd,wBAAwB,GAEzB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EACL,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AACnD,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAElD;;;GAGG;AACH,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,IAAI,KAAyB,CAAC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K,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,GAAG,oBAAoB,EAAE,CAAC,CAAC;IAEjE,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE;QACf,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,KAAK,EAAE,CAAC;YACpC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,aAAa;IACpB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;IAEtC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,WAAW,CAAC,0CAA0C,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;GAQG;AACH,KAAK,UAAU,kBAAkB;IAQ/B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAEzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,2DAA2D;QAC3D,+DAA+D;QAC/D,mBAAmB;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,EAAE,sBAAsB,EAAE,GAC9B,MAAM,MAAM,CAAC,uCAAuC,CAAC,CAAC;IAExD,OAAO,sBAAsB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { KeyObject } from "node:crypto";
|
|
2
|
+
import type { KeyMetadata } from "../../KeyProvider.js";
|
|
3
|
+
import type { Signer } from "../../Signer.js";
|
|
4
|
+
import type { CryptoProvider } from "../CryptoProvider.js";
|
|
5
|
+
import { FileKeyProvider } from "../key/FileKeyProvider.js";
|
|
6
|
+
/**
|
|
7
|
+
* Local File Signer.
|
|
8
|
+
*
|
|
9
|
+
* Signer backend over FileKeyProvider -- private key material lives
|
|
10
|
+
* on local disk, exactly as every signing call site behaved before
|
|
11
|
+
* ADR-0009. sign() reproduces today's "getPrivateKey() then
|
|
12
|
+
* SignatureProvider.sign()" sequence byte-for-byte, so switching
|
|
13
|
+
* KEY_PROVIDER away from "local" is the only thing that changes
|
|
14
|
+
* behavior; this class exists so the 7+ call sites that used to do
|
|
15
|
+
* that two-step themselves can instead depend on the Signer interface
|
|
16
|
+
* uniformly, regardless of which concrete backend is configured.
|
|
17
|
+
*/
|
|
18
|
+
export declare class LocalFileSigner implements Signer {
|
|
19
|
+
private readonly crypto;
|
|
20
|
+
private readonly keys;
|
|
21
|
+
constructor(crypto: CryptoProvider, keys?: FileKeyProvider);
|
|
22
|
+
sign(keyId: string, data: Uint8Array): Promise<string>;
|
|
23
|
+
getPublicKey(keyId: string): Promise<KeyObject>;
|
|
24
|
+
getMetadata(keyId: string): Promise<KeyMetadata>;
|
|
25
|
+
hasKey(keyId: string): Promise<boolean>;
|
|
26
|
+
listKeys(): Promise<string[]>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=LocalFileSigner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalFileSigner.d.ts","sourceRoot":"","sources":["../../../src/providers/signer/LocalFileSigner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;;;;;;;;;;GAWG;AACH,qBAAa,eAAgB,YAAW,MAAM;IAE1C,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFvB,YACmB,MAAM,EAAE,cAAc,EACtB,IAAI,GAAE,eAAuC,EAC5D;IAEE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAI3D;IAEK,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAEpD;IAEK,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAErD;IAEK,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE5C;IAEK,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAElC;CACF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FileKeyProvider } from "../key/FileKeyProvider.js";
|
|
2
|
+
/**
|
|
3
|
+
* Local File Signer.
|
|
4
|
+
*
|
|
5
|
+
* Signer backend over FileKeyProvider -- private key material lives
|
|
6
|
+
* on local disk, exactly as every signing call site behaved before
|
|
7
|
+
* ADR-0009. sign() reproduces today's "getPrivateKey() then
|
|
8
|
+
* SignatureProvider.sign()" sequence byte-for-byte, so switching
|
|
9
|
+
* KEY_PROVIDER away from "local" is the only thing that changes
|
|
10
|
+
* behavior; this class exists so the 7+ call sites that used to do
|
|
11
|
+
* that two-step themselves can instead depend on the Signer interface
|
|
12
|
+
* uniformly, regardless of which concrete backend is configured.
|
|
13
|
+
*/
|
|
14
|
+
export class LocalFileSigner {
|
|
15
|
+
crypto;
|
|
16
|
+
keys;
|
|
17
|
+
constructor(crypto, keys = new FileKeyProvider()) {
|
|
18
|
+
this.crypto = crypto;
|
|
19
|
+
this.keys = keys;
|
|
20
|
+
}
|
|
21
|
+
async sign(keyId, data) {
|
|
22
|
+
const privateKey = await this.keys.getPrivateKey(keyId);
|
|
23
|
+
return this.crypto.signature.sign(data, privateKey);
|
|
24
|
+
}
|
|
25
|
+
async getPublicKey(keyId) {
|
|
26
|
+
return this.keys.getPublicKey(keyId);
|
|
27
|
+
}
|
|
28
|
+
async getMetadata(keyId) {
|
|
29
|
+
return this.keys.getMetadata(keyId);
|
|
30
|
+
}
|
|
31
|
+
async hasKey(keyId) {
|
|
32
|
+
return this.keys.hasKey(keyId);
|
|
33
|
+
}
|
|
34
|
+
async listKeys() {
|
|
35
|
+
return this.keys.listKeys();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=LocalFileSigner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalFileSigner.js","sourceRoot":"","sources":["../../../src/providers/signer/LocalFileSigner.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,eAAe;IAEP,MAAM;IACN,IAAI;IAFvB,YACmB,MAAsB,EACtB,IAAI,GAAoB,IAAI,eAAe,EAAE;sBAD7C,MAAM;oBACN,IAAI;IACpB,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,KAAa,EAAE,IAAgB;QACxC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAExD,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,KAAa;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects at runtime whether the current Node/OpenSSL build supports
|
|
3
|
+
* ML-DSA-65 (generateKeyPairSync("ml-dsa-65")). Requires Node >=24 with
|
|
4
|
+
* OpenSSL >=3.5; older runtimes throw synchronously. Cached after the
|
|
5
|
+
* first call since the answer cannot change within a process lifetime.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isMlDsa65Supported(): boolean;
|
|
8
|
+
export declare const ML_DSA_65_SKIP_REASON = "ml-dsa-65 unsupported on this Node/OpenSSL build (requires Node >=24 with OpenSSL >=3.5)";
|
|
9
|
+
//# sourceMappingURL=MlDsaSupport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MlDsaSupport.d.ts","sourceRoot":"","sources":["../../src/support/MlDsaSupport.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAa5C;AAED,eAAO,MAAM,qBAAqB,6FAC0D,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { generateKeyPairSync } from "node:crypto";
|
|
2
|
+
let cached;
|
|
3
|
+
/**
|
|
4
|
+
* Detects at runtime whether the current Node/OpenSSL build supports
|
|
5
|
+
* ML-DSA-65 (generateKeyPairSync("ml-dsa-65")). Requires Node >=24 with
|
|
6
|
+
* OpenSSL >=3.5; older runtimes throw synchronously. Cached after the
|
|
7
|
+
* first call since the answer cannot change within a process lifetime.
|
|
8
|
+
*/
|
|
9
|
+
export function isMlDsa65Supported() {
|
|
10
|
+
if (cached !== undefined) {
|
|
11
|
+
return cached;
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
generateKeyPairSync("ml-dsa-65");
|
|
15
|
+
cached = true;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
cached = false;
|
|
19
|
+
}
|
|
20
|
+
return cached;
|
|
21
|
+
}
|
|
22
|
+
export const ML_DSA_65_SKIP_REASON = "ml-dsa-65 unsupported on this Node/OpenSSL build (requires Node >=24 with OpenSSL >=3.5)";
|
|
23
|
+
//# sourceMappingURL=MlDsaSupport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MlDsaSupport.js","sourceRoot":"","sources":["../../src/support/MlDsaSupport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,IAAI,MAA2B,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,CAAC;QACH,mBAAmB,CAAC,WAAW,CAAC,CAAC;QACjC,MAAM,GAAG,IAAI,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAChC,0FAA0F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parmana/crypto",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Parmana Crypto Module",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"NOTICE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
21
|
+
"build": "tsc -p tsconfig.json",
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"test": "vitest run"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@aws-sdk/client-kms": "^3.1155.0",
|
|
27
|
+
"@parmana/shared": "0.1.0",
|
|
28
|
+
"@vercel/oidc-aws-credentials-provider": "^3.3.14",
|
|
29
|
+
"express": "^5.3.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@eslint/js": "^10.0.1",
|
|
33
|
+
"@types/express": "^5.0.6",
|
|
34
|
+
"@types/node": "^24.19.2",
|
|
35
|
+
"dotenv": "^18.0.8",
|
|
36
|
+
"eslint": "^10.13.0",
|
|
37
|
+
"eslint-config-prettier": "^10.1.8",
|
|
38
|
+
"tsx": "^4.23.15",
|
|
39
|
+
"typescript": "^6.0.3",
|
|
40
|
+
"typescript-eslint": "^8.72.0",
|
|
41
|
+
"vitest": "^5.0.3"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=24"
|
|
45
|
+
},
|
|
46
|
+
"license": "Apache-2.0"
|
|
47
|
+
}
|