src/database/migrations/1774000000000-AddReaderAuthToPresentationConfig.ts

Description

Add the readerAuth column to presentation_config.

When enabled, the ISO 18013-7 Annex C (DC API) DeviceRequest embeds a detached readerAuth COSE_Sign1 signed with the tenant's Access key chain, allowing the wallet to cryptographically authenticate the verifier. Nullable — a null value means disabled.

Implements

MigrationInterface

Relationships

Used by

No results matching.

Depends on

  • MigrationInterface

Index

Properties
Methods
  • Public Async down
  • Public Async up

Properties

name
Type : string
Default value : "AddReaderAuthToPresentationConfig1774000000000"

Methods

Public Async down
down(queryRunner: QueryRunner)
Parameters :
Name Type Optional
queryRunner QueryRunner No
Returns : Promise<void>
Public Async up
up(queryRunner: QueryRunner)
Parameters :
Name Type Optional
queryRunner QueryRunner No
Returns : Promise<void>
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";

/**
 * Add the `readerAuth` column to `presentation_config`.
 *
 * When enabled, the ISO 18013-7 Annex C (DC API) DeviceRequest embeds a detached
 * `readerAuth` COSE_Sign1 signed with the tenant's Access key chain, allowing the
 * wallet to cryptographically authenticate the verifier. Nullable — a null value
 * means disabled.
 */
export class AddReaderAuthToPresentationConfig1774000000000
    implements MigrationInterface
{
    name = "AddReaderAuthToPresentationConfig1774000000000";

    public async up(queryRunner: QueryRunner): Promise<void> {
        const table = await queryRunner.getTable("presentation_config");
        if (!table) {
            console.log(
                "[Migration] presentation_config table not found — skipping.",
            );
            return;
        }

        if (!table.columns.some((c) => c.name === "readerAuth")) {
            await queryRunner.addColumn(
                "presentation_config",
                new TableColumn({
                    name: "readerAuth",
                    type: "boolean",
                    isNullable: true,
                }),
            );
            console.log(
                "[Migration] Added readerAuth column to presentation_config.",
            );
        }
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        const table = await queryRunner.getTable("presentation_config");
        if (!table) return;

        if (table.columns.some((c) => c.name === "readerAuth")) {
            await queryRunner.dropColumn("presentation_config", "readerAuth");
        }
    }
}

results matching ""

    No results matching ""