Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/vc/vc.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ export class VcController {
return this.VcService.sign(body.DID, body.payload);
}


@Post('/multi-sign')
multiSign(@Body() body: any) {
return this.VcService.multiSign(body.signerDIDs, body.toSign);
}

@ApiOperation({ summary: 'Verify a signed VC' })
@Post('/verify')
verify(@Body() body: VerifyJsonDTO) {
Expand Down
20 changes: 20 additions & 0 deletions src/vc/vc.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@ export default class VcService {
private readonly vault: VaultService,
) {}


async multiSign(signerDIDs: string[], toSign: string) {
try {
for (let i = 0; i < signerDIDs.length; i++) {
const signedResult = await this.sign(signerDIDs[i], toSign);
toSign['proof'] = {
proofValue: signedResult.signed,
created: new Date().toISOString(),
type: process.env.SIGNING_ALGORITHM,
verificationMethod: signerDIDs[i],
proofPurpose: 'assertionMethod',
}
}

return toSign;
} catch (err) {
throw new InternalServerErrorException(`Error in multi signing the document`);
}
}

async sign(signerDID: string, toSign: string) {
let did: Identity;
try {
Expand Down