Skip to content

Commit

Permalink
fix: add maximumCredentialNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
lotharking committed Dec 18, 2024
1 parent 2f3d0e0 commit 25d4a97
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import { ApiProperty } from '@nestjs/swagger'
import { IsString, IsNotEmpty } from 'class-validator'
import { IsString, IsNotEmpty, IsNumber } from 'class-validator'

export class CreateRevocationRegistryDto {
@ApiProperty({
description: 'credentialDefinitionId',
example: 'did:web',
example:
'did:web:chatbot-demo.dev.2060.io?service=anoncreds&relativeRef=/credDef/8TsGLaSPVKPVMXK8APzBRcXZryxutvQuZnnTcDmbqd9p',
})
@IsString()
@IsNotEmpty()
credentialDefinitionId!: string

@ApiProperty({
description: 'maximumCredentialNumber',
default: 1000,
example: 1000,
})
@IsNumber()
@IsNotEmpty()
maximumCredentialNumber: number = 1000
}
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ export class CredentialTypesController {
* @param credentialDefinitionId
* @returns RevocationTypeInfo
*/
@Post('/revocationDefinition')
@Post('/revocationRegistry')
public async createRevocationRegistry(@Body() options: CreateRevocationRegistryDto): Promise<string> {
try {
const agent = await this.agentService.getAgent()
Expand All @@ -436,7 +436,7 @@ export class CredentialTypesController {
revocationRegistryDefinition: {
credentialDefinitionId,
tag: 'default',
maximumCredentialNumber: 1000,
maximumCredentialNumber: options.maximumCredentialNumber,
issuerId: cred.credentialDefinition.issuerId,
},
options: {},
Expand Down Expand Up @@ -498,7 +498,7 @@ export class CredentialTypesController {
*
* @returns string[] with revocationRegistryDefinitionIds
*/
@Get('/revocationDefinition')
@Get('/revocationRegistry')
public async getRevocationDefinitions(@Body() options: CreateRevocationRegistryDto): Promise<string[]> {
const agent = await this.agentService.getAgent()

Expand Down
5 changes: 5 additions & 0 deletions packages/model/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export interface CredentialTypeInfo extends CreateCredentialTypeOptions {
id: string
}

export interface RevocationRegistry {
credentialDefinitionId: string
maximumCredentialNumber: number
}

export interface CreatePresentationRequestOptions {
requestedCredentials: RequestedCredential[]
}
Expand Down

0 comments on commit 25d4a97

Please sign in to comment.