# core/steps/certificate.step.ts

> 16 lines of code and 3 definitions.

Tree: Bane's Lab Deploy
Language: typescript
Layer: application
Canonical: https://banes-lab.com/anatomy/deploy#file-deploy-core-steps-certificate-step-ts
Source text: https://banes-lab.com/source/deploy/core/steps/certificate.step.ts.txt

Listed in [core/steps](https://banes-lab.com/api/source/deploy/core/steps.md), after [core/steps/build.step.ts](https://banes-lab.com/source/deploy/core/steps/build.step.ts.md) and before [core/steps/nginx.step.ts](https://banes-lab.com/source/deploy/core/steps/nginx.step.ts.md).

## Definitions

- `probeCertificate` (lexical_declaration, line 6, exported)
- `keys` (lexical_declaration, line 11, exported)
- `finding` (lexical_declaration, line 13, exported)

## Contained in

- [core/steps](https://banes-lab.com/anatomy/deploy/folder-deploy-core-steps.md)

## Used by

- [runtime/entrypoints/deployment.entrypoint.ts](https://banes-lab.com/source/deploy/runtime/entrypoints/deployment.entrypoint.ts.md)
- [runtime/entrypoints/nginx.entrypoint.ts](https://banes-lab.com/source/deploy/runtime/entrypoints/nginx.entrypoint.ts.md)

## Linked from

- [runtime/entrypoints](https://banes-lab.com/anatomy/deploy/folder-deploy-runtime-entrypoints.md)

## Source

```typescript
import { DANE_REMEDY, PROBE_DANE_PASSED, PROBE_FAILED, daneMismatch } from "#configuration/strings/deployment.strings";
import type { DaneReader, Journal } from "#types/deployment.types";
import { LINE_BREAK } from "#configuration/constants/deployment.constants";
import { readDane } from "#core/adapters/site.adapter";

export const probeCertificate = async function probeCertificate(
    journal: Journal,
    site: string,
    reader: DaneReader = readDane,
): Promise<void> {
    const keys = await reader(site);
    if (!keys.published.includes(keys.served)) {
        const finding = daneMismatch(keys.name, keys.served, keys.published);
        throw new Error([PROBE_FAILED, finding, DANE_REMEDY].join(LINE_BREAK));
    }
    journal.mark(PROBE_DANE_PASSED);
};
```
