Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to bitstring status list and renames env vars for consistency #30

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ TENANT_SEED_RANDOMTESTING=generate
TENANT_SEED_DEFAULT=generate

# see the README for an explanation of logging
LOG_ALL_FILE=logs/all.log
ALL_LOG_FILE=logs/all.log
ERROR_LOG_FILE=logs/error.log
CONSOLE_LOG_LEVEL=silly # default is silly, i.e. log everything - see the README for allowed levels
LOG_LEVEL=silly # default is silly
179 changes: 98 additions & 81 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ describe('api', () => {
resetConfig()
process.env[`TENANT_SEED_${tenantName}`] =
'z1AeiPT496wWmo9BG2QYXeTusgFSZPNG3T9wNeTtjrQ3rCB'
process.env[`TENANT_DIDMETHOD_${tenantName}`] = 'web'
process.env[`TENANT_DID_METHOD_${tenantName}`] = 'web'
process.env[`TENANT_DID_URL_${tenantName}`] = 'https://example.com'
})

after(() => {
delete process.env[`TENANT_SEED_${tenantName}`]
delete process.env[`TENANT_DIDMETHOD_${tenantName}`]
delete process.env[`TENANT_DID_METHOD_${tenantName}`]
delete process.env[`TENANT_DID_URL_${tenantName}`]
})

Expand Down
6 changes: 3 additions & 3 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ async function parseTenantSeeds() {
DID_SEEDS[tenantName] = {
didSeed: await decodeSeed(value),
didMethod:
process.env[`TENANT_DIDMETHOD_${tenant}`] &&
process.env[`TENANT_DIDMETHOD_${tenant}`].toLowerCase() === 'web'
process.env[`TENANT_DID_METHOD_${tenant}`] &&
process.env[`TENANT_DID_METHOD_${tenant}`].toLowerCase() === 'web'
? 'web'
: 'key',
didUrl: process.env[`TENANT_DID_URL_${tenant}`]
Expand All @@ -56,7 +56,7 @@ function parseConfig() {
env.CONSOLE_LOG_LEVEL?.toLocaleLowerCase() || defaultConsoleLogLevel,
logLevel: env.LOG_LEVEL?.toLocaleLowerCase() || defaultLogLevel,
errorLogFile: env.ERROR_LOG_FILE,
logAllFile: env.LOG_ALL_FILE,
allLogFile: env.ALL_LOG_FILE,
port: env.PORT ? parseInt(env.PORT) : defaultPort
})
return config
Expand Down
6 changes: 3 additions & 3 deletions src/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Config', () => {
beforeEach(async () => {
resetConfig()
delete process.env[`TENANT_SEED_${tenantName}`]
delete process.env[`TENANT_DIDMETHOD_${tenantName}`]
delete process.env[`TENANT_DID_METHOD_${tenantName}`]
})

afterEach(async () => {})
Expand All @@ -27,15 +27,15 @@ describe('Config', () => {
it('uses DID:key when requested', async () => {
process.env[`TENANT_SEED_${tenantName}`] =
'z1AeiPT496wWmo9BG2QYXeTusgFSZPNG3T9wNeTtjrQ3rCB'
process.env[`TENANT_DIDMETHOD_${tenantName}`] = 'key'
process.env[`TENANT_DID_METHOD_${tenantName}`] = 'key'
const seed = await getTenantSeed('configtest')
expect(seed.didMethod).to.eql('key')
})

it('uses DID:web when requested', async () => {
process.env[`TENANT_SEED_${tenantName}`] =
'z1AeiPT496wWmo9BG2QYXeTusgFSZPNG3T9wNeTtjrQ3rCB'
process.env[`TENANT_DIDMETHOD_${tenantName}`] = 'web'
process.env[`TENANT_DID_METHOD_${tenantName}`] = 'web'
const seed = await getTenantSeed('configtest')
expect(seed.didMethod).to.eql('web')
})
Expand Down
2 changes: 1 addition & 1 deletion src/test-fixtures/.env.testing
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PORT=4007
ENABLE_HTTPS_FOR_DEV=false

LOG_ALL_FILE=logs/all.log
ALL_LOG_FILE=logs/all.log
ERROR_LOG_FILE=logs/error.log
CONSOLE_LOG_LEVEL=silly # default is silly, i.e. log everything - see the README for allowed levels
LOG_LEVEL=silly # default is silly
Expand Down
7 changes: 2 additions & 5 deletions src/test-fixtures/vc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const unsignedVC = {
'@context': [
'https://www.w3.org/2018/credentials/v1',
'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.2.json',
'https://w3id.org/vc/status-list/2021/v1',
'https://w3id.org/security/suites/ed25519-2020/v1'
],
id: 'urn:uuid:951b475e-b795-43bc-ba8f-a2d01efd2eb1',
Expand Down Expand Up @@ -45,7 +44,7 @@ const unsignedVC = {
// "credentialStatus":
const credentialStatus = {
id: 'https://digitalcredentials.github.io/credential-status-jc-test/XA5AAK1PV4#16',
type: 'StatusList2021Entry',
type: 'BitstringStatusListEntry',
statusPurpose: 'revocation',
statusListIndex: 16,
statusListCredential:
Expand All @@ -70,13 +69,11 @@ const getUnsignedVCWithStatus = () => {
}
const ed25519_2020suiteContext =
'https://w3id.org/security/suites/ed25519-2020/v1'
const statusListContext = 'https://w3id.org/vc/status-list/2021/v1'

export {
getUnsignedVC,
getUnsignedVCWithoutSuiteContext,
getCredentialStatus,
getUnsignedVCWithStatus,
ed25519_2020suiteContext,
statusListContext
ed25519_2020suiteContext
}
6 changes: 3 additions & 3 deletions src/utils/logger.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import winston from 'winston'
import { getConfig } from '../config.js'

const { errorLogFile, logAllFile, logLevel, consoleLogLevel } = getConfig()
const { errorLogFile, allLogFile, logLevel, consoleLogLevel } = getConfig()
/*
These are the default npm logging levels
that Winston uses, but we include them explicitly
Expand Down Expand Up @@ -59,10 +59,10 @@ if (errorLogFile) {
)
}

if (logAllFile) {
if (allLogFile) {
transports.push(
new winston.transports.File({
filename: logAllFile
filename: allLogFile
})
)
}
Expand Down
Loading