Skip to content

Commit

Permalink
Merge pull request #22 from Bhutan-NDI/feat/proof-with-filter
Browse files Browse the repository at this point in the history
add filter support to presentation definition constraints
  • Loading branch information
kinxa0 authored Dec 11, 2024
2 parents 495a063 + 9b63c1f commit 54179df
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
6 changes: 6 additions & 0 deletions apps/agent-service/src/interface/agent-service.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,14 @@ export interface IAgentStatus {
export interface ISchema {
uri: string;
}

export interface IFilter {
type: string;
pattern: string;
}
export interface IFields {
path: string[];
filter: IFilter;
}
export interface IConstraints {
fields: IFields[];
Expand Down
24 changes: 23 additions & 1 deletion apps/api-gateway/src/verification/dto/request-proof.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,29 @@ class ProofPayload {
protocolVersion: string;
}

export class Filter {
@ApiProperty()
@IsString({ message: 'type must be in string' })
@IsNotEmpty({ message: 'type is required.' })
type: string;

@ApiProperty()
@IsString({ message: 'pattern must be in string' })
@IsNotEmpty({ message: 'pattern is required.' })
pattern: string;
}
export class Fields {
@ApiProperty()
@IsArray()
@IsNotEmpty({ message: 'path is required.' })
path: string[];

@ApiProperty()
@IsOptional()
@IsNotEmpty({ message: 'filter is required.' })
@ValidateNested()
@Type(() => Filter)
filter: Filter;
}

export class Constraints {
Expand Down Expand Up @@ -384,7 +402,11 @@ export class SendProofRequestPayload {
'constraints': {
'fields': [
{
'path': ['$.issuer']
'path': ['$.issuer.id'],
'filter': {
'type': 'string',
'pattern': 'did:example:123|did:example:456'
}
}
]
}
Expand Down
6 changes: 6 additions & 0 deletions apps/verification/src/interfaces/verification.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,14 @@ interface IRequestedRestriction {
export interface ISchema {
uri:string;
}

export interface IFilter {
type: string;
pattern: string;
}
export interface IFields {
path: string[];
filter: IFilter;
}
export interface IConstraints {
fields: IFields[];
Expand Down

0 comments on commit 54179df

Please sign in to comment.