src/session/entities/session.entity.ts
Entity representing a user session in the application. It includes various properties such as credentials, authorization code, request URI, authorization queries, and more.
Properties |
|
Optional auth_queries |
Type : AuthorizeQueries
|
Decorators :
@Column('json', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:126
|
Authorization queries associated with the session. |
Optional authorization_code |
Type : string
|
Decorators :
@Column('varchar', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:116
|
Authorization code for the session. |
Optional claimsWebhook |
Type : WebhookConfig
|
Decorators :
@Column('json', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:155
|
Webhook configuration to send result and may receive further information. |
createdAt |
Type : Date
|
Decorators :
@CreateDateColumn()
|
Defined in src/session/entities/session.entity.ts:64
|
The timestamp when the request was created. |
Optional credentialPayload |
Type : OfferRequestDto
|
Decorators :
@Column('json', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:150
|
Credential payload containing the offer request details. |
Optional credentials |
Type : VerificationResult[]
|
Decorators :
@Column('json', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:191
|
Verified credentials from the presentation process. |
Optional expiresAt |
Type : Date
|
Decorators :
@Column('date', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:76
|
The timestamp when the request is set to expire. |
id |
Type : string
|
Decorators :
@PrimaryColumn('uuid')
|
Defined in src/session/entities/session.entity.ts:58
|
Unique identifier for the session. |
Optional issuanceId |
Type : string
|
Decorators :
@Column('varchar', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:110
|
Optional nonce |
Type : string
|
Decorators :
@Column('varchar', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:132
|
Nonce used for the OID4VCI flow. |
notifications |
Type : Notification[]
|
Decorators :
@Column('json', {default: undefined})
|
Defined in src/session/entities/session.entity.ts:165
|
Notifications associated with the session. |
Optional notifyWebhook |
Type : WebhookConfig
|
Decorators :
@Column('json', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:160
|
Webhook configuration to send the result of the notification response. |
Optional offer |
Type : CredentialOfferObject
|
Decorators :
@Column('json', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:138
|
Credential offer object containing details about the credential offer or presentation request. |
Optional offerUrl |
Type : string
|
Decorators :
@Column('varchar', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:144
|
Offer URL for the credential offer. |
Optional request_uri |
Type : string
|
Decorators :
@Column('varchar', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:121
|
Request URI from the authorization request. |
Optional requestId |
Type : string
|
Decorators :
@Column('varchar', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:173
|
The ID of the presentation configuration associated with the session. |
Optional requestObject |
Type : string
|
Decorators :
@Column('varchar', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:185
|
Signed presentation auth request. |
Optional requestUrl |
Type : string
|
Decorators :
@Column('varchar', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:179
|
The URL of the presentation auth request. |
status |
Type : SessionStatus
|
Decorators :
@ApiProperty({enum: SessionStatus})
|
Defined in src/session/entities/session.entity.ts:105
|
Status of the session. |
tenant |
Type : TenantEntity
|
Decorators :
@ManyToOne(undefined, {cascade: true, onDelete: 'CASCADE', eager: true})
|
Defined in src/session/entities/session.entity.ts:98
|
The tenant that owns this object. |
tenantId |
Type : string
|
Decorators :
@Column('varchar')
|
Defined in src/session/entities/session.entity.ts:88
|
Tenant ID for multi-tenancy support. |
updatedAt |
Type : Date
|
Decorators :
@UpdateDateColumn()
|
Defined in src/session/entities/session.entity.ts:70
|
The timestamp when the request was last updated. |
useDcApi |
Type : boolean
|
Decorators :
@Column('boolean', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:82
|
Flag indicating whether to use the DC API for the presentation request. |
Optional vp_nonce |
Type : string
|
Decorators :
@Column('varchar', {nullable: true})
|
Defined in src/session/entities/session.entity.ts:197
|
Noncce from the Verifiable Presentation request. |
import { ApiProperty } from "@nestjs/swagger";
import {
CredentialOfferObject,
NotificationEvent,
} from "@openid4vc/openid4vci";
import { VerificationResult } from "@sd-jwt/sd-jwt-vc";
import {
Column,
CreateDateColumn,
Entity,
ManyToOne,
PrimaryColumn,
UpdateDateColumn,
} from "typeorm";
import { TenantEntity } from "../../auth/tenant/entitites/tenant.entity";
import { AuthorizeQueries } from "../../issuer/authorize/dto/authorize-request.dto";
import { OfferRequestDto } from "../../issuer/oid4vci/dto/offer-request.dto";
import { WebhookConfig } from "../../utils/webhook/webhook.dto";
export enum SessionStatus {
Active = "active",
Fetched = "fetched",
Completed = "completed",
Expired = "expired",
Failed = "failed",
}
/**
* Represents a session entity for managing user sessions in the application.
*/
export type Notification = {
/**
* Unique identifier for the notification.
*/
id: string;
/**
* The type of notification.
*/
event?: NotificationEvent;
/**
* The credential ID associated with the notification.
*/
credentialConfigurationId: string;
};
/**
* Entity representing a user session in the application.
* It includes various properties such as credentials, authorization code,
* request URI, authorization queries, and more.
*/
@Entity()
export class Session {
/**
* Unique identifier for the session.
*/
@PrimaryColumn("uuid")
id: string;
/**
* The timestamp when the request was created.
*/
@CreateDateColumn()
createdAt: Date;
/**
* The timestamp when the request was last updated.
*/
@UpdateDateColumn()
updatedAt: Date;
/**
* The timestamp when the request is set to expire.
*/
@Column("date", { nullable: true })
expiresAt?: Date;
/**
* Flag indicating whether to use the DC API for the presentation request.
*/
@Column("boolean", { nullable: true })
useDcApi: boolean;
/**
* Tenant ID for multi-tenancy support.
*/
@Column("varchar")
tenantId: string;
/**
* The tenant that owns this object.
*/
@ManyToOne(() => TenantEntity, {
cascade: true,
onDelete: "CASCADE",
eager: true,
})
tenant: TenantEntity;
/**
* Status of the session.
*/
@ApiProperty({ enum: SessionStatus })
@Column("varchar", { nullable: true, default: "active" })
status: SessionStatus;
// issuance specific fields
@Column("varchar", { nullable: true })
issuanceId?: string;
/**
* Authorization code for the session.
*/
@Column("varchar", { nullable: true })
authorization_code?: string;
/**
* Request URI from the authorization request.
*/
@Column("varchar", { nullable: true })
request_uri?: string;
/**
* Authorization queries associated with the session.
*/
@Column("json", { nullable: true })
auth_queries?: AuthorizeQueries;
/**
* Nonce used for the OID4VCI flow.
*/
@Column("varchar", { nullable: true })
nonce?: string;
/**
* Credential offer object containing details about the credential offer or presentation request.
*/
@Column("json", { nullable: true })
offer?: CredentialOfferObject;
/**
* Offer URL for the credential offer.
*/
@Column("varchar", { nullable: true })
offerUrl?: string;
/**
* Credential payload containing the offer request details.
*/
@Column("json", { nullable: true })
credentialPayload?: OfferRequestDto;
/**
* Webhook configuration to send result and may receive further information.
*/
@Column("json", { nullable: true })
claimsWebhook?: WebhookConfig;
/**
* Webhook configuration to send the result of the notification response.
*/
@Column("json", { nullable: true })
notifyWebhook?: WebhookConfig;
/**
* Notifications associated with the session.
*/
@Column("json", { default: JSON.stringify([]) })
notifications: Notification[];
// presentation specific fields
/**
* The ID of the presentation configuration associated with the session.
*/
@Column("varchar", { nullable: true })
requestId?: string;
/**
* The URL of the presentation auth request.
*/
@Column("varchar", { nullable: true })
requestUrl?: string;
/**
* Signed presentation auth request.
*/
@Column("varchar", { nullable: true })
requestObject?: string;
/**
* Verified credentials from the presentation process.
*/
@Column("json", { nullable: true })
credentials?: VerificationResult[];
/**
* Noncce from the Verifiable Presentation request.
*/
@Column("varchar", { nullable: true })
vp_nonce?: string;
}