Skip to content

Commit

Permalink
chore: allow to enable status list support
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Oct 8, 2024
1 parent 05c2811 commit c09c128
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
39 changes: 37 additions & 2 deletions packages/agent/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ import {
AUTHENTICATION_STRATEGY,
AUTHORIZATION_ENABLED,
AUTHORIZATION_GLOBAL_REQUIRE_USER_IN_ROLES,
DB_CONNECTION_NAME,
DB_CONNECTION_NAME, DB_DATABASE_NAME,
DB_ENCRYPTION_KEY,
DID_API_BASE_PATH,
DID_API_RESOLVE_MODE,
INTERNAL_PORT,
IS_CONTACT_MANAGER_ENABLED,
IS_JWKS_HOSTING_ENABLED,
IS_OID4VCI_ENABLED,
IS_OID4VP_ENABLED,
IS_OID4VP_ENABLED, IS_STATUS_LIST_ENABLED,
IS_VC_API_ENABLED,
OID4VCI_API_BASE_URL,
OID4VP_DEFINITIONS,
Expand Down Expand Up @@ -93,6 +93,7 @@ import {
VC_API_FEATURES
} from './environment-deps'
import {dbConnection} from "./database";
import {getOrCreateConfiguredStatusList} from "./utils/statuslist";

/**
* Lets setup supported DID resolvers first
Expand Down Expand Up @@ -436,6 +437,40 @@ if (!cliMode) {
new PublicKeyHosting({ agent, expressSupport, opts: { hostingOpts: { enableFeatures: ['did-jwks'] } } })
}


if (IS_STATUS_LIST_ENABLED) {
new StatuslistManagementApiServer({
opts: {
endpointOpts: {
globalAuth: {
authentication: {
enabled: false,
// strategy: bearerStrategy,
},
},
vcApiCredentialStatus: {
dbName: DB_DATABASE_NAME,
disableGlobalAuth: true,
correlationId: 'status_list_default',
},
getStatusList: {
dbName: DB_DATABASE_NAME,
},
createStatusList: {
dbName: DB_DATABASE_NAME,
},
},
enableFeatures: ['w3c-vc-api-credential-status', 'status-list-hosting', 'status-list-management'],
},
expressSupport,
agent,
})

await getOrCreateConfiguredStatusList({issuer: defaultDID, keyRef: defaultKid}).catch(e => console.log(`ERROR statuslist`, e))

}


// Import presentation definitions from disk.
const definitionsToImport: Array<IPresentationDefinition> = syncDefinitionsOpts.asArray.filter((definition) => {
const { id, name } = definition ?? {}
Expand Down
2 changes: 2 additions & 0 deletions packages/agent/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export const VC_API_DEFAULT_PROOF_FORMAT = env('VC_API_DEFAULT_PROOF_FORMAT', EN
export const IS_CONTACT_MANAGER_ENABLED = toBoolean(process.env.CONTACT_MANAGER_ENABLED, true)

export const IS_JWKS_HOSTING_ENABLED = toBoolean(process.env.JWKS_HOSTING_ENABLED, true)
export const IS_STATUS_LIST_ENABLED = toBoolean(process.env.IS_STATUS_LIST_ENABLED, true)


export const STATUS_LIST_API_BASE_PATH = env('STATUS_LIST_API_BASE_PATH', ENV_VAR_PREFIX) ?? VC_API_BASE_PATH
export const STATUS_LIST_ISSUER = env('STATUS_LIST_ISSUER', ENV_VAR_PREFIX) ?? DEFAULT_DID
Expand Down

0 comments on commit c09c128

Please sign in to comment.