@tinfoilsh/verifier 1.0.4 → 1.0.5
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/README.md +4 -3
- package/dist/attestation.d.ts.map +1 -1
- package/dist/attestation.js +8 -7
- package/dist/attestation.js.map +1 -1
- package/dist/cert-verify.d.ts +2 -4
- package/dist/cert-verify.d.ts.map +1 -1
- package/dist/cert-verify.js +12 -16
- package/dist/cert-verify.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +11 -23
- package/dist/client.js.map +1 -1
- package/dist/dcode.d.ts.map +1 -1
- package/dist/dcode.js +3 -2
- package/dist/dcode.js.map +1 -1
- package/dist/errors.d.ts +90 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +102 -0
- package/dist/errors.js.map +1 -0
- package/dist/github.d.ts +3 -3
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +11 -16
- package/dist/github.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/sev/cert-chain.d.ts.map +1 -1
- package/dist/sev/cert-chain.js +40 -39
- package/dist/sev/cert-chain.js.map +1 -1
- package/dist/sev/report.d.ts.map +1 -1
- package/dist/sev/report.js +19 -18
- package/dist/sev/report.js.map +1 -1
- package/dist/sev/validation.d.ts.map +1 -1
- package/dist/sev/validation.js +53 -52
- package/dist/sev/validation.js.map +1 -1
- package/dist/sev/verify.d.ts.map +1 -1
- package/dist/sev/verify.js +8 -7
- package/dist/sev/verify.js.map +1 -1
- package/dist/sigstore.d.ts +5 -4
- package/dist/sigstore.d.ts.map +1 -1
- package/dist/sigstore.js +14 -12
- package/dist/sigstore.js.map +1 -1
- package/dist/types.d.ts +1 -13
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -26
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,10 +57,11 @@ console.log(doc.securityVerified);
|
|
|
57
57
|
|
|
58
58
|
## Error Handling
|
|
59
59
|
|
|
60
|
-
For callers that want structured error handling, these
|
|
60
|
+
For callers that want structured error handling, these error classes are part of the public API:
|
|
61
61
|
|
|
62
|
-
- `
|
|
63
|
-
- `
|
|
62
|
+
- `ConfigurationError` — client misconfigured (e.g., missing required options)
|
|
63
|
+
- `FetchError` — network or HTTP errors when fetching attestation material
|
|
64
|
+
- `AttestationError` — attestation verification failed (parsing, signatures, certificates, measurement mismatch, policy violation)
|
|
64
65
|
|
|
65
66
|
## Inspecting Verification Results
|
|
66
67
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attestation.d.ts","sourceRoot":"","sources":["../src/attestation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"attestation.d.ts","sourceRoot":"","sources":["../src/attestation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAW3E;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAcjF;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAOnH"}
|
package/dist/attestation.js
CHANGED
|
@@ -4,6 +4,7 @@ import { CertificateChain } from './sev/cert-chain.js';
|
|
|
4
4
|
import { verifyAttestation as verifyAttestationInternal } from './sev/verify.js';
|
|
5
5
|
import { bytesToHex } from './sev/utils.js';
|
|
6
6
|
import { validateReport, defaultValidationOptions } from './sev/validation.js';
|
|
7
|
+
import { FetchError, AttestationError, wrapOrThrow } from './errors.js';
|
|
7
8
|
const ATTESTATION_ENDPOINT = '/.well-known/tinfoil-attestation';
|
|
8
9
|
/**
|
|
9
10
|
* Retrieves the attestation document from a given enclave hostname.
|
|
@@ -16,7 +17,7 @@ export async function fetchAttestation(host) {
|
|
|
16
17
|
const url = `https://${host}${ATTESTATION_ENDPOINT}`;
|
|
17
18
|
const response = await fetch(url);
|
|
18
19
|
if (!response.ok) {
|
|
19
|
-
throw new
|
|
20
|
+
throw new FetchError(`Failed to fetch attestation document from ${host}: HTTP ${response.status} ${response.statusText}`);
|
|
20
21
|
}
|
|
21
22
|
const docDict = await response.json();
|
|
22
23
|
return {
|
|
@@ -39,7 +40,7 @@ export async function verifyAttestation(doc, vcekBase64) {
|
|
|
39
40
|
return verifySevAttestationV2(doc.body, vcekDer);
|
|
40
41
|
}
|
|
41
42
|
else {
|
|
42
|
-
throw new
|
|
43
|
+
throw new AttestationError(`Unsupported attestation document format: "${doc.format}". Only SEV-SNP Guest V2 format is supported`);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
/**
|
|
@@ -80,7 +81,7 @@ async function verifySevReport(attestationDoc, isCompressed, vcekDer) {
|
|
|
80
81
|
attDocBytes = base64ToBytes(attestationDoc);
|
|
81
82
|
}
|
|
82
83
|
catch (e) {
|
|
83
|
-
throw new
|
|
84
|
+
throw new AttestationError('Failed to decode attestation document: Invalid base64 encoding', { cause: e });
|
|
84
85
|
}
|
|
85
86
|
if (isCompressed) {
|
|
86
87
|
attDocBytes = await decompressGzip(attDocBytes);
|
|
@@ -90,7 +91,7 @@ async function verifySevReport(attestationDoc, isCompressed, vcekDer) {
|
|
|
90
91
|
report = new Report(attDocBytes);
|
|
91
92
|
}
|
|
92
93
|
catch (e) {
|
|
93
|
-
throw new
|
|
94
|
+
throw new AttestationError('Failed to parse SEV-SNP attestation report', { cause: e });
|
|
94
95
|
}
|
|
95
96
|
const chain = await CertificateChain.fromReport(report, vcekDer);
|
|
96
97
|
let res;
|
|
@@ -98,16 +99,16 @@ async function verifySevReport(attestationDoc, isCompressed, vcekDer) {
|
|
|
98
99
|
res = await verifyAttestationInternal(chain, report);
|
|
99
100
|
}
|
|
100
101
|
catch (e) {
|
|
101
|
-
|
|
102
|
+
wrapOrThrow(e, AttestationError, 'Attestation cryptographic verification failed');
|
|
102
103
|
}
|
|
103
104
|
if (!res) {
|
|
104
|
-
throw new
|
|
105
|
+
throw new AttestationError('Attestation verification failed: Report signature or certificate chain is invalid');
|
|
105
106
|
}
|
|
106
107
|
try {
|
|
107
108
|
validateReport(report, chain, defaultValidationOptions);
|
|
108
109
|
}
|
|
109
110
|
catch (e) {
|
|
110
|
-
|
|
111
|
+
wrapOrThrow(e, AttestationError, 'Attestation policy validation failed');
|
|
111
112
|
}
|
|
112
113
|
return report;
|
|
113
114
|
}
|
package/dist/attestation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attestation.js","sourceRoot":"","sources":["../src/attestation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"attestation.js","sourceRoot":"","sources":["../src/attestation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,UAA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AAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;QAC/E,MAAM,YAAY,GAAG,MAAM,IAAI,QAAQ,CAAC,kBAAkB,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1E,OAAO,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;IAED,+BAA+B;IAC/B,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC"}
|
package/dist/cert-verify.d.ts
CHANGED
|
@@ -15,9 +15,6 @@ export interface CertVerificationResult {
|
|
|
15
15
|
/** DNS names from certificate SANs */
|
|
16
16
|
dnsNames: string[];
|
|
17
17
|
}
|
|
18
|
-
export declare class CertificateVerificationError extends Error {
|
|
19
|
-
constructor(message: string);
|
|
20
|
-
}
|
|
21
18
|
/**
|
|
22
19
|
* Verify enclave TLS certificate.
|
|
23
20
|
*
|
|
@@ -26,7 +23,8 @@ export declare class CertificateVerificationError extends Error {
|
|
|
26
23
|
* @param attestationDoc - Attestation document to verify hash against
|
|
27
24
|
* @param expectedHpkeKey - Expected HPKE public key (hex)
|
|
28
25
|
* @returns Verification result with extracted values
|
|
29
|
-
* @throws
|
|
26
|
+
* @throws AttestationError if certificate parsing or decoding fails
|
|
27
|
+
* @throws AttestationError if certificate values don't match expected values
|
|
30
28
|
*/
|
|
31
29
|
export declare function verifyCertificate(certPem: string, expectedDomain: string, attestationDoc: AttestationDocument, expectedHpkeKey: string): Promise<CertVerificationResult>;
|
|
32
30
|
//# sourceMappingURL=cert-verify.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cert-verify.d.ts","sourceRoot":"","sources":["../src/cert-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"cert-verify.d.ts","sourceRoot":"","sources":["../src/cert-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AA4DtD,MAAM,WAAW,sBAAsB;IACrC,uDAAuD;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,eAAe,EAAE,MAAM,CAAC;IACxB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,mBAAmB,EACnC,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,sBAAsB,CAAC,CA+EjC"}
|
package/dist/cert-verify.js
CHANGED
|
@@ -10,6 +10,7 @@ import { X509Certificate } from '@freedomofpress/sigstore-browser';
|
|
|
10
10
|
import { ASN1Obj } from '@freedomofpress/crypto-browser';
|
|
11
11
|
import { decodeDomains, bytesToHex } from './dcode.js';
|
|
12
12
|
import { hashAttestationDocument } from './types.js';
|
|
13
|
+
import { AttestationError } from './errors.js';
|
|
13
14
|
/**
|
|
14
15
|
* Extract DNS names from Subject Alternative Name extension
|
|
15
16
|
* Uses ASN1Obj parser for proper ASN.1 handling
|
|
@@ -59,12 +60,6 @@ function domainMatchesSans(sans, expectedDomain) {
|
|
|
59
60
|
}
|
|
60
61
|
return false;
|
|
61
62
|
}
|
|
62
|
-
export class CertificateVerificationError extends Error {
|
|
63
|
-
constructor(message) {
|
|
64
|
-
super(message);
|
|
65
|
-
this.name = 'CertificateVerificationError';
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
63
|
/**
|
|
69
64
|
* Verify enclave TLS certificate.
|
|
70
65
|
*
|
|
@@ -73,7 +68,8 @@ export class CertificateVerificationError extends Error {
|
|
|
73
68
|
* @param attestationDoc - Attestation document to verify hash against
|
|
74
69
|
* @param expectedHpkeKey - Expected HPKE public key (hex)
|
|
75
70
|
* @returns Verification result with extracted values
|
|
76
|
-
* @throws
|
|
71
|
+
* @throws AttestationError if certificate parsing or decoding fails
|
|
72
|
+
* @throws AttestationError if certificate values don't match expected values
|
|
77
73
|
*/
|
|
78
74
|
export async function verifyCertificate(certPem, expectedDomain, attestationDoc, expectedHpkeKey) {
|
|
79
75
|
// 1. Parse PEM certificate
|
|
@@ -82,50 +78,50 @@ export async function verifyCertificate(certPem, expectedDomain, attestationDoc,
|
|
|
82
78
|
cert = X509Certificate.parse(certPem);
|
|
83
79
|
}
|
|
84
80
|
catch (error) {
|
|
85
|
-
throw new
|
|
81
|
+
throw new AttestationError(`Failed to parse enclave TLS certificate: ${error.message}`, { cause: error });
|
|
86
82
|
}
|
|
87
83
|
// 2. Extract SANs
|
|
88
84
|
const sans = extractSANs(cert);
|
|
89
85
|
if (sans.length === 0) {
|
|
90
|
-
throw new
|
|
86
|
+
throw new AttestationError('Invalid enclave certificate: No Subject Alternative Names found');
|
|
91
87
|
}
|
|
92
88
|
// 3. Verify domain
|
|
93
89
|
if (!domainMatchesSans(sans, expectedDomain)) {
|
|
94
|
-
throw new
|
|
90
|
+
throw new AttestationError(`Certificate domain mismatch: Certificate is not valid for "${expectedDomain}"`);
|
|
95
91
|
}
|
|
96
92
|
// 4. Extract and verify HPKE key
|
|
97
93
|
const hpkeSans = sans.filter(s => s.includes('.hpke.'));
|
|
98
94
|
if (hpkeSans.length === 0) {
|
|
99
|
-
throw new
|
|
95
|
+
throw new AttestationError('Invalid enclave certificate: No HPKE key embedded in Subject Alternative Names');
|
|
100
96
|
}
|
|
101
97
|
let hpkeKeyBytes;
|
|
102
98
|
try {
|
|
103
99
|
hpkeKeyBytes = decodeDomains(hpkeSans, 'hpke');
|
|
104
100
|
}
|
|
105
101
|
catch (error) {
|
|
106
|
-
throw new
|
|
102
|
+
throw new AttestationError(`Failed to extract HPKE key from certificate: ${error.message}`, { cause: error });
|
|
107
103
|
}
|
|
108
104
|
const hpkePublicKey = bytesToHex(hpkeKeyBytes);
|
|
109
105
|
if (hpkePublicKey !== expectedHpkeKey) {
|
|
110
|
-
throw new
|
|
106
|
+
throw new AttestationError('HPKE key mismatch: The encryption key in the certificate does not match the attested key');
|
|
111
107
|
}
|
|
112
108
|
// 5. Extract and verify attestation hash
|
|
113
109
|
const hattSans = sans.filter(s => s.includes('.hatt.'));
|
|
114
110
|
if (hattSans.length === 0) {
|
|
115
|
-
throw new
|
|
111
|
+
throw new AttestationError('Invalid enclave certificate: No attestation hash embedded in Subject Alternative Names');
|
|
116
112
|
}
|
|
117
113
|
let hashBytes;
|
|
118
114
|
try {
|
|
119
115
|
hashBytes = decodeDomains(hattSans, 'hatt');
|
|
120
116
|
}
|
|
121
117
|
catch (error) {
|
|
122
|
-
throw new
|
|
118
|
+
throw new AttestationError(`Failed to extract attestation hash from certificate: ${error.message}`, { cause: error });
|
|
123
119
|
}
|
|
124
120
|
// The hash is stored as the hex string bytes
|
|
125
121
|
const certAttestationHash = new TextDecoder().decode(hashBytes);
|
|
126
122
|
const computedHash = await hashAttestationDocument(attestationDoc);
|
|
127
123
|
if (certAttestationHash !== computedHash) {
|
|
128
|
-
throw new
|
|
124
|
+
throw new AttestationError('Attestation hash mismatch: The hash in the certificate does not match the attestation document');
|
|
129
125
|
}
|
|
130
126
|
return {
|
|
131
127
|
hpkePublicKey,
|
package/dist/cert-verify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cert-verify.js","sourceRoot":"","sources":["../src/cert-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM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S,GAAG,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,gBAAgB,CACxB,wDAAyD,KAAe,CAAC,OAAO,EAAE,EAClF,EAAE,KAAK,EAAE,KAAc,EAAE,CAC1B,CAAC;IACJ,CAAC;IAED,6CAA6C;IAC7C,MAAM,mBAAmB,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAChE,MAAM,YAAY,GAAG,MAAM,uBAAuB,CAAC,cAAc,CAAC,CAAC;IAEnE,IAAI,mBAAmB,KAAK,YAAY,EAAE,CAAC;QACzC,MAAM,IAAI,gBAAgB,CACxB,gGAAgG,CACjG,CAAC;IACJ,CAAC;IAED,OAAO;QACL,aAAa;QACb,eAAe,EAAE,YAAY;QAC7B,QAAQ,EAAE,IAAI;KACf,CAAC;AACJ,CAAC"}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAA+C,mBAAmB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAA+C,mBAAmB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG5I,MAAM,WAAW,eAAe;IAC9B,6GAA6G;IAC7G,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,oBAAoB,CAAC,CAAuB;gBAExC,OAAO,EAAE,eAAe;IAQ9B,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAYtC,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;YAc7D,mBAAmB;IA2FjC,OAAO,CAAC,8BAA8B;IAiBtC,uBAAuB,IAAI,oBAAoB,GAAG,SAAS;CAG5D"}
|
package/dist/client.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { verifyAttestation as verifyAmdAttestation, fetchAttestation } from './attestation.js';
|
|
2
2
|
import { fetchLatestDigest, fetchGithubAttestationBundle } from './github.js';
|
|
3
|
-
import {
|
|
4
|
-
import { verifyCertificate
|
|
5
|
-
import { compareMeasurements,
|
|
3
|
+
import { verifySigstoreBundle } from './sigstore.js';
|
|
4
|
+
import { verifyCertificate } from './cert-verify.js';
|
|
5
|
+
import { compareMeasurements, measurementFingerprint } from './types.js';
|
|
6
|
+
import { ConfigurationError } from './errors.js';
|
|
6
7
|
export class Verifier {
|
|
7
8
|
serverURL;
|
|
8
9
|
configRepo;
|
|
9
10
|
verificationDocument;
|
|
10
11
|
constructor(options) {
|
|
11
12
|
if (!options.configRepo) {
|
|
12
|
-
throw new
|
|
13
|
+
throw new ConfigurationError("configRepo is required for Verifier");
|
|
13
14
|
}
|
|
14
15
|
this.serverURL = options.serverURL;
|
|
15
16
|
this.configRepo = options.configRepo;
|
|
16
17
|
}
|
|
17
18
|
async verify() {
|
|
18
19
|
if (!this.serverURL) {
|
|
19
|
-
throw new
|
|
20
|
+
throw new ConfigurationError("serverURL is required for verify(). Use verifyBundle() with an attestation bundle instead.");
|
|
20
21
|
}
|
|
21
22
|
const domain = new URL(this.serverURL).hostname;
|
|
22
23
|
const attestationDoc = await fetchAttestation(domain);
|
|
@@ -26,7 +27,7 @@ export class Verifier {
|
|
|
26
27
|
}
|
|
27
28
|
async verifyBundle(bundle) {
|
|
28
29
|
if (!bundle.enclaveCert) {
|
|
29
|
-
throw new
|
|
30
|
+
throw new ConfigurationError('enclaveCert is required for bundle verification');
|
|
30
31
|
}
|
|
31
32
|
return this.performVerification(bundle.enclaveAttestationReport, bundle.vcek, bundle.digest, bundle.sigstoreBundle, bundle.domain, bundle.enclaveCert);
|
|
32
33
|
}
|
|
@@ -50,10 +51,10 @@ export class Verifier {
|
|
|
50
51
|
this.saveFailedVerificationDocument(steps, domain);
|
|
51
52
|
throw error;
|
|
52
53
|
}
|
|
53
|
-
// Step 2: Verify code
|
|
54
|
+
// Step 2: Verify code provenance (Sigstore bundle)
|
|
54
55
|
let codeMeasurements;
|
|
55
56
|
try {
|
|
56
|
-
codeMeasurements = await
|
|
57
|
+
codeMeasurements = await verifySigstoreBundle(sigstoreBundle, digest, this.configRepo);
|
|
57
58
|
steps.verifyCode = { status: 'success' };
|
|
58
59
|
}
|
|
59
60
|
catch (error) {
|
|
@@ -67,15 +68,7 @@ export class Verifier {
|
|
|
67
68
|
steps.compareMeasurements = { status: 'success' };
|
|
68
69
|
}
|
|
69
70
|
catch (error) {
|
|
70
|
-
|
|
71
|
-
steps.compareMeasurements = { status: 'failed', error: error.message };
|
|
72
|
-
}
|
|
73
|
-
else if (error instanceof MeasurementMismatchError) {
|
|
74
|
-
steps.compareMeasurements = { status: 'failed', error: error.message };
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
steps.compareMeasurements = { status: 'failed', error: error.message };
|
|
78
|
-
}
|
|
71
|
+
steps.compareMeasurements = { status: 'failed', error: error.message };
|
|
79
72
|
this.saveFailedVerificationDocument(steps, domain);
|
|
80
73
|
throw error;
|
|
81
74
|
}
|
|
@@ -86,12 +79,7 @@ export class Verifier {
|
|
|
86
79
|
steps.verifyCertificate = { status: 'success' };
|
|
87
80
|
}
|
|
88
81
|
catch (error) {
|
|
89
|
-
|
|
90
|
-
steps.verifyCertificate = { status: 'failed', error: error.message };
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
steps.verifyCertificate = { status: 'failed', error: error.message };
|
|
94
|
-
}
|
|
82
|
+
steps.verifyCertificate = { status: 'failed', error: error.message };
|
|
95
83
|
this.saveFailedVerificationDocument(steps, domain);
|
|
96
84
|
throw error;
|
|
97
85
|
}
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAQjD,MAAM,OAAO,QAAQ;IACX,SAAS,CAAU;IACnB,UAAU,CAAS;IACnB,oBAAoB,CAAwB;IAEpD,YAAY,OAAwB;QAClC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YACxB,MAAM,IAAI,kBAAkB,CAAC,qCAAqC,CAAC,CAAC;QACtE,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,MAAM;QACV,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,kB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I,CAAC,oBAAoB,EAAE,CAAC;gBAC/B,IAAI,CAAC,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YACrD,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAEO,8BAA8B,CAAC,KAAoC,EAAE,MAAc;QACzF,IAAI,CAAC,oBAAoB,GAAG;YAC1B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,WAAW,EAAE,MAAM;YACnB,aAAa,EAAE,EAAE;YACjB,eAAe,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;YAC5C,kBAAkB,EAAE,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE;YAChE,YAAY,EAAE,EAAE;YAChB,aAAa,EAAE,EAAE;YACjB,eAAe,EAAE,EAAE;YACnB,kBAAkB,EAAE,EAAE;YACtB,sBAAsB,EAAE,MAAM;YAC9B,gBAAgB,EAAE,KAAK;YACvB,KAAK;SACN,CAAC;IACJ,CAAC;IAED,uBAAuB;QACrB,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;CACF"}
|
package/dist/dcode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dcode.d.ts","sourceRoot":"","sources":["../src/dcode.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"dcode.d.ts","sourceRoot":"","sources":["../src/dcode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAU3E;AAED,eAAO,MAAM,UAAU,GAAI,GAAG,UAAU,WACmB,CAAC"}
|
package/dist/dcode.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Decode dcode-encoded data from certificate SANs.
|
|
3
3
|
* Format: NN<base32-chunk>.<prefix>.<domain> where NN is chunk index.
|
|
4
4
|
*/
|
|
5
|
+
import { AttestationError } from './errors.js';
|
|
5
6
|
const B32 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
|
6
7
|
function base32Decode(input) {
|
|
7
8
|
const s = input.toUpperCase().replace(/=+$/, '');
|
|
@@ -12,7 +13,7 @@ function base32Decode(input) {
|
|
|
12
13
|
for (const c of s) {
|
|
13
14
|
const i = B32.indexOf(c);
|
|
14
15
|
if (i < 0)
|
|
15
|
-
throw new
|
|
16
|
+
throw new AttestationError(`Invalid certificate data: Unexpected character "${c}" in base32-encoded field`);
|
|
16
17
|
val = (val << 5) | i;
|
|
17
18
|
if ((bits += 5) >= 8)
|
|
18
19
|
out[idx++] = (val >> (bits -= 8)) & 0xff;
|
|
@@ -27,7 +28,7 @@ export function decodeDomains(domains, prefix) {
|
|
|
27
28
|
.map(d => d.split('.')[0].slice(2))
|
|
28
29
|
.join('');
|
|
29
30
|
if (!chunks)
|
|
30
|
-
throw new
|
|
31
|
+
throw new AttestationError(`Invalid certificate: Missing expected DNS names with prefix "${prefix}"`);
|
|
31
32
|
return base32Decode(chunks);
|
|
32
33
|
}
|
|
33
34
|
export const bytesToHex = (b) => [...b].map(x => x.toString(16).padStart(2, '0')).join('');
|
package/dist/dcode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dcode.js","sourceRoot":"","sources":["../src/dcode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,GAAG,GAAG,kCAAkC,CAAC;AAE/C,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,CAAC,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjD,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAEjC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CA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
3
|
+
*
|
|
4
|
+
* Hierarchy:
|
|
5
|
+
* ```
|
|
6
|
+
* TinfoilError (base)
|
|
7
|
+
* ├── ConfigurationError - Client misconfigured or used incorrectly
|
|
8
|
+
* ├── FetchError - Couldn't fetch attestation materials
|
|
9
|
+
* └── AttestationError - Attestation failed (security issue)
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Base error class for all Tinfoil SDK errors.
|
|
14
|
+
*/
|
|
15
|
+
export declare class TinfoilError extends Error {
|
|
16
|
+
constructor(message: string, options?: {
|
|
17
|
+
cause?: Error;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Thrown when the client is misconfigured or used incorrectly.
|
|
22
|
+
*
|
|
23
|
+
* Examples:
|
|
24
|
+
* - Missing required options (serverURL, configRepo, apiKey)
|
|
25
|
+
* - Invalid option values
|
|
26
|
+
* - Calling methods before client is ready
|
|
27
|
+
* - Using the wrong client type
|
|
28
|
+
*
|
|
29
|
+
* Action: Fix your code
|
|
30
|
+
*/
|
|
31
|
+
export declare class ConfigurationError extends TinfoilError {
|
|
32
|
+
constructor(message: string, options?: {
|
|
33
|
+
cause?: Error;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Thrown when fetching attestation materials fails.
|
|
38
|
+
*
|
|
39
|
+
* Examples:
|
|
40
|
+
* - Network unreachable
|
|
41
|
+
* - HTTP errors (404, 500, etc.)
|
|
42
|
+
* - Invalid response format (bad JSON, wrong schema)
|
|
43
|
+
* - Timeout
|
|
44
|
+
*
|
|
45
|
+
* Action: Retry, check network connectivity
|
|
46
|
+
*/
|
|
47
|
+
export declare class FetchError extends TinfoilError {
|
|
48
|
+
constructor(message: string, options?: {
|
|
49
|
+
cause?: Error;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Thrown when attestation verification fails.
|
|
54
|
+
*
|
|
55
|
+
* This covers all attestation-related security errors:
|
|
56
|
+
* - Material verification failures (parsing, signatures, certificates)
|
|
57
|
+
* - Policy validation failures (measurement mismatch, policy violation)
|
|
58
|
+
*
|
|
59
|
+
* Examples:
|
|
60
|
+
* - Data parsing failed (malformed report, invalid base64, bad structure)
|
|
61
|
+
* - Sigstore signature invalid
|
|
62
|
+
* - Hardware certificate chain invalid
|
|
63
|
+
* - Report signature invalid
|
|
64
|
+
* - Measurement mismatch (enclave code doesn't match signed release)
|
|
65
|
+
* - Policy violation (debug enabled, TCB too low)
|
|
66
|
+
* - Key binding mismatch (transport keys don't match attested keys)
|
|
67
|
+
*
|
|
68
|
+
* Action: Stop - security issue - you should retry the entire attestation protocol.
|
|
69
|
+
*/
|
|
70
|
+
export declare class AttestationError extends TinfoilError {
|
|
71
|
+
constructor(message: string, options?: {
|
|
72
|
+
cause?: Error;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Helper to handle errors in catch blocks.
|
|
77
|
+
* - If the error is already a TinfoilError, rethrow it as-is
|
|
78
|
+
* - Otherwise, wrap it in the specified error class
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* try {
|
|
83
|
+
* await someOperation();
|
|
84
|
+
* } catch (e) {
|
|
85
|
+
* wrapOrThrow(e, AttestationError, 'Operation failed');
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function wrapOrThrow(e: unknown, ErrorClass: typeof AttestationError | typeof FetchError | typeof ConfigurationError, message: string): never;
|
|
90
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE;CAOzD;AAED;;;;;;;;;;GAUG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;gBACtC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE;CAIzD;AAED;;;;;;;;;;GAUG;AACH,qBAAa,UAAW,SAAQ,YAAY;gBAC9B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE;CAIzD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;gBACpC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE;CAIzD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,CAAC,EAAE,OAAO,EACV,UAAU,EAAE,OAAO,gBAAgB,GAAG,OAAO,UAAU,GAAG,OAAO,kBAAkB,EACnF,OAAO,EAAE,MAAM,GACd,KAAK,CAKP"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error classes for the Tinfoil SDK.
|
|
3
|
+
*
|
|
4
|
+
* Hierarchy:
|
|
5
|
+
* ```
|
|
6
|
+
* TinfoilError (base)
|
|
7
|
+
* ├── ConfigurationError - Client misconfigured or used incorrectly
|
|
8
|
+
* ├── FetchError - Couldn't fetch attestation materials
|
|
9
|
+
* └── AttestationError - Attestation failed (security issue)
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Base error class for all Tinfoil SDK errors.
|
|
14
|
+
*/
|
|
15
|
+
export class TinfoilError extends Error {
|
|
16
|
+
constructor(message, options) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = 'TinfoilError';
|
|
19
|
+
if (options?.cause) {
|
|
20
|
+
this.cause = options.cause;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Thrown when the client is misconfigured or used incorrectly.
|
|
26
|
+
*
|
|
27
|
+
* Examples:
|
|
28
|
+
* - Missing required options (serverURL, configRepo, apiKey)
|
|
29
|
+
* - Invalid option values
|
|
30
|
+
* - Calling methods before client is ready
|
|
31
|
+
* - Using the wrong client type
|
|
32
|
+
*
|
|
33
|
+
* Action: Fix your code
|
|
34
|
+
*/
|
|
35
|
+
export class ConfigurationError extends TinfoilError {
|
|
36
|
+
constructor(message, options) {
|
|
37
|
+
super(message, options);
|
|
38
|
+
this.name = 'ConfigurationError';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Thrown when fetching attestation materials fails.
|
|
43
|
+
*
|
|
44
|
+
* Examples:
|
|
45
|
+
* - Network unreachable
|
|
46
|
+
* - HTTP errors (404, 500, etc.)
|
|
47
|
+
* - Invalid response format (bad JSON, wrong schema)
|
|
48
|
+
* - Timeout
|
|
49
|
+
*
|
|
50
|
+
* Action: Retry, check network connectivity
|
|
51
|
+
*/
|
|
52
|
+
export class FetchError extends TinfoilError {
|
|
53
|
+
constructor(message, options) {
|
|
54
|
+
super(message, options);
|
|
55
|
+
this.name = 'FetchError';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Thrown when attestation verification fails.
|
|
60
|
+
*
|
|
61
|
+
* This covers all attestation-related security errors:
|
|
62
|
+
* - Material verification failures (parsing, signatures, certificates)
|
|
63
|
+
* - Policy validation failures (measurement mismatch, policy violation)
|
|
64
|
+
*
|
|
65
|
+
* Examples:
|
|
66
|
+
* - Data parsing failed (malformed report, invalid base64, bad structure)
|
|
67
|
+
* - Sigstore signature invalid
|
|
68
|
+
* - Hardware certificate chain invalid
|
|
69
|
+
* - Report signature invalid
|
|
70
|
+
* - Measurement mismatch (enclave code doesn't match signed release)
|
|
71
|
+
* - Policy violation (debug enabled, TCB too low)
|
|
72
|
+
* - Key binding mismatch (transport keys don't match attested keys)
|
|
73
|
+
*
|
|
74
|
+
* Action: Stop - security issue - you should retry the entire attestation protocol.
|
|
75
|
+
*/
|
|
76
|
+
export class AttestationError extends TinfoilError {
|
|
77
|
+
constructor(message, options) {
|
|
78
|
+
super(message, options);
|
|
79
|
+
this.name = 'AttestationError';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Helper to handle errors in catch blocks.
|
|
84
|
+
* - If the error is already a TinfoilError, rethrow it as-is
|
|
85
|
+
* - Otherwise, wrap it in the specified error class
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* try {
|
|
90
|
+
* await someOperation();
|
|
91
|
+
* } catch (e) {
|
|
92
|
+
* wrapOrThrow(e, AttestationError, 'Operation failed');
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export function wrapOrThrow(e, ErrorClass, message) {
|
|
97
|
+
if (e instanceof TinfoilError) {
|
|
98
|
+
throw e;
|
|
99
|
+
}
|
|
100
|
+
throw new ErrorClass(message, { cause: e });
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAe,EAAE,OAA2B;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;YACnB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC7B,CAAC;IACH,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,kBAAmB,SAAQ,YAAY;IAClD,YAAY,OAAe,EAAE,OAA2B;QACtD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,UAAW,SAAQ,YAAY;IAC1C,YAAY,OAAe,EAAE,OAA2B;QACtD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,gBAAiB,SAAQ,YAAY;IAChD,YAAY,OAAe,EAAE,OAA2B;QACtD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,WAAW,CACzB,CAAU,EACV,UAAmF,EACnF,OAAe;IAEf,IAAI,CAAC,YAAY,YAAY,EAAE,CAAC;QAC9B,MAAM,CAAC,CAAC;IACV,CAAC;IACD,MAAM,IAAI,UAAU,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAU,EAAE,CAAC,CAAC;AACvD,CAAC"}
|
package/dist/github.d.ts
CHANGED
|
@@ -11,11 +11,11 @@ export interface Release {
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function fetchLatestDigest(repo: string): Promise<string>;
|
|
13
13
|
/**
|
|
14
|
-
* Fetches the
|
|
14
|
+
* Fetches the Sigstore bundle from GitHub's attestation API for a given repo and release digest.
|
|
15
15
|
*
|
|
16
16
|
* @param repo - The GitHub repository in format "owner/repo"
|
|
17
|
-
* @param digest - The
|
|
18
|
-
* @returns The
|
|
17
|
+
* @param digest - The SHA256 release digest
|
|
18
|
+
* @returns The Sigstore bundle JSON object
|
|
19
19
|
* @throws Error if there's any error fetching or parsing the data
|
|
20
20
|
*/
|
|
21
21
|
export declare function fetchGithubAttestationBundle(repo: string, digest: string): Promise<unknown>;
|
package/dist/github.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAQD;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmCrE;AAED;;;;;;;GAOG;AACH,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBjG"}
|