Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions src/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
throw new Error('Token not decoded')
}
} catch (err) {
agent.config.logger.error('Error decoding token', err as Record<string, any>)

Check warning on line 85 in src/authentication.ts

View workflow job for this annotation

GitHub Actions / Validate

Unexpected any. Specify a different type
return Promise.reject(new StatusException(`${ErrorMessages.Unauthorized}: Invalid token`, 401))
}

Expand All @@ -97,8 +97,8 @@
}
if (role === AgentRole.RestTenantAgent) {
// Logic if the token is of tenant agent
if (scopes && scopes?.includes(SCOPES.MULTITENANT_BASE_AGENT)) {
logger.debug('Tenants cannot manage tenants')
if (scopes && !scopes?.includes(SCOPES.TENANT_AGENT)) {
logger.debug('Tenants cannot access this route')
return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401))
} else {
// Auth: tenant agent
Expand Down Expand Up @@ -157,7 +157,7 @@
jwt.verify(token, secretKey)
return true
} catch (error) {
logger.error('Error verifying jwt token', error as Record<string, any>)

Check warning on line 160 in src/authentication.ts

View workflow job for this annotation

GitHub Actions / Validate

Unexpected any. Specify a different type
return false
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/controllers/agent/AgentController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
@Request() request: Req,
@Query('storeCredential') storeCredential: boolean,
@Query('dataTypeToSign') dataTypeToSign: 'rawData' | 'jsonLd',
@Body() data: CustomW3cJsonLdSignCredentialOptions | SignDataOptions,
@Body() data: CustomW3cJsonLdSignCredentialOptions | SignDataOptions | unknown,
) {
try {
// JSON-LD VC Signing
Expand Down Expand Up @@ -160,7 +160,7 @@
}

if (!keyToUse) {
throw new Error('Unable to construct signing key.')
throw new Error('Unable to construct signing key. ')
}

const signature = await request.agent.context.wallet.sign({
Expand All @@ -178,7 +178,7 @@
@Post('/credential/verify')
public async verifyCredential(
@Request() request: Req,
@Body() credentialToVerify: SafeW3cJsonLdVerifyCredentialOptions,
@Body() credentialToVerify: SafeW3cJsonLdVerifyCredentialOptions | any,

Check warning on line 181 in src/controllers/agent/AgentController.ts

View workflow job for this annotation

GitHub Actions / Validate

Unexpected any. Specify a different type
) {
try {
const { credential, ...credentialOptions } = credentialToVerify
Expand Down
4 changes: 2 additions & 2 deletions src/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ export function RegisterRoutes(app: Router) {
const argsPolygon_createKeyPair: Record<string, TsoaRoute.ParameterSchema> = {
};
app.post('/polygon/create-keys',
authenticateMiddleware([{"jwt":["tenant","dedicated"]}]),
authenticateMiddleware([{"jwt":["tenant","dedicated","Basewallet"]}]),
...(fetchMiddlewares<RequestHandler>(Polygon)),
...(fetchMiddlewares<RequestHandler>(Polygon.prototype.createKeyPair)),

Expand Down Expand Up @@ -1538,7 +1538,7 @@ export function RegisterRoutes(app: Router) {
estimateTransactionRequest: {"in":"body","name":"estimateTransactionRequest","required":true,"ref":"DidOperationOptions"},
};
app.post('/polygon/estimate-transaction',
authenticateMiddleware([{"jwt":["tenant","dedicated"]}]),
authenticateMiddleware([{"jwt":["tenant","dedicated","Basewallet"]}]),
...(fetchMiddlewares<RequestHandler>(Polygon)),
...(fetchMiddlewares<RequestHandler>(Polygon.prototype.estimateTransaction)),

Expand Down
6 changes: 4 additions & 2 deletions src/routes/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3335,7 +3335,8 @@
{
"jwt": [
"tenant",
"dedicated"
"dedicated",
"Basewallet"
]
}
],
Expand Down Expand Up @@ -3417,7 +3418,8 @@
{
"jwt": [
"tenant",
"dedicated"
"dedicated",
"Basewallet"
]
}
],
Expand Down
Loading