Skip to content

Commit

Permalink
fix: get correct information for issuer for OA document
Browse files Browse the repository at this point in the history
Signed-off-by: toanNgo <toan.ngo@gosource.com.au>
  • Loading branch information
toanNgo authored and arpentnoir committed Jun 27, 2023
1 parent 6197068 commit e019a5b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions packages/credential-oa/src/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
} from '@govtechsg/open-attestation';

import {
extractIssuer,
MANDATORY_CREDENTIAL_CONTEXT,
processEntryToArray,
} from '@veramo/utils';
Expand All @@ -33,10 +32,7 @@ import { isValid, verify } from '@govtechsg/oa-verify';
const OA_MANDATORY_CREDENTIAL_CONTEXT =
'https://schemata.openattestation.com/com/openattestation/1.0/OpenAttestation.v3.json';

const OA_MANDATORY_CREDENTIAL_TYPES = [
'VerifiableCredential',
'OpenAttestationCredential',
];
const OA_MANDATORY_CREDENTIAL_TYPES = 'VerifiableCredential';

/**
Expand Down Expand Up @@ -75,15 +71,18 @@ export class CredentialIssuerOA implements IAgentPlugin {
MANDATORY_CREDENTIAL_CONTEXT
);

const credentialType = processEntryToArray(credentialInput.type);
const credentialType = processEntryToArray(
credentialInput.type,
OA_MANDATORY_CREDENTIAL_TYPES
);

const credential = {
...credentialInput,
'@context': [...credentialContext, OA_MANDATORY_CREDENTIAL_CONTEXT],
type: [...credentialType, ...OA_MANDATORY_CREDENTIAL_TYPES],
type: credentialType,
};

let wrappedDocument;
let wrappedDocument: WrappedDocument<OpenAttestationDocument>;
try {
wrappedDocument =
//@ts-ignore
Expand All @@ -94,7 +93,7 @@ export class CredentialIssuerOA implements IAgentPlugin {
);
}

const issuer = extractIssuer(credential);
const issuer = wrappedDocument.openAttestationMetadata.proof.value;

let identifier: IIdentifier;
try {
Expand Down

0 comments on commit e019a5b

Please sign in to comment.