Skip to content

Commit

Permalink
feat: update credential generation
Browse files Browse the repository at this point in the history
  • Loading branch information
lotharking committed Dec 13, 2024
1 parent a0363f2 commit ce1fc60
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"prebuild": "yarn workspace @2060.io/service-agent-model run build",
"build": "yarn workspaces run build",
"start": "yarn workspace @2060.io/service-agent-main run start",
"start:dev": "yarn workspace @2060.io/service-agent-main run start:dev",
"check-types": "yarn check-types:build",
"check-types:build": "yarn workspaces run tsc --noEmit -p tsconfig.build.json",
"format": "prettier \"packages/*/src/**/*.ts\" --write",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export class CredentialTypesController {
options: {},
})

this.logger.log(`revStatusListResult: ${JSON.stringify(revStatusListResult)}`)
this.logger.log(`Credential Definition Id: ${credentialDefinitionId}`)
this.logger.log(`Revocation Definition Id: ${revocationDefinitionId}`)

Expand All @@ -190,15 +191,20 @@ export class CredentialTypesController {
const revocationDefinitionRepository = agent.dependencyManager.resolve(
AnonCredsRevocationRegistryDefinitionRepository,
)
const revocationDefinitionRecord = await revocationDefinitionRepository.getByRevocationRegistryDefinitionId(
agent.context,
revocationDefinitionId,
)
const revocationDefinitionRecord =
await revocationDefinitionRepository.getByRevocationRegistryDefinitionId(
agent.context,
revocationDefinitionId,
)
credentialDefinitionRecord.setTag('name', options.name)
credentialDefinitionRecord.setTag('version', options.version)
credentialDefinitionRecord.setTag('revocationDefinitionId', revocationDefinitionId)

await credentialDefinitionRepository.update(agent.context, credentialDefinitionRecord)
revocationDefinitionRecord.metadata.add('revStatusList', revStatusListResult.revocationStatusListState.revocationStatusList!)
revocationDefinitionRecord.metadata.set(
'revStatusList',
revStatusListResult.revocationStatusListState.revocationStatusList!,
)
await revocationDefinitionRepository.update(agent.context, revocationDefinitionRecord)

return {
Expand Down
20 changes: 10 additions & 10 deletions packages/main/src/didWebServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,19 @@ export const addDidWebRoutes = async (
)

if (revocationDefinitionRecord) {
res.send({
resource: revocationDefinitionRecord.revocationRegistryDefinition,
res.send({
resource: revocationDefinitionRecord.revocationRegistryDefinition,
resourceMetadata: {
revocationStatusListEndpoint: `${anoncredsBaseUrl}/anoncreds/v1/revStatus/${revocationDefinitionId}`
}
statusListEndpoint: `${anoncredsBaseUrl}/anoncreds/v1/revStatus/${revocationDefinitionId}`,
},
})
return
}

res.send(404)
})

app.get('/anoncreds/v1/revStatus/:revocationDefinitionId', async (req, res) => {
app.get('/anoncreds/v1/revStatus/:revocationDefinitionId/:timestamp?', async (req, res) => {
const revocationDefinitionId = req.params.revocationDefinitionId

agent.config.logger.debug(`revocate definition requested: ${revocationDefinitionId}`)
Expand All @@ -175,12 +175,12 @@ export const addDidWebRoutes = async (

if (revocationDefinitionRecord) {
const revStatusList = revocationDefinitionRecord.metadata.get('revStatusList')
res.send({
resource: revStatusList,
res.send({
resource: revStatusList,
resourceMetadata: {
previousVersionId: "",
nextVersionId: "",
}
previousVersionId: '',
nextVersionId: '',
},
})
return
}
Expand Down
3 changes: 1 addition & 2 deletions packages/model/src/messages/calls/CallOfferRequestMessage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { DateParser } from '@credo-ts/core/build/utils/transformers'
import { Expose, Transform } from 'class-transformer'
import { Expose } from 'class-transformer'
import { IsOptional, IsString } from 'class-validator'

import { BaseMessage, BaseMessageOptions } from '../BaseMessage'
Expand Down

0 comments on commit ce1fc60

Please sign in to comment.