@clef-sh/runtime 0.1.6-beta.32
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/decrypt.d.ts +25 -0
- package/dist/decrypt.d.ts.map +1 -0
- package/dist/decrypt.js +82 -0
- package/dist/decrypt.js.map +1 -0
- package/dist/disk-cache.d.ts +22 -0
- package/dist/disk-cache.d.ts.map +1 -0
- package/dist/disk-cache.js +113 -0
- package/dist/disk-cache.js.map +1 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +165 -0
- package/dist/index.js.map +1 -0
- package/dist/kms/aws.d.ts +15 -0
- package/dist/kms/aws.d.ts.map +1 -0
- package/dist/kms/aws.js +92 -0
- package/dist/kms/aws.js.map +1 -0
- package/dist/kms/azure.d.ts +16 -0
- package/dist/kms/azure.d.ts.map +1 -0
- package/dist/kms/azure.js +85 -0
- package/dist/kms/azure.js.map +1 -0
- package/dist/kms/gcp.d.ts +17 -0
- package/dist/kms/gcp.d.ts.map +1 -0
- package/dist/kms/gcp.js +87 -0
- package/dist/kms/gcp.js.map +1 -0
- package/dist/kms/index.d.ts +12 -0
- package/dist/kms/index.d.ts.map +1 -0
- package/dist/kms/index.js +29 -0
- package/dist/kms/index.js.map +1 -0
- package/dist/kms/types.d.ts +10 -0
- package/dist/kms/types.d.ts.map +1 -0
- package/dist/kms/types.js +3 -0
- package/dist/kms/types.js.map +1 -0
- package/dist/poller.d.ts +80 -0
- package/dist/poller.d.ts.map +1 -0
- package/dist/poller.js +329 -0
- package/dist/poller.js.map +1 -0
- package/dist/secrets-cache.d.ts +23 -0
- package/dist/secrets-cache.d.ts.map +1 -0
- package/dist/secrets-cache.js +51 -0
- package/dist/secrets-cache.js.map +1 -0
- package/dist/sources/file.d.ts +9 -0
- package/dist/sources/file.d.ts.map +1 -0
- package/dist/sources/file.js +53 -0
- package/dist/sources/file.js.map +1 -0
- package/dist/sources/http.d.ts +9 -0
- package/dist/sources/http.d.ts.map +1 -0
- package/dist/sources/http.js +24 -0
- package/dist/sources/http.js.map +1 -0
- package/dist/sources/index.d.ts +5 -0
- package/dist/sources/index.d.ts.map +1 -0
- package/dist/sources/index.js +10 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/sources/types.d.ts +15 -0
- package/dist/sources/types.d.ts.map +1 -0
- package/dist/sources/types.js +3 -0
- package/dist/sources/types.js.map +1 -0
- package/dist/sources/vcs.d.ts +13 -0
- package/dist/sources/vcs.d.ts.map +1 -0
- package/dist/sources/vcs.js +25 -0
- package/dist/sources/vcs.js.map +1 -0
- package/dist/telemetry.d.ts +129 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +192 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/vcs/bitbucket.d.ts +11 -0
- package/dist/vcs/bitbucket.d.ts.map +1 -0
- package/dist/vcs/bitbucket.js +43 -0
- package/dist/vcs/bitbucket.js.map +1 -0
- package/dist/vcs/github.d.ts +11 -0
- package/dist/vcs/github.d.ts.map +1 -0
- package/dist/vcs/github.js +35 -0
- package/dist/vcs/github.js.map +1 -0
- package/dist/vcs/gitlab.d.ts +11 -0
- package/dist/vcs/gitlab.d.ts.map +1 -0
- package/dist/vcs/gitlab.js +36 -0
- package/dist/vcs/gitlab.js.map +1 -0
- package/dist/vcs/index.d.ts +8 -0
- package/dist/vcs/index.d.ts.map +1 -0
- package/dist/vcs/index.js +27 -0
- package/dist/vcs/index.js.map +1 -0
- package/dist/vcs/types.d.ts +29 -0
- package/dist/vcs/types.d.ts.map +1 -0
- package/dist/vcs/types.js +3 -0
- package/dist/vcs/types.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { KmsProvider, KmsWrapResult } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Azure Key Vault provider for envelope encryption.
|
|
4
|
+
* Dynamically imports `@azure/keyvault-keys` and `@azure/identity` — both are optional dependencies.
|
|
5
|
+
*
|
|
6
|
+
* The keyId is the full Azure Key Vault key URL:
|
|
7
|
+
* https://{vault-name}.vault.azure.net/keys/{key-name}/{version?}
|
|
8
|
+
*/
|
|
9
|
+
export declare class AzureKmsProvider implements KmsProvider {
|
|
10
|
+
private credential;
|
|
11
|
+
private keysModule;
|
|
12
|
+
private ensureLoaded;
|
|
13
|
+
wrap(keyId: string, plaintext: Buffer): Promise<KmsWrapResult>;
|
|
14
|
+
unwrap(keyId: string, wrappedKey: Buffer, algorithm: string): Promise<Buffer>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=azure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure.d.ts","sourceRoot":"","sources":["../../src/kms/azure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAErD;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,WAAW;IAElD,OAAO,CAAC,UAAU,CAAM;IAExB,OAAO,CAAC,UAAU,CAAM;YAEV,YAAY;IAcpB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAe9D,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAWpF"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AzureKmsProvider = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* Azure Key Vault provider for envelope encryption.
|
|
39
|
+
* Dynamically imports `@azure/keyvault-keys` and `@azure/identity` — both are optional dependencies.
|
|
40
|
+
*
|
|
41
|
+
* The keyId is the full Azure Key Vault key URL:
|
|
42
|
+
* https://{vault-name}.vault.azure.net/keys/{key-name}/{version?}
|
|
43
|
+
*/
|
|
44
|
+
class AzureKmsProvider {
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- lazy-loaded SDK credential
|
|
46
|
+
credential;
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- lazy-loaded SDK module
|
|
48
|
+
keysModule;
|
|
49
|
+
async ensureLoaded() {
|
|
50
|
+
if (this.credential)
|
|
51
|
+
return;
|
|
52
|
+
try {
|
|
53
|
+
const identity = await Promise.resolve().then(() => __importStar(require("@azure/identity")));
|
|
54
|
+
this.keysModule = await Promise.resolve().then(() => __importStar(require("@azure/keyvault-keys")));
|
|
55
|
+
this.credential = new identity.DefaultAzureCredential();
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
throw new Error("Azure Key Vault requires @azure/identity and @azure/keyvault-keys. " +
|
|
59
|
+
"Install them with: npm install @azure/identity @azure/keyvault-keys");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async wrap(keyId, plaintext) {
|
|
63
|
+
await this.ensureLoaded();
|
|
64
|
+
const client = new this.keysModule.CryptographyClient(keyId, this.credential);
|
|
65
|
+
const result = await client.wrapKey("RSA-OAEP-256", plaintext);
|
|
66
|
+
if (!result.result) {
|
|
67
|
+
throw new Error("Azure Key Vault wrapKey returned no result.");
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
wrappedKey: Buffer.from(result.result),
|
|
71
|
+
algorithm: "RSA-OAEP-256",
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
async unwrap(keyId, wrappedKey, algorithm) {
|
|
75
|
+
await this.ensureLoaded();
|
|
76
|
+
const client = new this.keysModule.CryptographyClient(keyId, this.credential);
|
|
77
|
+
const result = await client.unwrapKey(algorithm, wrappedKey);
|
|
78
|
+
if (!result.result) {
|
|
79
|
+
throw new Error("Azure Key Vault unwrapKey returned no result.");
|
|
80
|
+
}
|
|
81
|
+
return Buffer.from(result.result);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.AzureKmsProvider = AzureKmsProvider;
|
|
85
|
+
//# sourceMappingURL=azure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure.js","sourceRoot":"","sources":["../../src/kms/azure.ts"],"names":[],"mappings":";;;;;;;;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IAAI,CAAC,UAAU,CAAC,CAAC;QAC9E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAE7D,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACF;AA9CD,4CA8CC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { KmsProvider, KmsWrapResult } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* GCP Cloud KMS provider for envelope encryption.
|
|
4
|
+
* Dynamically imports `@google-cloud/kms` — the SDK is an optional dependency.
|
|
5
|
+
*
|
|
6
|
+
* The keyId is the full GCP KMS resource name:
|
|
7
|
+
* projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{key}
|
|
8
|
+
*
|
|
9
|
+
* Uses Application Default Credentials for authentication.
|
|
10
|
+
*/
|
|
11
|
+
export declare class GcpKmsProvider implements KmsProvider {
|
|
12
|
+
private client;
|
|
13
|
+
private ensureClient;
|
|
14
|
+
wrap(keyId: string, plaintext: Buffer): Promise<KmsWrapResult>;
|
|
15
|
+
unwrap(keyId: string, wrappedKey: Buffer, _algorithm: string): Promise<Buffer>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=gcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gcp.d.ts","sourceRoot":"","sources":["../../src/kms/gcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAErD;;;;;;;;GAQG;AACH,qBAAa,cAAe,YAAW,WAAW;IAEhD,OAAO,CAAC,MAAM,CAAM;YAEN,YAAY;IAYpB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAkB9D,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAcrF"}
|
package/dist/kms/gcp.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.GcpKmsProvider = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* GCP Cloud KMS provider for envelope encryption.
|
|
39
|
+
* Dynamically imports `@google-cloud/kms` — the SDK is an optional dependency.
|
|
40
|
+
*
|
|
41
|
+
* The keyId is the full GCP KMS resource name:
|
|
42
|
+
* projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{key}
|
|
43
|
+
*
|
|
44
|
+
* Uses Application Default Credentials for authentication.
|
|
45
|
+
*/
|
|
46
|
+
class GcpKmsProvider {
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- lazy-loaded SDK client
|
|
48
|
+
client;
|
|
49
|
+
async ensureClient() {
|
|
50
|
+
if (this.client)
|
|
51
|
+
return;
|
|
52
|
+
try {
|
|
53
|
+
const kms = await Promise.resolve().then(() => __importStar(require("@google-cloud/kms")));
|
|
54
|
+
this.client = new kms.KeyManagementServiceClient();
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
throw new Error("GCP KMS requires @google-cloud/kms. Install it with: npm install @google-cloud/kms");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async wrap(keyId, plaintext) {
|
|
61
|
+
await this.ensureClient();
|
|
62
|
+
const [response] = await this.client.encrypt({
|
|
63
|
+
name: keyId,
|
|
64
|
+
plaintext,
|
|
65
|
+
});
|
|
66
|
+
if (!response.ciphertext) {
|
|
67
|
+
throw new Error("GCP KMS encrypt returned no ciphertext.");
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
wrappedKey: Buffer.from(response.ciphertext),
|
|
71
|
+
algorithm: "GOOGLE_SYMMETRIC_ENCRYPTION",
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
async unwrap(keyId, wrappedKey, _algorithm) {
|
|
75
|
+
await this.ensureClient();
|
|
76
|
+
const [response] = await this.client.decrypt({
|
|
77
|
+
name: keyId,
|
|
78
|
+
ciphertext: wrappedKey,
|
|
79
|
+
});
|
|
80
|
+
if (!response.plaintext) {
|
|
81
|
+
throw new Error("GCP KMS decrypt returned no plaintext.");
|
|
82
|
+
}
|
|
83
|
+
return Buffer.from(response.plaintext);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.GcpKmsProvider = GcpKmsProvider;
|
|
87
|
+
//# sourceMappingURL=gcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gcp.js","sourceRoot":"","sources":["../../src/kms/gcp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;GAQG;AACH,MAAa,cAAc;IACzB,wFAAwF;IAChF,MAAM,CAAM;IAEZ,KAAK,CAAC,YAAY;QACxB,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,wDAAa,mBAAmB,GAAC,CAAC;YAC9C,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC,0BAA0B,EAAE,CAAC;QACrD,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAa,EAAE,SAAiB;QACzC,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QAE1B,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YAC3C,IAAI,EAAE,KAAK;YACX,SAAS;SACV,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO;YACL,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC5C,SAAS,EAAE,6BAA6B;SACzC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,UAAkB,EAAE,UAAkB;QAChE,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QAE1B,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YAC3C,IAAI,EAAE,KAAK;YACX,UAAU,EAAE,UAAU;SACvB,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;CACF;AAhDD,wCAgDC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { KmsProvider } from "./types";
|
|
2
|
+
export type { KmsProvider, KmsWrapResult, KmsProviderType } from "./types";
|
|
3
|
+
export { AwsKmsProvider } from "./aws";
|
|
4
|
+
export { GcpKmsProvider } from "./gcp";
|
|
5
|
+
export { AzureKmsProvider } from "./azure";
|
|
6
|
+
/**
|
|
7
|
+
* Factory: create a KMS provider by name.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createKmsProvider(provider: string, options?: {
|
|
10
|
+
region?: string;
|
|
11
|
+
}): KmsProvider;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/kms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAKtC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAW9F"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AzureKmsProvider = exports.GcpKmsProvider = exports.AwsKmsProvider = void 0;
|
|
4
|
+
exports.createKmsProvider = createKmsProvider;
|
|
5
|
+
const aws_1 = require("./aws");
|
|
6
|
+
const gcp_1 = require("./gcp");
|
|
7
|
+
const azure_1 = require("./azure");
|
|
8
|
+
var aws_2 = require("./aws");
|
|
9
|
+
Object.defineProperty(exports, "AwsKmsProvider", { enumerable: true, get: function () { return aws_2.AwsKmsProvider; } });
|
|
10
|
+
var gcp_2 = require("./gcp");
|
|
11
|
+
Object.defineProperty(exports, "GcpKmsProvider", { enumerable: true, get: function () { return gcp_2.GcpKmsProvider; } });
|
|
12
|
+
var azure_2 = require("./azure");
|
|
13
|
+
Object.defineProperty(exports, "AzureKmsProvider", { enumerable: true, get: function () { return azure_2.AzureKmsProvider; } });
|
|
14
|
+
/**
|
|
15
|
+
* Factory: create a KMS provider by name.
|
|
16
|
+
*/
|
|
17
|
+
function createKmsProvider(provider, options) {
|
|
18
|
+
switch (provider) {
|
|
19
|
+
case "aws":
|
|
20
|
+
return new aws_1.AwsKmsProvider(options?.region);
|
|
21
|
+
case "gcp":
|
|
22
|
+
return new gcp_1.GcpKmsProvider();
|
|
23
|
+
case "azure":
|
|
24
|
+
return new azure_1.AzureKmsProvider();
|
|
25
|
+
default:
|
|
26
|
+
throw new Error(`Unknown KMS provider: ${provider}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/kms/index.ts"],"names":[],"mappings":";;;AAaA,8CAWC;AAvBD,+BAAuC;AACvC,+BAAuC;AACvC,mCAA2C;AAG3C,6BAAuC;AAA9B,qGAAA,cAAc,OAAA;AACvB,6BAAuC;AAA9B,qGAAA,cAAc,OAAA;AACvB,iCAA2C;AAAlC,yGAAA,gBAAgB,OAAA;AAEzB;;GAEG;AACH,SAAgB,iBAAiB,CAAC,QAAgB,EAAE,OAA6B;IAC/E,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,KAAK;YACR,OAAO,IAAI,oBAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7C,KAAK,KAAK;YACR,OAAO,IAAI,oBAAc,EAAE,CAAC;QAC9B,KAAK,OAAO;YACV,OAAO,IAAI,wBAAgB,EAAE,CAAC;QAChC;YACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAC;IACzD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type KmsProviderType = "aws" | "gcp" | "azure";
|
|
2
|
+
export interface KmsWrapResult {
|
|
3
|
+
wrappedKey: Buffer;
|
|
4
|
+
algorithm: string;
|
|
5
|
+
}
|
|
6
|
+
export interface KmsProvider {
|
|
7
|
+
wrap(keyId: string, plaintext: Buffer): Promise<KmsWrapResult>;
|
|
8
|
+
unwrap(keyId: string, wrappedKey: Buffer, algorithm: string): Promise<Buffer>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/kms/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC/D,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/kms/types.ts"],"names":[],"mappings":""}
|
package/dist/poller.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { SecretsCache } from "./secrets-cache";
|
|
2
|
+
import { ArtifactSource } from "./sources/types";
|
|
3
|
+
import { DiskCache } from "./disk-cache";
|
|
4
|
+
import { TelemetryEmitter } from "./telemetry";
|
|
5
|
+
/** KMS envelope metadata for artifacts using KMS envelope encryption. */
|
|
6
|
+
export interface ArtifactKmsEnvelope {
|
|
7
|
+
provider: string;
|
|
8
|
+
keyId: string;
|
|
9
|
+
wrappedKey: string;
|
|
10
|
+
algorithm: string;
|
|
11
|
+
}
|
|
12
|
+
/** Shape of a packed artifact JSON envelope. */
|
|
13
|
+
export interface ArtifactEnvelope {
|
|
14
|
+
version: number;
|
|
15
|
+
identity: string;
|
|
16
|
+
environment: string;
|
|
17
|
+
packedAt: string;
|
|
18
|
+
revision: string;
|
|
19
|
+
ciphertextHash: string;
|
|
20
|
+
ciphertext: string;
|
|
21
|
+
keys: string[];
|
|
22
|
+
envelope?: ArtifactKmsEnvelope;
|
|
23
|
+
/** ISO-8601 expiry timestamp. Artifact is rejected after this time. */
|
|
24
|
+
expiresAt?: string;
|
|
25
|
+
/** ISO-8601 revocation timestamp. Present when the artifact has been revoked. */
|
|
26
|
+
revokedAt?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface PollerOptions {
|
|
29
|
+
/** Artifact source strategy. */
|
|
30
|
+
source: ArtifactSource;
|
|
31
|
+
/** Age private key string. Optional for KMS envelope artifacts. */
|
|
32
|
+
privateKey?: string;
|
|
33
|
+
/** Secrets cache to swap on new revisions. */
|
|
34
|
+
cache: SecretsCache;
|
|
35
|
+
/** Optional disk cache for fallback. */
|
|
36
|
+
diskCache?: DiskCache;
|
|
37
|
+
/** Optional callback on successful refresh. */
|
|
38
|
+
onRefresh?: (revision: string) => void;
|
|
39
|
+
/** Optional error callback for logging. */
|
|
40
|
+
onError?: (err: Error) => void;
|
|
41
|
+
/** Max seconds the cache may be served without a successful refresh. */
|
|
42
|
+
cacheTtl?: number;
|
|
43
|
+
/** Optional telemetry emitter for event reporting. */
|
|
44
|
+
telemetry?: TelemetryEmitter;
|
|
45
|
+
}
|
|
46
|
+
export declare class ArtifactPoller {
|
|
47
|
+
private timer;
|
|
48
|
+
private lastContentHash;
|
|
49
|
+
private lastRevision;
|
|
50
|
+
private lastExpiresAt;
|
|
51
|
+
private readonly decryptor;
|
|
52
|
+
private readonly options;
|
|
53
|
+
private telemetryOverride?;
|
|
54
|
+
constructor(options: PollerOptions);
|
|
55
|
+
/** Set or replace the telemetry emitter (e.g. after resolving token from secrets). */
|
|
56
|
+
setTelemetry(emitter: TelemetryEmitter): void;
|
|
57
|
+
private get telemetry();
|
|
58
|
+
/** Fetch, validate, decrypt, and cache the artifact. */
|
|
59
|
+
fetchAndDecrypt(): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Validate the artifact, decrypt it, and swap the cache.
|
|
62
|
+
* Emits `artifact.invalid` on any validation or decryption failure,
|
|
63
|
+
* and `artifact.expired` / `artifact.refreshed` on their respective paths.
|
|
64
|
+
*/
|
|
65
|
+
private validateDecryptAndCache;
|
|
66
|
+
/** Start the polling loop. Performs an initial fetch immediately. */
|
|
67
|
+
start(): Promise<void>;
|
|
68
|
+
/** Start only the polling schedule (no initial fetch). */
|
|
69
|
+
startPolling(): void;
|
|
70
|
+
/** Stop the polling loop. */
|
|
71
|
+
stop(): void;
|
|
72
|
+
/** Whether the poller is currently running. */
|
|
73
|
+
isRunning(): boolean;
|
|
74
|
+
/** Compute the next poll delay and schedule a fetch. */
|
|
75
|
+
private scheduleNext;
|
|
76
|
+
/** Compute ms until next poll: 80% of expiresAt remaining, or cacheTtl / 10 fallback. */
|
|
77
|
+
private computeNextPollMs;
|
|
78
|
+
private parseAndValidate;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=poller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poller.d.ts","sourceRoot":"","sources":["../src/poller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,yEAAyE;AACzE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,gDAAgD;AAChD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,W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