Skip to content

Commit

Permalink
fix: workaround for bug in VeramoEd25519Signature2018 implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Nov 29, 2021
1 parent 1efa2fa commit 13442eb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/vc-handler-ld-local/src/agent/CredentialHandlerLDLocal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export class CredentialHandlerLDLocal implements IAgentPlugin {
private ldCredentialModule: LdCredentialModule
readonly schema = schema.IVcLocalIssuerJsonLd
readonly methods: ICredentialHandlerLDLocal = {
// We bind to existing methods as we can act as a drop in replacement. todo: Add config support for this mode
createVerifiableCredentialLD: this.createVerifiableCredentialLDLocal.bind(this),
createVerifiablePresentationLD: this.createVerifiablePresentationLDLocal.bind(this),
verifyPresentationLD: this.verifyPresentationLDLocal.bind(this),
verifyCredentialLD: this.verifyCredentialLDLocal.bind(this),

createVerifiableCredentialLDLocal: this.createVerifiableCredentialLDLocal.bind(this),
createVerifiablePresentationLDLocal: this.createVerifiablePresentationLDLocal.bind(this),
verifyPresentationLDLocal: this.verifyPresentationLDLocal.bind(this),
Expand Down Expand Up @@ -104,6 +110,11 @@ export class CredentialHandlerLDLocal implements IAgentPlugin {
'@context': presentationContext,
type: presentationType,
}
// Workaround for bug in TypeError: Cannot read property 'length' of undefined
// at VeramoEd25519Signature2018.preSigningPresModification
if (!presentation.verifier) {
presentation.verifier = []
}

if (!isDefined(presentation.holder) || !presentation.holder) {
throw new Error('invalid_argument: args.presentation.holder must not be empty')
Expand Down

0 comments on commit 13442eb

Please sign in to comment.