@enactprotocol/trust 2.0.0 → 2.0.2
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/hash.d.ts +53 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +104 -0
- package/dist/hash.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/keys.d.ts +41 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/keys.js +130 -0
- package/dist/keys.js.map +1 -0
- package/dist/sigstore/attestation.d.ts +245 -0
- package/dist/sigstore/attestation.d.ts.map +1 -0
- package/dist/sigstore/attestation.js +324 -0
- package/dist/sigstore/attestation.js.map +1 -0
- package/dist/sigstore/cosign.d.ts +90 -0
- package/dist/sigstore/cosign.d.ts.map +1 -0
- package/dist/sigstore/cosign.js +457 -0
- package/dist/sigstore/cosign.js.map +1 -0
- package/dist/sigstore/index.d.ts +17 -0
- package/dist/sigstore/index.d.ts.map +1 -0
- package/dist/sigstore/index.js +21 -0
- package/dist/sigstore/index.js.map +1 -0
- package/dist/sigstore/oauth/client.d.ts +38 -0
- package/dist/sigstore/oauth/client.d.ts.map +1 -0
- package/dist/sigstore/oauth/client.js +71 -0
- package/dist/sigstore/oauth/client.js.map +1 -0
- package/dist/sigstore/oauth/index.d.ts +47 -0
- package/dist/sigstore/oauth/index.d.ts.map +1 -0
- package/dist/sigstore/oauth/index.js +66 -0
- package/dist/sigstore/oauth/index.js.map +1 -0
- package/dist/sigstore/oauth/server.d.ts +29 -0
- package/dist/sigstore/oauth/server.d.ts.map +1 -0
- package/dist/sigstore/oauth/server.js +145 -0
- package/dist/sigstore/oauth/server.js.map +1 -0
- package/dist/sigstore/policy.d.ts +85 -0
- package/dist/sigstore/policy.d.ts.map +1 -0
- package/dist/sigstore/policy.js +351 -0
- package/dist/sigstore/policy.js.map +1 -0
- package/dist/sigstore/signing.d.ts +94 -0
- package/dist/sigstore/signing.d.ts.map +1 -0
- package/dist/sigstore/signing.js +477 -0
- package/dist/sigstore/signing.js.map +1 -0
- package/dist/sigstore/types.d.ts +541 -0
- package/dist/sigstore/types.d.ts.map +1 -0
- package/dist/sigstore/types.js +5 -0
- package/dist/sigstore/types.js.map +1 -0
- package/dist/sigstore/verification.d.ts +66 -0
- package/dist/sigstore/verification.d.ts.map +1 -0
- package/dist/sigstore/verification.js +317 -0
- package/dist/sigstore/verification.js.map +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +1 -1
package/dist/hash.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hash utilities for content integrity verification
|
|
3
|
+
*/
|
|
4
|
+
import type { FileHashOptions, HashAlgorithm, HashResult } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* Hash a string or buffer using the specified algorithm
|
|
7
|
+
*
|
|
8
|
+
* @param content - The content to hash
|
|
9
|
+
* @param algorithm - The hash algorithm to use (default: sha256)
|
|
10
|
+
* @returns Hash result with algorithm and digest
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const result = hashContent("hello world");
|
|
15
|
+
* console.log(result.digest); // "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function hashContent(content: string | Buffer, algorithm?: HashAlgorithm): HashResult;
|
|
19
|
+
/**
|
|
20
|
+
* Hash a buffer directly
|
|
21
|
+
*
|
|
22
|
+
* @param buffer - The buffer to hash
|
|
23
|
+
* @param algorithm - The hash algorithm to use (default: sha256)
|
|
24
|
+
* @returns Hash result with algorithm and digest
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const buffer = Buffer.from("hello world");
|
|
29
|
+
* const result = hashBuffer(buffer);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function hashBuffer(buffer: Buffer, algorithm?: HashAlgorithm): HashResult;
|
|
33
|
+
/**
|
|
34
|
+
* Hash a file using streaming to support large files
|
|
35
|
+
*
|
|
36
|
+
* @param filePath - Path to the file to hash
|
|
37
|
+
* @param options - Hashing options including algorithm and progress callback
|
|
38
|
+
* @returns Promise resolving to hash result
|
|
39
|
+
*
|
|
40
|
+
* @throws Error if file doesn't exist or cannot be read
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const result = await hashFile("/path/to/file.txt", {
|
|
45
|
+
* algorithm: "sha256",
|
|
46
|
+
* onProgress: (read, total) => {
|
|
47
|
+
* console.log(`${(read / total * 100).toFixed(1)}% complete`);
|
|
48
|
+
* }
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function hashFile(filePath: string, options?: FileHashOptions): Promise<HashResult>;
|
|
53
|
+
//# sourceMappingURL=hash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../src/hash.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,SAAS,GAAE,aAAwB,GAClC,UAAU,CASZ;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,GAAE,aAAwB,GAAG,UAAU,CAE1F;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,QAAQ,CAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,UAAU,CAAC,CA6CrB"}
|
package/dist/hash.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hash utilities for content integrity verification
|
|
3
|
+
*/
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import { createReadStream, statSync } from "node:fs";
|
|
6
|
+
/**
|
|
7
|
+
* Hash a string or buffer using the specified algorithm
|
|
8
|
+
*
|
|
9
|
+
* @param content - The content to hash
|
|
10
|
+
* @param algorithm - The hash algorithm to use (default: sha256)
|
|
11
|
+
* @returns Hash result with algorithm and digest
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const result = hashContent("hello world");
|
|
16
|
+
* console.log(result.digest); // "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export function hashContent(content, algorithm = "sha256") {
|
|
20
|
+
const hash = createHash(algorithm);
|
|
21
|
+
hash.update(content);
|
|
22
|
+
const digest = hash.digest("hex");
|
|
23
|
+
return {
|
|
24
|
+
algorithm,
|
|
25
|
+
digest,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Hash a buffer directly
|
|
30
|
+
*
|
|
31
|
+
* @param buffer - The buffer to hash
|
|
32
|
+
* @param algorithm - The hash algorithm to use (default: sha256)
|
|
33
|
+
* @returns Hash result with algorithm and digest
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const buffer = Buffer.from("hello world");
|
|
38
|
+
* const result = hashBuffer(buffer);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function hashBuffer(buffer, algorithm = "sha256") {
|
|
42
|
+
return hashContent(buffer, algorithm);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Hash a file using streaming to support large files
|
|
46
|
+
*
|
|
47
|
+
* @param filePath - Path to the file to hash
|
|
48
|
+
* @param options - Hashing options including algorithm and progress callback
|
|
49
|
+
* @returns Promise resolving to hash result
|
|
50
|
+
*
|
|
51
|
+
* @throws Error if file doesn't exist or cannot be read
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const result = await hashFile("/path/to/file.txt", {
|
|
56
|
+
* algorithm: "sha256",
|
|
57
|
+
* onProgress: (read, total) => {
|
|
58
|
+
* console.log(`${(read / total * 100).toFixed(1)}% complete`);
|
|
59
|
+
* }
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export async function hashFile(filePath, options = {}) {
|
|
64
|
+
const { algorithm = "sha256", onProgress } = options;
|
|
65
|
+
// Validate file exists and get size
|
|
66
|
+
let fileSize;
|
|
67
|
+
try {
|
|
68
|
+
const stats = statSync(filePath);
|
|
69
|
+
if (!stats.isFile()) {
|
|
70
|
+
throw new Error(`Path is not a file: ${filePath}`);
|
|
71
|
+
}
|
|
72
|
+
fileSize = stats.size;
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (error instanceof Error) {
|
|
76
|
+
throw new Error(`Failed to access file: ${error.message}`);
|
|
77
|
+
}
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
return new Promise((resolve, reject) => {
|
|
81
|
+
const hash = createHash(algorithm);
|
|
82
|
+
const stream = createReadStream(filePath);
|
|
83
|
+
let bytesRead = 0;
|
|
84
|
+
stream.on("data", (chunk) => {
|
|
85
|
+
hash.update(chunk);
|
|
86
|
+
const chunkSize = typeof chunk === "string" ? Buffer.byteLength(chunk) : chunk.length;
|
|
87
|
+
bytesRead += chunkSize;
|
|
88
|
+
if (onProgress) {
|
|
89
|
+
onProgress(bytesRead, fileSize);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
stream.on("end", () => {
|
|
93
|
+
const digest = hash.digest("hex");
|
|
94
|
+
resolve({
|
|
95
|
+
algorithm,
|
|
96
|
+
digest,
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
stream.on("error", (error) => {
|
|
100
|
+
reject(new Error(`Failed to read file: ${error.message}`));
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=hash.js.map
|
package/dist/hash.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../src/hash.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAa,UAAU,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGrD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CACzB,OAAwB,EACxB,YAA2B,QAAQ;IAEnC,MAAM,IAAI,GAAS,UAAU,CAAC,SAAS,CAAC,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACrB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAElC,OAAO;QACL,SAAS;QACT,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,YAA2B,QAAQ;IAC5E,OAAO,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,QAAgB,EAChB,UAA2B,EAAE;IAE7B,MAAM,EAAE,SAAS,GAAG,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAErD,oCAAoC;IACpC,IAAI,QAAgB,CAAC;IACrB,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAA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C,IAAI,KAAK,CAAC,wBAAwB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @enactprotocol/trust
|
|
3
|
+
*
|
|
4
|
+
* Sigstore integration, attestation generation/verification,
|
|
5
|
+
* and trust system for Enact.
|
|
6
|
+
*/
|
|
7
|
+
export declare const version = "0.1.0";
|
|
8
|
+
export { hashContent, hashBuffer, hashFile } from "./hash";
|
|
9
|
+
export { generateKeyPair, isValidPEMKey, getKeyTypeFromPEM } from "./keys";
|
|
10
|
+
export * from "./sigstore";
|
|
11
|
+
export type { HashAlgorithm, HashResult, FileHashOptions, KeyType, KeyFormat, KeyPair, KeyGenerationOptions, } from "./types";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAG3D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAG3E,cAAc,YAAY,CAAC;AAG3B,YAAY,EACV,aAAa,EACb,UAAU,EACV,eAAe,EACf,OAAO,EACP,SAAS,EACT,OAAO,EACP,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @enactprotocol/trust
|
|
3
|
+
*
|
|
4
|
+
* Sigstore integration, attestation generation/verification,
|
|
5
|
+
* and trust system for Enact.
|
|
6
|
+
*/
|
|
7
|
+
export const version = "0.1.0";
|
|
8
|
+
// Hash utilities
|
|
9
|
+
export { hashContent, hashBuffer, hashFile } from "./hash";
|
|
10
|
+
// Key management
|
|
11
|
+
export { generateKeyPair, isValidPEMKey, getKeyTypeFromPEM } from "./keys";
|
|
12
|
+
// Sigstore integration (attestation signing, verification, trust policies)
|
|
13
|
+
export * from "./sigstore";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,iBAAiB;AACjB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE3D,iBAAiB;AACjB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAE3E,2EAA2E;AAC3E,cAAc,YAAY,CAAC"}
|
package/dist/keys.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Key management utilities for cryptographic operations
|
|
3
|
+
*/
|
|
4
|
+
import type { KeyGenerationOptions, KeyPair, KeyType } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* Generate a new cryptographic key pair
|
|
7
|
+
*
|
|
8
|
+
* @param options - Key generation options
|
|
9
|
+
* @returns Generated key pair with public and private keys
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* // Generate RSA key pair
|
|
14
|
+
* const rsaKeys = generateKeyPair({
|
|
15
|
+
* type: "rsa",
|
|
16
|
+
* modulusLength: 2048
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Generate Ed25519 key pair
|
|
20
|
+
* const ed25519Keys = generateKeyPair({
|
|
21
|
+
* type: "ed25519"
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateKeyPair(options: KeyGenerationOptions): KeyPair;
|
|
26
|
+
/**
|
|
27
|
+
* Validate a PEM-formatted key
|
|
28
|
+
*
|
|
29
|
+
* @param key - The key to validate (public or private)
|
|
30
|
+
* @param expectedType - Expected key type (public or private)
|
|
31
|
+
* @returns True if key is valid PEM format
|
|
32
|
+
*/
|
|
33
|
+
export declare function isValidPEMKey(key: string, expectedType?: "public" | "private"): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Parse key type from a PEM key string
|
|
36
|
+
*
|
|
37
|
+
* @param key - PEM-formatted key string
|
|
38
|
+
* @returns Detected key type or undefined if cannot be determined
|
|
39
|
+
*/
|
|
40
|
+
export declare function getKeyTypeFromPEM(key: string): KeyType | undefined;
|
|
41
|
+
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAiBtE;AA2DD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,YAAY,GAAE,QAAQ,GAAG,SAAqB,GAC7C,OAAO,CAUT;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAyBlE"}
|
package/dist/keys.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Key management utilities for cryptographic operations
|
|
3
|
+
*/
|
|
4
|
+
import { generateKeyPairSync } from "node:crypto";
|
|
5
|
+
/**
|
|
6
|
+
* Generate a new cryptographic key pair
|
|
7
|
+
*
|
|
8
|
+
* @param options - Key generation options
|
|
9
|
+
* @returns Generated key pair with public and private keys
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* // Generate RSA key pair
|
|
14
|
+
* const rsaKeys = generateKeyPair({
|
|
15
|
+
* type: "rsa",
|
|
16
|
+
* modulusLength: 2048
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Generate Ed25519 key pair
|
|
20
|
+
* const ed25519Keys = generateKeyPair({
|
|
21
|
+
* type: "ed25519"
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function generateKeyPair(options) {
|
|
26
|
+
const { type, format = "pem", modulusLength = 2048, passphrase } = options;
|
|
27
|
+
const keyPairOptions = getKeyPairOptions(type, modulusLength, format, passphrase);
|
|
28
|
+
const nodeKeyType = getNodeKeyType(type);
|
|
29
|
+
// TypeScript has very strict overloads for generateKeyPairSync
|
|
30
|
+
// We use any here as we've validated the types through our own KeyType
|
|
31
|
+
// biome-ignore lint/suspicious/noExplicitAny: Node.js crypto API has complex overloads
|
|
32
|
+
const { publicKey, privateKey } = generateKeyPairSync(nodeKeyType, keyPairOptions);
|
|
33
|
+
return {
|
|
34
|
+
publicKey: publicKey.toString(),
|
|
35
|
+
privateKey: privateKey.toString(),
|
|
36
|
+
type,
|
|
37
|
+
format,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Convert our KeyType to Node.js crypto key type
|
|
42
|
+
*/
|
|
43
|
+
function getNodeKeyType(type) {
|
|
44
|
+
switch (type) {
|
|
45
|
+
case "rsa":
|
|
46
|
+
return "rsa";
|
|
47
|
+
case "ed25519":
|
|
48
|
+
return "ed25519";
|
|
49
|
+
case "ecdsa":
|
|
50
|
+
return "ec";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get key pair generation options for Node.js crypto
|
|
55
|
+
*/
|
|
56
|
+
function getKeyPairOptions(type, modulusLength, format, passphrase) {
|
|
57
|
+
const baseOptions = {
|
|
58
|
+
publicKeyEncoding: {
|
|
59
|
+
type: "spki",
|
|
60
|
+
format,
|
|
61
|
+
},
|
|
62
|
+
privateKeyEncoding: {
|
|
63
|
+
type: "pkcs8",
|
|
64
|
+
format,
|
|
65
|
+
...(passphrase && {
|
|
66
|
+
cipher: "aes-256-cbc",
|
|
67
|
+
passphrase,
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
// Add type-specific options
|
|
72
|
+
if (type === "rsa") {
|
|
73
|
+
return {
|
|
74
|
+
...baseOptions,
|
|
75
|
+
modulusLength,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (type === "ecdsa") {
|
|
79
|
+
return {
|
|
80
|
+
...baseOptions,
|
|
81
|
+
namedCurve: "prime256v1", // Also known as secp256r1 or P-256
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// Ed25519 doesn't need additional options
|
|
85
|
+
return baseOptions;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Validate a PEM-formatted key
|
|
89
|
+
*
|
|
90
|
+
* @param key - The key to validate (public or private)
|
|
91
|
+
* @param expectedType - Expected key type (public or private)
|
|
92
|
+
* @returns True if key is valid PEM format
|
|
93
|
+
*/
|
|
94
|
+
export function isValidPEMKey(key, expectedType = "private") {
|
|
95
|
+
if (expectedType === "public") {
|
|
96
|
+
return key.includes("-----BEGIN PUBLIC KEY-----") && key.includes("-----END PUBLIC KEY-----");
|
|
97
|
+
}
|
|
98
|
+
return ((key.includes("-----BEGIN PRIVATE KEY-----") && key.includes("-----END PRIVATE KEY-----")) ||
|
|
99
|
+
(key.includes("-----BEGIN ENCRYPTED PRIVATE KEY-----") &&
|
|
100
|
+
key.includes("-----END ENCRYPTED PRIVATE KEY-----")));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Parse key type from a PEM key string
|
|
104
|
+
*
|
|
105
|
+
* @param key - PEM-formatted key string
|
|
106
|
+
* @returns Detected key type or undefined if cannot be determined
|
|
107
|
+
*/
|
|
108
|
+
export function getKeyTypeFromPEM(key) {
|
|
109
|
+
// Check if it's a valid PEM key first
|
|
110
|
+
if (!isValidPEMKey(key, "private") && !isValidPEMKey(key, "public")) {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
// Check for explicit algorithm markers
|
|
114
|
+
if (key.includes("RSA")) {
|
|
115
|
+
return "rsa";
|
|
116
|
+
}
|
|
117
|
+
// Length-based heuristic (RSA keys are much longer)
|
|
118
|
+
// RSA 2048: ~1700 chars, RSA 4096: ~3200 chars
|
|
119
|
+
// Ed25519: ~120 chars
|
|
120
|
+
// ECDSA P-256: ~200-300 chars
|
|
121
|
+
if (key.length > 1000) {
|
|
122
|
+
return "rsa";
|
|
123
|
+
}
|
|
124
|
+
if (key.length < 200) {
|
|
125
|
+
return "ed25519";
|
|
126
|
+
}
|
|
127
|
+
// ECDSA falls somewhere in between
|
|
128
|
+
return "ecdsa";
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=keys.js.map
|
package/dist/keys.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,eAAe,CAAC,OAA6B;IAC3D,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,EAAE,aAAa,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE3E,MAAM,cAAc,GAAG,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;IAClF,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAEzC,+DAA+D;IAC/D,uEAAuE;I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AC,QAAQ,CAAC,4BAA4B,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC;IAChG,CAAC;IAED,OAAO,CACL,CAAC,GAAG,CAAC,QAAQ,CAAC,6BAA6B,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC;QAC1F,CAAC,GAAG,CAAC,QAAQ,CAAC,uCAAuC,CAAC;YACpD,GAAG,CAAC,QAAQ,CAAC,qCAAqC,CAAC,CAAC,CACvD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,sCAAsC;IACtC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC;QACpE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,uCAAuC;IACvC,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,oDAAoD;IACpD,+CAA+C;IAC/C,sBAAsB;IACtB,8BAA8B;IAC9B,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,mCAAmC;IACnC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attestation generation module
|
|
3
|
+
*
|
|
4
|
+
* This module provides functions for creating in-toto attestations and SLSA provenance
|
|
5
|
+
* statements that can be signed using Sigstore.
|
|
6
|
+
*/
|
|
7
|
+
import type { EnactToolPredicate, InTotoStatement, InTotoSubject, SLSAProvenancePredicate, SLSAResourceDescriptor } from "./types";
|
|
8
|
+
/**
|
|
9
|
+
* The primary Enact website/registry URL
|
|
10
|
+
* Used for attestation types, tool URLs, and documentation references
|
|
11
|
+
*/
|
|
12
|
+
export declare const ENACT_BASE_URL = "https://enact.tools";
|
|
13
|
+
/** in-toto statement type */
|
|
14
|
+
export declare const INTOTO_STATEMENT_TYPE = "https://in-toto.io/Statement/v1";
|
|
15
|
+
/** SLSA Provenance predicate type v1.0 */
|
|
16
|
+
export declare const SLSA_PROVENANCE_TYPE = "https://slsa.dev/provenance/v1";
|
|
17
|
+
/** Enact tool attestation predicate type */
|
|
18
|
+
export declare const ENACT_TOOL_TYPE = "https://enact.tools/attestation/tool/v1";
|
|
19
|
+
/** Enact audit attestation predicate type */
|
|
20
|
+
export declare const ENACT_AUDIT_TYPE = "https://enact.tools/attestation/audit/v1";
|
|
21
|
+
/** Enact build type for SLSA provenance */
|
|
22
|
+
export declare const ENACT_BUILD_TYPE = "https://enact.tools/build/v1";
|
|
23
|
+
/**
|
|
24
|
+
* Create an in-toto subject from content
|
|
25
|
+
*
|
|
26
|
+
* @param name - The subject name (e.g., file path or artifact identifier)
|
|
27
|
+
* @param content - The content to hash
|
|
28
|
+
* @returns The in-toto subject with sha256 digest
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const subject = createSubjectFromContent("tool.yaml", yamlContent);
|
|
33
|
+
* // { name: "tool.yaml", digest: { sha256: "abc123..." } }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function createSubjectFromContent(name: string, content: string | Buffer): InTotoSubject;
|
|
37
|
+
/**
|
|
38
|
+
* Create an in-toto subject from a file
|
|
39
|
+
*
|
|
40
|
+
* @param name - The subject name (can differ from file path)
|
|
41
|
+
* @param filePath - Path to the file to hash
|
|
42
|
+
* @returns Promise resolving to the in-toto subject
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const subject = await createSubjectFromFile("my-tool@1.0.0", "/path/to/tool.yaml");
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function createSubjectFromFile(name: string, filePath: string): Promise<InTotoSubject>;
|
|
50
|
+
/**
|
|
51
|
+
* Create an in-toto subject with multiple digest algorithms
|
|
52
|
+
*
|
|
53
|
+
* @param name - The subject name
|
|
54
|
+
* @param content - The content to hash
|
|
55
|
+
* @returns Subject with both sha256 and sha512 digests
|
|
56
|
+
*/
|
|
57
|
+
export declare function createSubjectWithMultipleDigests(name: string, content: string | Buffer): InTotoSubject;
|
|
58
|
+
/**
|
|
59
|
+
* Create a generic in-toto statement
|
|
60
|
+
*
|
|
61
|
+
* @param subjects - The subjects (artifacts) covered by this attestation
|
|
62
|
+
* @param predicateType - The predicate type URI
|
|
63
|
+
* @param predicate - The predicate content
|
|
64
|
+
* @returns The in-toto statement
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const statement = createStatement(
|
|
69
|
+
* [subject],
|
|
70
|
+
* "https://example.com/predicate/v1",
|
|
71
|
+
* { customField: "value" }
|
|
72
|
+
* );
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function createStatement<T>(subjects: InTotoSubject[], predicateType: string, predicate: T): InTotoStatement<T>;
|
|
76
|
+
/**
|
|
77
|
+
* Options for creating SLSA provenance
|
|
78
|
+
*/
|
|
79
|
+
export interface SLSAProvenanceOptions {
|
|
80
|
+
/** Build type URI (e.g., "https://enact.tools/build/v1") */
|
|
81
|
+
buildType: string;
|
|
82
|
+
/** Builder ID (e.g., "https://github.com/enact-dev/enact-cli") */
|
|
83
|
+
builderId: string;
|
|
84
|
+
/** External parameters (inputs to the build) */
|
|
85
|
+
externalParameters?: Record<string, unknown>;
|
|
86
|
+
/** Internal parameters (builder-controlled) */
|
|
87
|
+
internalParameters?: Record<string, unknown>;
|
|
88
|
+
/** Source dependencies */
|
|
89
|
+
resolvedDependencies?: SLSAResourceDescriptor[];
|
|
90
|
+
/** Build invocation ID */
|
|
91
|
+
invocationId?: string;
|
|
92
|
+
/** Build start time */
|
|
93
|
+
startedOn?: Date;
|
|
94
|
+
/** Build finish time */
|
|
95
|
+
finishedOn?: Date;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Create a SLSA provenance predicate
|
|
99
|
+
*
|
|
100
|
+
* @param options - Provenance options
|
|
101
|
+
* @returns The SLSA provenance predicate
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const provenance = createSLSAProvenance({
|
|
106
|
+
* buildType: "https://enact.tools/build/v1",
|
|
107
|
+
* builderId: "https://github.com/enact-dev/enact-cli@v2.0.0",
|
|
108
|
+
* externalParameters: {
|
|
109
|
+
* manifestPath: "tool.yaml"
|
|
110
|
+
* }
|
|
111
|
+
* });
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export declare function createSLSAProvenance(options: SLSAProvenanceOptions): SLSAProvenancePredicate;
|
|
115
|
+
/**
|
|
116
|
+
* Create a SLSA provenance statement for an artifact
|
|
117
|
+
*
|
|
118
|
+
* @param subjects - The artifacts to attest
|
|
119
|
+
* @param options - Provenance options
|
|
120
|
+
* @returns The complete in-toto statement with SLSA provenance
|
|
121
|
+
*/
|
|
122
|
+
export declare function createSLSAProvenanceStatement(subjects: InTotoSubject[], options: SLSAProvenanceOptions): InTotoStatement<SLSAProvenancePredicate>;
|
|
123
|
+
/**
|
|
124
|
+
* Options for creating an Enact tool attestation
|
|
125
|
+
*/
|
|
126
|
+
export interface EnactToolAttestationOptions {
|
|
127
|
+
/** Tool name */
|
|
128
|
+
name: string;
|
|
129
|
+
/** Tool version */
|
|
130
|
+
version: string;
|
|
131
|
+
/** Tool publisher identity (email or URI) */
|
|
132
|
+
publisher: string;
|
|
133
|
+
/** Tool description */
|
|
134
|
+
description?: string;
|
|
135
|
+
/** Tool repository URL */
|
|
136
|
+
repository?: string;
|
|
137
|
+
/** Build timestamp */
|
|
138
|
+
buildTimestamp?: Date;
|
|
139
|
+
/** Build environment info */
|
|
140
|
+
buildEnvironment?: Record<string, string>;
|
|
141
|
+
/** Source commit SHA */
|
|
142
|
+
sourceCommit?: string;
|
|
143
|
+
/** Bundle hash (for remote signing) */
|
|
144
|
+
bundleHash?: string;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Create an Enact tool attestation predicate
|
|
148
|
+
*
|
|
149
|
+
* @param options - Tool attestation options
|
|
150
|
+
* @returns The Enact tool predicate
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* const toolPredicate = createEnactToolPredicate({
|
|
155
|
+
* name: "my-tool",
|
|
156
|
+
* version: "1.0.0",
|
|
157
|
+
* publisher: "user@example.com",
|
|
158
|
+
* description: "A useful tool"
|
|
159
|
+
* });
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
export declare function createEnactToolPredicate(options: EnactToolAttestationOptions): EnactToolPredicate;
|
|
163
|
+
/**
|
|
164
|
+
* Create an Enact tool attestation statement
|
|
165
|
+
*
|
|
166
|
+
* @param manifestContent - The tool manifest content
|
|
167
|
+
* @param options - Tool attestation options
|
|
168
|
+
* @returns The complete in-toto statement for the tool
|
|
169
|
+
*/
|
|
170
|
+
export declare function createEnactToolStatement(manifestContent: string | Buffer, options: EnactToolAttestationOptions): InTotoStatement<EnactToolPredicate>;
|
|
171
|
+
/**
|
|
172
|
+
* Options for creating an Enact audit attestation
|
|
173
|
+
*/
|
|
174
|
+
export interface EnactAuditAttestationOptions {
|
|
175
|
+
/** Tool name being audited */
|
|
176
|
+
toolName: string;
|
|
177
|
+
/** Tool version being audited */
|
|
178
|
+
toolVersion: string;
|
|
179
|
+
/** Auditor identity (email or URI) */
|
|
180
|
+
auditor: string;
|
|
181
|
+
/** Audit result */
|
|
182
|
+
result: "passed" | "passed-with-warnings" | "failed";
|
|
183
|
+
/** Audit timestamp */
|
|
184
|
+
timestamp?: Date;
|
|
185
|
+
/** Audit notes */
|
|
186
|
+
notes?: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Audit predicate structure
|
|
190
|
+
*/
|
|
191
|
+
export interface EnactAuditPredicate {
|
|
192
|
+
type: typeof ENACT_AUDIT_TYPE;
|
|
193
|
+
tool: {
|
|
194
|
+
name: string;
|
|
195
|
+
version: string;
|
|
196
|
+
};
|
|
197
|
+
audit: {
|
|
198
|
+
auditor: string;
|
|
199
|
+
timestamp: string;
|
|
200
|
+
result: "passed" | "passed-with-warnings" | "failed";
|
|
201
|
+
notes?: string;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Create an Enact audit attestation predicate
|
|
206
|
+
*
|
|
207
|
+
* @param options - Audit attestation options
|
|
208
|
+
* @returns The Enact audit predicate
|
|
209
|
+
*/
|
|
210
|
+
export declare function createEnactAuditPredicate(options: EnactAuditAttestationOptions): EnactAuditPredicate;
|
|
211
|
+
/**
|
|
212
|
+
* Create an Enact audit attestation statement
|
|
213
|
+
*
|
|
214
|
+
* @param manifestContent - The tool manifest content being audited
|
|
215
|
+
* @param options - Audit attestation options
|
|
216
|
+
* @returns The complete in-toto statement for the audit
|
|
217
|
+
*/
|
|
218
|
+
export declare function createEnactAuditStatement(manifestContent: string | Buffer, options: EnactAuditAttestationOptions): InTotoStatement<EnactAuditPredicate>;
|
|
219
|
+
/**
|
|
220
|
+
* Create a SLSA resource descriptor for a file
|
|
221
|
+
*
|
|
222
|
+
* @param filePath - Path to the file
|
|
223
|
+
* @param options - Additional descriptor options
|
|
224
|
+
* @returns Promise resolving to the resource descriptor
|
|
225
|
+
*/
|
|
226
|
+
export declare function createResourceDescriptorFromFile(filePath: string, options?: {
|
|
227
|
+
uri?: string;
|
|
228
|
+
name?: string;
|
|
229
|
+
downloadLocation?: string;
|
|
230
|
+
mediaType?: string;
|
|
231
|
+
}): Promise<SLSAResourceDescriptor>;
|
|
232
|
+
/**
|
|
233
|
+
* Create a SLSA resource descriptor from content
|
|
234
|
+
*
|
|
235
|
+
* @param content - The content
|
|
236
|
+
* @param options - Descriptor options
|
|
237
|
+
* @returns The resource descriptor
|
|
238
|
+
*/
|
|
239
|
+
export declare function createResourceDescriptorFromContent(content: string | Buffer, options?: {
|
|
240
|
+
uri?: string;
|
|
241
|
+
name?: string;
|
|
242
|
+
downloadLocation?: string;
|
|
243
|
+
mediaType?: string;
|
|
244
|
+
}): SLSAResourceDescriptor;
|
|
245
|
+
//# sourceMappingURL=attestation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attestation.d.ts","sourceRoot":"","sources":["../../src/sigstore/attestation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAMjB;;;GAGG;AACH,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAEpD,6BAA6B;AAC7B,eAAO,MAAM,qBAAqB,oCAAoC,CAAC;AAEvE,0CAA0C;AAC1C,eAAO,MAAM,oBAAoB,mCAAmC,CAAC;AAErE,4CAA4C;AAC5C,eAAO,MAAM,eAAe,4CAA0C,CAAC;AAEvE,6CAA6C;AAC7C,eAAO,MAAM,gBAAgB,6CAA2C,CAAC;AAEzE,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB,iCAA+B,CAAC;AAM7D;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,CAQ9F;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,CAAC,CAQxB;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG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