Skip to content

Commit

Permalink
Lint index.js after rebase with 6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Nov 21, 2023
1 parent ea21d96 commit b553fdf
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,14 @@ import {documentLoader as _documentLoader} from './documentLoader.js';
import {CredentialIssuancePurpose} from './CredentialIssuancePurpose.js';
import jsigs from 'jsonld-signatures';
import jsonld from 'jsonld';
import * as credentialsContext from 'credentials-context';

const {AssertionProofPurpose, AuthenticationProofPurpose} = jsigs.purposes;
const {constants: {CREDENTIALS_CONTEXT_V1_URL}} = credentialsContext;
const {
constants: {
CONTEXT_URL: CREDENTIALS_CONTEXT_V2_URL
}
} = credentialsContextV2;

const credentialContextUrls = new Set([
CREDENTIALS_CONTEXT_V1_URL,
CREDENTIALS_CONTEXT_V2_URL
]);

export const defaultDocumentLoader = jsigs.extendContextLoader(_documentLoader);
export {CredentialIssuancePurpose};
// Z and T can be lowercase
Expand Down Expand Up @@ -612,7 +605,7 @@ export function _checkCredential({
if(hasV1CredentialContext({credential})) {
//check issued is a date
if(!credential.issuanceDate) {
throw new Error('"issuanceDate" property is required.');
throw new Error('"issuanceDate" property is required.');
}
// check issuanceDate cardinality
if(jsonld.getValues(credential, 'issuanceDate').length > 1) {
Expand All @@ -623,7 +616,8 @@ export function _checkCredential({
if('issuanceDate' in credential) {
let {issuanceDate} = credential;
if(!dateRegex.test(issuanceDate)) {
throw new Error(`"issuanceDate" must be a valid date: ${issuanceDate}`);
throw new Error(
`"issuanceDate" must be a valid date: ${issuanceDate}`);
}
// check if `now` is before `issuanceDate`
issuanceDate = new Date(issuanceDate);
Expand All @@ -634,7 +628,7 @@ export function _checkCredential({
}
}
}

}
// check issuer cardinality
if(jsonld.getValues(credential, 'issuer').length > 1) {
throw new Error('"issuer" property can only have one value.');
Expand Down

0 comments on commit b553fdf

Please sign in to comment.