@enactprotocol/trust 2.0.0 → 2.0.1
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/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth Identity Provider
|
|
3
|
+
*
|
|
4
|
+
* Provides interactive OIDC authentication for keyless signing.
|
|
5
|
+
* Opens a browser for the user to authenticate with their identity provider
|
|
6
|
+
* (GitHub, Google, Microsoft) and returns an OIDC token that can be used
|
|
7
|
+
* with Fulcio to obtain a signing certificate.
|
|
8
|
+
*/
|
|
9
|
+
/** Default Sigstore OAuth issuer */
|
|
10
|
+
export declare const SIGSTORE_OAUTH_ISSUER = "https://oauth2.sigstore.dev/auth";
|
|
11
|
+
/** Default Sigstore OAuth client ID */
|
|
12
|
+
export declare const SIGSTORE_CLIENT_ID = "sigstore";
|
|
13
|
+
export interface OAuthIdentityProviderOptions {
|
|
14
|
+
/** OIDC issuer URL (default: Sigstore public instance) */
|
|
15
|
+
issuer?: string;
|
|
16
|
+
/** OAuth client ID (default: "sigstore") */
|
|
17
|
+
clientID?: string;
|
|
18
|
+
/** OAuth client secret (optional, not needed for public clients) */
|
|
19
|
+
clientSecret?: string;
|
|
20
|
+
/** Redirect URL (optional, auto-generated if not provided) */
|
|
21
|
+
redirectURL?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* IdentityProvider interface - matches sigstore's expected interface
|
|
25
|
+
*/
|
|
26
|
+
export interface IdentityProvider {
|
|
27
|
+
getToken: () => Promise<string>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* OAuthIdentityProvider implements interactive browser-based OAuth flow
|
|
31
|
+
* to obtain an OIDC token for keyless signing.
|
|
32
|
+
*/
|
|
33
|
+
export declare class OAuthIdentityProvider implements IdentityProvider {
|
|
34
|
+
private server;
|
|
35
|
+
private issuer;
|
|
36
|
+
private clientID;
|
|
37
|
+
private clientSecret;
|
|
38
|
+
constructor(options?: OAuthIdentityProviderOptions);
|
|
39
|
+
/**
|
|
40
|
+
* Get an OIDC token by performing interactive OAuth flow.
|
|
41
|
+
* Opens a browser for the user to authenticate.
|
|
42
|
+
*/
|
|
43
|
+
getToken(): Promise<string>;
|
|
44
|
+
}
|
|
45
|
+
export { CallbackServer } from "./server";
|
|
46
|
+
export { OAuthClient, initializeOAuthClient } from "./client";
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sigstore/oauth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,oCAAoC;AACpC,eAAO,MAAM,qBAAqB,qCAAqC,CAAC;AAExE,uCAAuC;AACvC,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAE7C,MAAM,WAAW,4BAA4B;IAC3C,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CACjC;AAED;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,gBAAgB;IAC5D,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,YAAY,CAAqB;gBAE7B,OAAO,GAAE,4BAAiC;IAiBtD;;;OAGG;IACU,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;CAsBzC;AAGD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth Identity Provider
|
|
3
|
+
*
|
|
4
|
+
* Provides interactive OIDC authentication for keyless signing.
|
|
5
|
+
* Opens a browser for the user to authenticate with their identity provider
|
|
6
|
+
* (GitHub, Google, Microsoft) and returns an OIDC token that can be used
|
|
7
|
+
* with Fulcio to obtain a signing certificate.
|
|
8
|
+
*/
|
|
9
|
+
import open from "open";
|
|
10
|
+
import { initializeOAuthClient } from "./client";
|
|
11
|
+
import { CallbackServer } from "./server";
|
|
12
|
+
/** Default Sigstore OAuth issuer */
|
|
13
|
+
export const SIGSTORE_OAUTH_ISSUER = "https://oauth2.sigstore.dev/auth";
|
|
14
|
+
/** Default Sigstore OAuth client ID */
|
|
15
|
+
export const SIGSTORE_CLIENT_ID = "sigstore";
|
|
16
|
+
/**
|
|
17
|
+
* OAuthIdentityProvider implements interactive browser-based OAuth flow
|
|
18
|
+
* to obtain an OIDC token for keyless signing.
|
|
19
|
+
*/
|
|
20
|
+
export class OAuthIdentityProvider {
|
|
21
|
+
server;
|
|
22
|
+
issuer;
|
|
23
|
+
clientID;
|
|
24
|
+
clientSecret;
|
|
25
|
+
constructor(options = {}) {
|
|
26
|
+
this.issuer = options.issuer ?? SIGSTORE_OAUTH_ISSUER;
|
|
27
|
+
this.clientID = options.clientID ?? SIGSTORE_CLIENT_ID;
|
|
28
|
+
this.clientSecret = options.clientSecret;
|
|
29
|
+
let serverOpts;
|
|
30
|
+
if (options.redirectURL) {
|
|
31
|
+
const url = new URL(options.redirectURL);
|
|
32
|
+
serverOpts = { hostname: url.hostname, port: Number(url.port) };
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
// Use random port on localhost
|
|
36
|
+
serverOpts = { hostname: "localhost", port: 0 };
|
|
37
|
+
}
|
|
38
|
+
this.server = new CallbackServer(serverOpts);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get an OIDC token by performing interactive OAuth flow.
|
|
42
|
+
* Opens a browser for the user to authenticate.
|
|
43
|
+
*/
|
|
44
|
+
async getToken() {
|
|
45
|
+
// Start server to receive OAuth callback
|
|
46
|
+
const serverURL = await this.server.start();
|
|
47
|
+
// Initialize OAuth client with discovered configuration
|
|
48
|
+
const client = await initializeOAuthClient({
|
|
49
|
+
issuer: this.issuer,
|
|
50
|
+
redirectURL: serverURL,
|
|
51
|
+
clientID: this.clientID,
|
|
52
|
+
clientSecret: this.clientSecret,
|
|
53
|
+
});
|
|
54
|
+
// Open browser to OAuth login page
|
|
55
|
+
await open(client.authorizationUrl);
|
|
56
|
+
if (!this.server.callback) {
|
|
57
|
+
throw new Error("callback server not started");
|
|
58
|
+
}
|
|
59
|
+
// Wait for callback and exchange auth code for ID token
|
|
60
|
+
return this.server.callback.then((callbackURL) => client.getIDToken(callbackURL));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Re-export for convenience
|
|
64
|
+
export { CallbackServer } from "./server";
|
|
65
|
+
export { OAuthClient, initializeOAuthClient } from "./client";
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sigstore/oauth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAA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AAS;YACtB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC,CAAC;QAEH,mCAAmC;QACnC,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAEpC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QAED,wDAAwD;QACxD,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;IACpF,CAAC;CACF;AAED,4BAA4B;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth Callback Server
|
|
3
|
+
*
|
|
4
|
+
* A simple HTTP server that receives the OAuth redirect callback
|
|
5
|
+
* after the user authenticates in their browser.
|
|
6
|
+
*/
|
|
7
|
+
interface CallbackServerOptions {
|
|
8
|
+
port: number;
|
|
9
|
+
hostname: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* CallbackServer is a simple HTTP server which receives the OAuth
|
|
13
|
+
* redirect from the OAuth provider after the user signs-in. It will shutdown
|
|
14
|
+
* once the callback is received and the callback promise will resolve with
|
|
15
|
+
* the URL of the incoming request.
|
|
16
|
+
*/
|
|
17
|
+
export declare class CallbackServer {
|
|
18
|
+
private server;
|
|
19
|
+
private sockets;
|
|
20
|
+
private port;
|
|
21
|
+
private hostname;
|
|
22
|
+
callback: Promise<string> | undefined;
|
|
23
|
+
constructor(options: CallbackServerOptions);
|
|
24
|
+
start(): Promise<string>;
|
|
25
|
+
shutdown(): Promise<void>;
|
|
26
|
+
private serverURL;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/sigstore/oauth/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,QAAQ,CAAS;IAElB,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;gBAEjC,OAAO,EAAE,qBAAqB;IAOpC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IA4BjB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAWtC,OAAO,CAAC,SAAS;CAWlB"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth Callback Server
|
|
3
|
+
*
|
|
4
|
+
* A simple HTTP server that receives the OAuth redirect callback
|
|
5
|
+
* after the user authenticates in their browser.
|
|
6
|
+
*/
|
|
7
|
+
import http from "node:http";
|
|
8
|
+
/**
|
|
9
|
+
* CallbackServer is a simple HTTP server which receives the OAuth
|
|
10
|
+
* redirect from the OAuth provider after the user signs-in. It will shutdown
|
|
11
|
+
* once the callback is received and the callback promise will resolve with
|
|
12
|
+
* the URL of the incoming request.
|
|
13
|
+
*/
|
|
14
|
+
export class CallbackServer {
|
|
15
|
+
server;
|
|
16
|
+
sockets;
|
|
17
|
+
port;
|
|
18
|
+
hostname;
|
|
19
|
+
callback;
|
|
20
|
+
constructor(options) {
|
|
21
|
+
this.server = http.createServer();
|
|
22
|
+
this.sockets = new Set();
|
|
23
|
+
this.port = options.port;
|
|
24
|
+
this.hostname = options.hostname;
|
|
25
|
+
}
|
|
26
|
+
async start() {
|
|
27
|
+
await new Promise((resolve) => {
|
|
28
|
+
this.server.listen(this.port, this.hostname, resolve);
|
|
29
|
+
});
|
|
30
|
+
// Keep track of connections so we can force a shutdown
|
|
31
|
+
this.server.on("connection", (socket) => {
|
|
32
|
+
this.sockets.add(socket);
|
|
33
|
+
socket.on("close", () => {
|
|
34
|
+
this.sockets.delete(socket);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
// The callback will resolve with the incoming request URL
|
|
38
|
+
this.callback = new Promise((resolve) => {
|
|
39
|
+
this.server.on("request", ({ url }, res) => {
|
|
40
|
+
res.writeHead(200, { "Content-Type": "text/html" });
|
|
41
|
+
res.end(AUTH_SUCCESS_HTML);
|
|
42
|
+
// Shutdown the server and resolve the callback promise
|
|
43
|
+
this.shutdown().then(() => resolve(url));
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
// Calculate and return the URL which can be used to reach the server
|
|
47
|
+
return this.serverURL(this.server);
|
|
48
|
+
}
|
|
49
|
+
async shutdown() {
|
|
50
|
+
// Destroy all sockets and close the server
|
|
51
|
+
return new Promise((resolve) => {
|
|
52
|
+
for (const socket of this.sockets) {
|
|
53
|
+
socket.destroy();
|
|
54
|
+
this.sockets.delete(socket);
|
|
55
|
+
}
|
|
56
|
+
this.server.close(() => resolve());
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
serverURL(server) {
|
|
60
|
+
const address = server.address();
|
|
61
|
+
if (address === null) {
|
|
62
|
+
throw new Error("invalid server config: address is null");
|
|
63
|
+
}
|
|
64
|
+
if (typeof address === "string") {
|
|
65
|
+
throw new Error("invalid server config: address is a string");
|
|
66
|
+
}
|
|
67
|
+
return `http://${this.hostname}:${address.port}`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Success HTML page shown after authentication
|
|
71
|
+
const AUTH_SUCCESS_HTML = `
|
|
72
|
+
<!DOCTYPE html>
|
|
73
|
+
<html>
|
|
74
|
+
<head>
|
|
75
|
+
<title>Enact - Authentication Successful</title>
|
|
76
|
+
<style>
|
|
77
|
+
:root { font-family: system-ui, -apple-system, sans-serif; }
|
|
78
|
+
body {
|
|
79
|
+
display: flex;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
align-items: center;
|
|
82
|
+
min-height: 100vh;
|
|
83
|
+
margin: 0;
|
|
84
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
85
|
+
}
|
|
86
|
+
.container {
|
|
87
|
+
background: white;
|
|
88
|
+
padding: 3rem;
|
|
89
|
+
border-radius: 1rem;
|
|
90
|
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
|
|
91
|
+
text-align: center;
|
|
92
|
+
max-width: 400px;
|
|
93
|
+
}
|
|
94
|
+
.checkmark {
|
|
95
|
+
width: 80px;
|
|
96
|
+
height: 80px;
|
|
97
|
+
margin: 0 auto 1.5rem;
|
|
98
|
+
background: #10b981;
|
|
99
|
+
border-radius: 50%;
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
}
|
|
104
|
+
.checkmark svg {
|
|
105
|
+
width: 40px;
|
|
106
|
+
height: 40px;
|
|
107
|
+
stroke: white;
|
|
108
|
+
stroke-width: 3;
|
|
109
|
+
fill: none;
|
|
110
|
+
}
|
|
111
|
+
h1 {
|
|
112
|
+
color: #1f2937;
|
|
113
|
+
margin: 0 0 0.5rem;
|
|
114
|
+
font-size: 1.5rem;
|
|
115
|
+
}
|
|
116
|
+
p {
|
|
117
|
+
color: #6b7280;
|
|
118
|
+
margin: 0;
|
|
119
|
+
font-size: 1rem;
|
|
120
|
+
}
|
|
121
|
+
.brand {
|
|
122
|
+
margin-top: 2rem;
|
|
123
|
+
color: #9ca3af;
|
|
124
|
+
font-size: 0.875rem;
|
|
125
|
+
}
|
|
126
|
+
.brand strong {
|
|
127
|
+
color: #667eea;
|
|
128
|
+
}
|
|
129
|
+
</style>
|
|
130
|
+
</head>
|
|
131
|
+
<body>
|
|
132
|
+
<div class="container">
|
|
133
|
+
<div class="checkmark">
|
|
134
|
+
<svg viewBox="0 0 24 24">
|
|
135
|
+
<polyline points="20 6 9 17 4 12"></polyline>
|
|
136
|
+
</svg>
|
|
137
|
+
</div>
|
|
138
|
+
<h1>Authentication Successful!</h1>
|
|
139
|
+
<p>You may now close this window and return to your terminal.</p>
|
|
140
|
+
<p class="brand">Signed with <strong>Sigstore</strong> via <strong>Enact</strong></p>
|
|
141
|
+
</div>
|
|
142
|
+
</body>
|
|
143
|
+
</html>
|
|
144
|
+
`;
|
|
145
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/sigstore/oauth/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAQ7B;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IACjB,MAAM,CAAc;IACpB,OAAO,CAAc;IACrB,IAAI,CAAS;IACb,QAAQ,CAAS;IAElB,QAAQ,CAA8B;IAE7C,YAAY,OAA8B;QACxC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAClC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,uDAAuD;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CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,SAAS,CAAC,MAAmB;QACnC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QACjC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;QACD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAChE,CAAC;QAED,OAAO,UAAU,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IACnD,CAAC;CACF;AAED,+CAA+C;AAC/C,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyEzB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trust policy evaluation module
|
|
3
|
+
*
|
|
4
|
+
* This module provides functions for creating and evaluating trust policies
|
|
5
|
+
* that determine whether an artifact should be trusted based on its attestations.
|
|
6
|
+
*/
|
|
7
|
+
import type { SigstoreBundle, TrustPolicy, TrustPolicyResult, TrustedIdentityRule } from "./types";
|
|
8
|
+
/**
|
|
9
|
+
* Default trust policy - requires publisher attestation
|
|
10
|
+
*/
|
|
11
|
+
export declare const DEFAULT_TRUST_POLICY: TrustPolicy;
|
|
12
|
+
/**
|
|
13
|
+
* Permissive policy - allows unsigned tools (for development)
|
|
14
|
+
*/
|
|
15
|
+
export declare const PERMISSIVE_POLICY: TrustPolicy;
|
|
16
|
+
/**
|
|
17
|
+
* Strict policy - requires publisher + auditor attestations and SLSA level 2+
|
|
18
|
+
*/
|
|
19
|
+
export declare const STRICT_POLICY: TrustPolicy;
|
|
20
|
+
/**
|
|
21
|
+
* Create a trust policy
|
|
22
|
+
*
|
|
23
|
+
* @param options - Policy options
|
|
24
|
+
* @returns The trust policy
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const policy = createTrustPolicy({
|
|
29
|
+
* name: "my-org-policy",
|
|
30
|
+
* trustedPublishers: [
|
|
31
|
+
* { name: "My Team", type: "email", pattern: "*@myorg.com" }
|
|
32
|
+
* ],
|
|
33
|
+
* minimumSLSALevel: 1
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function createTrustPolicy(options: Partial<TrustPolicy> & {
|
|
38
|
+
name: string;
|
|
39
|
+
}): TrustPolicy;
|
|
40
|
+
/**
|
|
41
|
+
* Create a trusted identity rule
|
|
42
|
+
*
|
|
43
|
+
* @param name - Rule name
|
|
44
|
+
* @param type - Identity type
|
|
45
|
+
* @param pattern - Pattern to match
|
|
46
|
+
* @param options - Additional options
|
|
47
|
+
* @returns The identity rule
|
|
48
|
+
*/
|
|
49
|
+
export declare function createIdentityRule(name: string, type: TrustedIdentityRule["type"], pattern: string, options?: {
|
|
50
|
+
issuer?: string;
|
|
51
|
+
requiredClaims?: Record<string, string | string[]>;
|
|
52
|
+
}): TrustedIdentityRule;
|
|
53
|
+
/**
|
|
54
|
+
* Evaluate trust policy for a set of attestations
|
|
55
|
+
*
|
|
56
|
+
* @param attestationBundles - Array of Sigstore bundles containing attestations
|
|
57
|
+
* @param policy - The trust policy to evaluate against
|
|
58
|
+
* @returns The trust policy evaluation result
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* const result = await evaluateTrustPolicy(bundles, myPolicy);
|
|
63
|
+
* if (result.trusted) {
|
|
64
|
+
* console.log(`Trusted at level ${result.trustLevel}`);
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function evaluateTrustPolicy(attestationBundles: SigstoreBundle[], policy: TrustPolicy): Promise<TrustPolicyResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Quick check if an artifact should be trusted
|
|
71
|
+
*
|
|
72
|
+
* @param attestationBundles - Array of Sigstore bundles
|
|
73
|
+
* @param policy - Trust policy (defaults to DEFAULT_TRUST_POLICY)
|
|
74
|
+
* @returns True if artifact is trusted
|
|
75
|
+
*/
|
|
76
|
+
export declare function isTrusted(attestationBundles: SigstoreBundle[], policy?: TrustPolicy): Promise<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* Serialize a trust policy to JSON
|
|
79
|
+
*/
|
|
80
|
+
export declare function serializeTrustPolicy(policy: TrustPolicy): string;
|
|
81
|
+
/**
|
|
82
|
+
* Deserialize a trust policy from JSON
|
|
83
|
+
*/
|
|
84
|
+
export declare function deserializeTrustPolicy(json: string): TrustPolicy;
|
|
85
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/sigstore/policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAGV,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EAEpB,MAAM,SAAS,CAAC;AAOjB;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,WASlC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAS/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,WAS3B,CAAC;AAMF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAM/F;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,EACjC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAA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