mirror of
https://github.com/morluto/rea
synced 2026-10-25 22:08:11 -04:00
fix(protocols): make admission and certificate success types exact
This commit is contained in:
@@ -24,7 +24,7 @@ const attempt = <T>(read: () => T): T | null => {
|
||||
};
|
||||
|
||||
/** Identity is the raw-DER fingerprint; parsed X.509 facts are null when unreadable. */
|
||||
export const certificateFacts = (der: Uint8Array): Certificate => {
|
||||
export const certificateFacts = (der: Uint8Array): NonNullable<Certificate> => {
|
||||
const cert = attempt(() => {
|
||||
// OpenSSL auto-detects PEM before DER, including PEM embedded in an extension.
|
||||
// An explicit envelope makes it decode the selected bytes; raw equality also
|
||||
|
||||
@@ -186,16 +186,10 @@ export const v1SignerFacts = ({
|
||||
// Without verification, a block with several SignerInfos has no one signer.
|
||||
certificate:
|
||||
infos.length === 1 ? named(infos[0]?.certificateIndex ?? null) : null,
|
||||
certificates: facts.flatMap((fact) =>
|
||||
fact === null
|
||||
? []
|
||||
: [
|
||||
{
|
||||
sha256_fingerprint: fact.sha256_fingerprint,
|
||||
subject: fact.subject,
|
||||
},
|
||||
],
|
||||
),
|
||||
certificates: facts.map(({ sha256_fingerprint, subject }) => ({
|
||||
sha256_fingerprint,
|
||||
subject,
|
||||
})),
|
||||
signer_infos: infos.map((info) => ({
|
||||
identified_by: info.identifiedBy,
|
||||
certificate_sha256:
|
||||
|
||||
@@ -100,6 +100,7 @@ const admitDescriptorRegistry = async (
|
||||
stack.push({ message: nested, prefix: length });
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const scalarValue = (reader: BinaryReader, scalar: ScalarType): string => {
|
||||
|
||||
@@ -240,7 +240,7 @@ it.each([0, 7])(
|
||||
expect(projectAnalysisError(retry.error)).toMatchObject({
|
||||
code: "cleanup_incomplete",
|
||||
details: {
|
||||
resources: expect.arrayContaining(result.error.cleanupResources),
|
||||
resources: expect.arrayContaining([...result.error.cleanupResources]),
|
||||
},
|
||||
});
|
||||
expect(retry.error.cleanupResources.length).toBeGreaterThan(0);
|
||||
|
||||
Reference in New Issue
Block a user