src/auth/client/entities/client.entity.ts

Description

Represents a client in the system that belongs to a tenant.

Index

Properties

Properties

Optional allowedIssuanceConfigs
Type : string[] | null
Decorators :
@ApiPropertyOptional({type: undefined, description: 'List of issuance config IDs this client can use. If empty/null, all configs are allowed.', example: undefined})
@Column({type: 'json', nullable: true})

Optional list of issuance config IDs this client is allowed to use. If null or empty, the client can use all issuance configs (backward compatible). Only relevant if the client has the 'issuance:offer' role.

Optional allowedPresentationConfigs
Type : string[] | null
Decorators :
@ApiPropertyOptional({type: undefined, description: 'List of presentation config IDs this client can use. If empty/null, all configs are allowed.', example: undefined})
@Column({type: 'json', nullable: true})

Optional list of presentation config IDs this client is allowed to use. If null or empty, the client can use all presentation configs (backward compatible). Only relevant if the client has the 'presentation:request' role.

clientId
Type : string
Decorators :
@ApiProperty({description: 'Unique client identifier'})
@PrimaryColumn('varchar')

The unique identifier for the client.

Optional description
Type : string
Decorators :
@ApiPropertyOptional({description: 'Client description'})
@Column('varchar', {nullable: true})

The description of the client.

roles
Type : Role[]
Decorators :
@ApiProperty({description: 'Roles assigned to the client', type: undefined})
@Column({type: 'json'})

The roles assigned to the client.

Optional secret
Type : string
Decorators :
@ApiHideProperty()
@Column('varchar', {nullable: true})

The secret key for the client.

Optional tenant
Type : TenantEntity
Decorators :
@ApiHideProperty()
@ManyToOne(undefined, tenant => tenant.clients, {onDelete: 'CASCADE'})

The tenant that the client belongs to.

Optional tenantId
Type : string
Decorators :
@ApiPropertyOptional({description: 'Tenant identifier the client belongs to'})
@Column('varchar', {nullable: true})

The unique identifier for the tenant that the client belongs to. Only null for accounts that manage tenants, that do not belong to a client

import {
    ApiHideProperty,
    ApiProperty,
    ApiPropertyOptional,
} from "@nestjs/swagger";
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
import { Role } from "../../roles/role.enum";
import { TenantEntity } from "../../tenant/entities/tenant.entity";

/**
 * Represents a client in the system that belongs to a tenant.
 */
@Entity()
export class ClientEntity {
    /**
     * The unique identifier for the client.
     */
    @ApiProperty({ description: "Unique client identifier" })
    @PrimaryColumn("varchar")
    clientId!: string;

    /**
     * The secret key for the client.
     */
    @ApiHideProperty()
    @Column("varchar", { nullable: true })
    secret?: string;

    /**
     * The unique identifier for the tenant that the client belongs to. Only null for accounts that manage tenants, that do not belong to a client
     */
    @ApiPropertyOptional({
        description: "Tenant identifier the client belongs to",
    })
    @Column("varchar", { nullable: true })
    tenantId?: string;

    /**
     * The description of the client.
     */
    @ApiPropertyOptional({ description: "Client description" })
    @Column("varchar", { nullable: true })
    description?: string;

    /**
     * The roles assigned to the client.
     */
    @ApiProperty({
        description: "Roles assigned to the client",
        type: [String],
    })
    @Column({ type: "json" })
    roles!: Role[];

    /**
     * Optional list of presentation config IDs this client is allowed to use.
     * If null or empty, the client can use all presentation configs (backward compatible).
     * Only relevant if the client has the 'presentation:request' role.
     */
    @ApiPropertyOptional({
        type: [String],
        description:
            "List of presentation config IDs this client can use. If empty/null, all configs are allowed.",
        example: ["age-verification", "kyc-basic"],
    })
    @Column({ type: "json", nullable: true })
    allowedPresentationConfigs?: string[] | null;

    /**
     * Optional list of issuance config IDs this client is allowed to use.
     * If null or empty, the client can use all issuance configs (backward compatible).
     * Only relevant if the client has the 'issuance:offer' role.
     */
    @ApiPropertyOptional({
        type: [String],
        description:
            "List of issuance config IDs this client can use. If empty/null, all configs are allowed.",
        example: ["pid", "mdl"],
    })
    @Column({ type: "json", nullable: true })
    allowedIssuanceConfigs?: string[] | null;

    /**
     * The tenant that the client belongs to.
     */
    @ApiHideProperty()
    @ManyToOne(
        () => TenantEntity,
        (tenant) => tenant.clients,
        { onDelete: "CASCADE" },
    )
    tenant?: TenantEntity;
}

results matching ""

    No results matching ""