Skip to content

Commit

Permalink
fixes lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kezike committed Apr 23, 2024
1 parent b25163c commit 06e6bb1
Show file tree
Hide file tree
Showing 6 changed files with 284 additions and 284 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
"env": {
"node": true,
"mocha": true
env: {
node: true,
mocha: true
},
extends: [
'standard'
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"start": "node -r dotenv/config server.js",
"dev": "nodemon -r dotenv/config server.js",
"dev-noenv": "nodemon server.js",
"lint": "eslint . --ext .js",
"lint-fix": "eslint --fix . --ext .js",
"lint": "eslint . --ext .js",
"lint-fix": "eslint --fix . --ext .js",
"test": "NODE_OPTIONS=--experimental-vm-modules npx mocha --timeout 10000 -r dotenv/config dotenv_config_path=src/test-fixtures/.env.testing src/app.test.js "
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import verifyAuthHeader from './verifyAuthHeader.js'
import { getConfig } from './config.js'

class IssuingException extends Error {
constructor(code, message, error = null) {
constructor (code, message, error = null) {
super(message)
this.code = code
this.error = error
Expand Down
292 changes: 146 additions & 146 deletions src/test-fixtures/nocks/protected_status_signing.js
Original file line number Diff line number Diff line change
@@ -1,152 +1,152 @@
import nock from 'nock';
import nock from 'nock'

const signedVcWithStatus = {
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1"
'@context': [
'https://www.w3.org/ns/credentials/v2',
'https://purl.imsglobal.org/spec/ob/v3p0/context.json',
'https://w3id.org/security/suites/ed25519-2020/v1'
],
"type": [
"VerifiableCredential",
"OpenBadgeCredential"
type: [
'VerifiableCredential',
'OpenBadgeCredential'
],
"id": "urn:uuid:951b475e-b795-43bc-ba8f-a2d01efd2eb1",
"name": "Introduction to Computer Science - CS50x",
"issuer": {
"description": "Gordon McKay Professor of the Practice of Computer Science, Harvard University",
"id": "did:key:z6MkrDLfZytHX5acEFds6wAYJbvMbT9UuhKhub4qaguDESCF",
"image": {
"id": "https://certificates.cs50.io/static/success.jpg",
"type": "Image"
},
"name": "Dr David Malan",
"type": "Profile",
"url": "https://cs.harvard.edu/malan/"
id: 'urn:uuid:951b475e-b795-43bc-ba8f-a2d01efd2eb1',
name: 'Introduction to Computer Science - CS50x',
issuer: {
description: 'Gordon McKay Professor of the Practice of Computer Science, Harvard University',
id: 'did:key:z6MkrDLfZytHX5acEFds6wAYJbvMbT9UuhKhub4qaguDESCF',
image: {
id: 'https://certificates.cs50.io/static/success.jpg',
type: 'Image'
},
name: 'Dr David Malan',
type: 'Profile',
url: 'https://cs.harvard.edu/malan/'
},
"validFrom": "2020-01-01T00:00:00Z",
"credentialSubject": {
"achievement": {
"criteria": {
"narrative": "Completion of CS50X, including ten problem sets, ten labs, and one final project."
},
"description": "CS50 congratulates <STUDENT NAME HERE> on completion of CS50x.",
"id": "http://cs50.harvard.edu",
"name": "Introduction to Computer Science - CS50x",
"type": "Achievement"
},
"identifier": {
"hashed": "false",
"identityHash": "jc.chartrand@gmail.com",
"type": "IdentityObject"
validFrom: '2020-01-01T00:00:00Z',
credentialSubject: {
achievement: {
criteria: {
narrative: 'Completion of CS50X, including ten problem sets, ten labs, and one final project.'
},
"type": "AchievementSubject"
description: 'CS50 congratulates <STUDENT NAME HERE> on completion of CS50x.',
id: 'http://cs50.harvard.edu',
name: 'Introduction to Computer Science - CS50x',
type: 'Achievement'
},
identifier: {
hashed: 'false',
identityHash: 'jc.chartrand@gmail.com',
type: 'IdentityObject'
},
type: 'AchievementSubject'
},
"credentialStatus": {
"id": "https://jchartrand.github.io/status-test-three/DKSPRCX9WB#1",
"statusListCredential": "https://jchartrand.github.io/status-test-three/DKSPRCX9WB",
"statusListIndex": 1,
"statusPurpose": "revocation",
"type": "BitstringStatusListEntry"
credentialStatus: {
id: 'https://jchartrand.github.io/status-test-three/DKSPRCX9WB#1',
statusListCredential: 'https://jchartrand.github.io/status-test-three/DKSPRCX9WB',
statusListIndex: 1,
statusPurpose: 'revocation',
type: 'BitstringStatusListEntry'
},
"proof": {
"created": "2023-08-23T12:44:15Z",
"proofPurpose": "assertionMethod",
"proofValue": "z5QQ12zr5JvEsKvbnEN2EYZ6punR6Pa5wMJzywGJ2dCh6SSA5oQb9hBiGADsNTbs57bopArwdBHE9kEVemMxcu1Fq",
"type": "Ed25519Signature2020",
"verificationMethod": "did:key:z6MkrDLfZytHX5acEFds6wAYJbvMbT9UuhKhub4qaguDESCF#z6MkrDLfZytHX5acEFds6wAYJbvMbT9UuhKhub4qaguDESCF"
proof: {
created: '2023-08-23T12:44:15Z',
proofPurpose: 'assertionMethod',
proofValue: 'z5QQ12zr5JvEsKvbnEN2EYZ6punR6Pa5wMJzywGJ2dCh6SSA5oQb9hBiGADsNTbs57bopArwdBHE9kEVemMxcu1Fq',
type: 'Ed25519Signature2020',
verificationMethod: 'did:key:z6MkrDLfZytHX5acEFds6wAYJbvMbT9UuhKhub4qaguDESCF#z6MkrDLfZytHX5acEFds6wAYJbvMbT9UuhKhub4qaguDESCF'
}
};
}

const unsignedVcWithoutStatus = {
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://purl.imsglobal.org/spec/ob/v3p0/context.json"
'@context': [
'https://www.w3.org/ns/credentials/v2',
'https://purl.imsglobal.org/spec/ob/v3p0/context.json'
],
"type": [
"VerifiableCredential",
"OpenBadgeCredential"
type: [
'VerifiableCredential',
'OpenBadgeCredential'
],
"id": "urn:uuid:951b475e-b795-43bc-ba8f-a2d01efd2eb1",
"name": "Introduction to Computer Science - CS50x",
"issuer": {
"id": "did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC",
"type": "Profile",
"name": "Dr David Malan",
"description": "Gordon McKay Professor of the Practice of Computer Science, Harvard University",
"url": "https://cs.harvard.edu/malan/",
"image": {
"id": "https://certificates.cs50.io/static/success.jpg",
"type": "Image"
}
id: 'urn:uuid:951b475e-b795-43bc-ba8f-a2d01efd2eb1',
name: 'Introduction to Computer Science - CS50x',
issuer: {
id: 'did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC',
type: 'Profile',
name: 'Dr David Malan',
description: 'Gordon McKay Professor of the Practice of Computer Science, Harvard University',
url: 'https://cs.harvard.edu/malan/',
image: {
id: 'https://certificates.cs50.io/static/success.jpg',
type: 'Image'
}
},
"validFrom": "2020-01-01T00:00:00Z",
"credentialSubject": {
"type": "AchievementSubject",
"identifier": {
"type": "IdentityObject",
"identityHash": "jc.chartrand@gmail.com",
"hashed": "false"
validFrom: '2020-01-01T00:00:00Z',
credentialSubject: {
type: 'AchievementSubject',
identifier: {
type: 'IdentityObject',
identityHash: 'jc.chartrand@gmail.com',
hashed: 'false'
},
achievement: {
id: 'http://cs50.harvard.edu',
type: 'Achievement',
criteria: {
narrative: 'Completion of CS50X, including ten problem sets, ten labs, and one final project.'
},
"achievement": {
"id": "http://cs50.harvard.edu",
"type": "Achievement",
"criteria": {
"narrative": "Completion of CS50X, including ten problem sets, ten labs, and one final project."
},
"description": "CS50 congratulates <STUDENT NAME HERE> on completion of CS50x.",
"name": "Introduction to Computer Science - CS50x"
}
description: 'CS50 congratulates <STUDENT NAME HERE> on completion of CS50x.',
name: 'Introduction to Computer Science - CS50x'
}
}
};
}

const unsignedVcWithStatus = {
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://purl.imsglobal.org/spec/ob/v3p0/context.json"
'@context': [
'https://www.w3.org/ns/credentials/v2',
'https://purl.imsglobal.org/spec/ob/v3p0/context.json'
],
"type": [
"VerifiableCredential",
"OpenBadgeCredential"
type: [
'VerifiableCredential',
'OpenBadgeCredential'
],
"id": "urn:uuid:951b475e-b795-43bc-ba8f-a2d01efd2eb1",
"name": "Introduction to Computer Science - CS50x",
"issuer": {
"id": "did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC",
"type": "Profile",
"name": "Dr David Malan",
"description": "Gordon McKay Professor of the Practice of Computer Science, Harvard University",
"url": "https://cs.harvard.edu/malan/",
"image": {
"id": "https://certificates.cs50.io/static/success.jpg",
"type": "Image"
}
id: 'urn:uuid:951b475e-b795-43bc-ba8f-a2d01efd2eb1',
name: 'Introduction to Computer Science - CS50x',
issuer: {
id: 'did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC',
type: 'Profile',
name: 'Dr David Malan',
description: 'Gordon McKay Professor of the Practice of Computer Science, Harvard University',
url: 'https://cs.harvard.edu/malan/',
image: {
id: 'https://certificates.cs50.io/static/success.jpg',
type: 'Image'
}
},
"validFrom": "2020-01-01T00:00:00Z",
"credentialSubject": {
"type": "AchievementSubject",
"identifier": {
"type": "IdentityObject",
"identityHash": "jc.chartrand@gmail.com",
"hashed": "false"
validFrom: '2020-01-01T00:00:00Z',
credentialSubject: {
type: 'AchievementSubject',
identifier: {
type: 'IdentityObject',
identityHash: 'jc.chartrand@gmail.com',
hashed: 'false'
},
achievement: {
id: 'http://cs50.harvard.edu',
type: 'Achievement',
criteria: {
narrative: 'Completion of CS50X, including ten problem sets, ten labs, and one final project.'
},
"achievement": {
"id": "http://cs50.harvard.edu",
"type": "Achievement",
"criteria": {
"narrative": "Completion of CS50X, including ten problem sets, ten labs, and one final project."
},
"description": "CS50 congratulates <STUDENT NAME HERE> on completion of CS50x.",
"name": "Introduction to Computer Science - CS50x"
}
description: 'CS50 congratulates <STUDENT NAME HERE> on completion of CS50x.',
name: 'Introduction to Computer Science - CS50x'
}
},
"credentialStatus": {
"id": "https://jchartrand.github.io/status-test-three/DKSPRCX9WB#1",
"type": "BitstringStatusListEntry",
"statusPurpose": "revocation",
"statusListIndex": 1,
"statusListCredential": "https://jchartrand.github.io/status-test-three/DKSPRCX9WB"
credentialStatus: {
id: 'https://jchartrand.github.io/status-test-three/DKSPRCX9WB#1',
type: 'BitstringStatusListEntry',
statusPurpose: 'revocation',
statusListIndex: 1,
statusListCredential: 'https://jchartrand.github.io/status-test-three/DKSPRCX9WB'
}
};
}

export default () => {
nock('http://localhost:4008', { encodedQueryParams: true })
Expand All @@ -168,7 +168,7 @@ export default () => {
'keep-alive',
'Keep-Alive',
'timeout=5'
]);
])

nock('http://localhost:4006', { encodedQueryParams: true })
.post('/instance/protected_test/credentials/sign', unsignedVcWithStatus)
Expand All @@ -189,24 +189,24 @@ export default () => {
'keep-alive',
'Keep-Alive',
'timeout=5'
]);
])

/* nock('http://127.0.0.1:55225', { encodedQueryParams: true })
.post('/instance/un_protected_test/credentials/issue', unsignedVcWithoutStatus)
.reply(200, signedVcWithStatus, [
'X-Powered-By',
'Express',
'Access-Control-Allow-Origin',
'*',
'Content-Type',
'application/json; charset=utf-8',
'Content-Length',
'1810',
'ETag',
'W/"712-fUBsd5PM46QPKrivsShMP8gvwtc"',
'Date',
'Tue, 22 Aug 2023 20:11:09 GMT',
'Connection',
'close'
]); */
};
/* nock('http://127.0.0.1:55225', { encodedQueryParams: true })
.post('/instance/un_protected_test/credentials/issue', unsignedVcWithoutStatus)
.reply(200, signedVcWithStatus, [
'X-Powered-By',
'Express',
'Access-Control-Allow-Origin',
'*',
'Content-Type',
'application/json; charset=utf-8',
'Content-Length',
'1810',
'ETag',
'W/"712-fUBsd5PM46QPKrivsShMP8gvwtc"',
'Date',
'Tue, 22 Aug 2023 20:11:09 GMT',
'Connection',
'close'
]) */
}
Loading

0 comments on commit 06e6bb1

Please sign in to comment.