Skip to content

Commit

Permalink
fix: Instead of figuring out the proof format, we defaulted to JWT cr…
Browse files Browse the repository at this point in the history
…edentials if the format was not supplied, bypassing the detection code
  • Loading branch information
nklomp committed Feb 8, 2024
1 parent 2709221 commit 8cba122
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class PresentationExchange implements IAgentPlugin {
readonly schema = schema.IDidAuthSiopOpAuthenticator
private readonly defaultStore: string
private readonly defaultNamespace: string
private readonly pex = new PEX()
private readonly pex = new PEX()

readonly methods: IPresentationExchange = {
pexStoreGetDefinition: this.pexStoreGetDefinition.bind(this),
Expand Down
4 changes: 2 additions & 2 deletions packages/presentation-exchange/src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function createPEXPresentationSignCallback(
},
context: IRequiredContext
): Promise<IPEXPresentationSignCallback> {
function determineProofFormat(format: Format | 'jwt' | 'lds' | 'EthereumEip712Signature2021', presentationDefinition: IPresentationDefinition) {
function determineProofFormat(format?: Format | 'jwt' | 'lds' | 'EthereumEip712Signature2021', presentationDefinition: IPresentationDefinition) {
let proofFormat: ProofFormat = 'jwt'
const formatOptions = format ?? args.format ?? presentationDefinition.format
if (formatOptions) {
Expand Down Expand Up @@ -66,7 +66,7 @@ export async function createPEXPresentationSignCallback(
throw Error(`Could not resolve DID document or match signing key to did ${idOpts.identifier.did}`)
}

const proofFormat = determineProofFormat(format ?? 'jwt', presentationDefinition)
const proofFormat = determineProofFormat(format, presentationDefinition)
let header
if (!presentation.holder) {
presentation.holder = id.did
Expand Down
5 changes: 1 addition & 4 deletions packages/siopv2-oid4vp-op-auth/src/session/OID4VP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ export class OID4VP {
): Promise<VerifiablePresentationWithDefinition> {
if (opts?.subjectIsHolder && opts?.holderDID) {
throw Error('Cannot both have subject is holder and a holderDID value at the same time (programming error)')
} else if (
!selectedVerifiableCredentials?.credentials ||
selectedVerifiableCredentials.credentials.length === 0
) {
} else if (!selectedVerifiableCredentials?.credentials || selectedVerifiableCredentials.credentials.length === 0) {
throw Error('No verifiable verifiableCredentials provided for presentation definition')
}

Expand Down

0 comments on commit 8cba122

Please sign in to comment.