diff --git a/app/modules/bma/lib/controllers/wot.ts b/app/modules/bma/lib/controllers/wot.ts index 40686e297dd6d87f471c31d3a5c8d3aa4ed4532c..73422c518b6fe41820b115de7237280ecae6a613 100644 --- a/app/modules/bma/lib/controllers/wot.ts +++ b/app/modules/bma/lib/controllers/wot.ts @@ -133,7 +133,7 @@ export class WOTBinding extends AbstractController { async certifiersOf(req: any): Promise<HttpCertifications> { const search = await ParametersService.getSearchP(req); let idty: FullIindexEntry; - if (req.query.pubkey) { + if (ParametersService.getIsPubkey(req)) { idty = (await this.server.dal.getWrittenIdtyByPubkeyForHashingAndIsMember( search )) as FullIindexEntry; @@ -188,7 +188,7 @@ export class WOTBinding extends AbstractController { async requirements(req: any): Promise<HttpRequirements> { const search = await ParametersService.getSearchP(req); let identities: any = []; - if (req.query.pubkey) { + if (ParametersService.getIsPubkey(req)) { if (!BMAConstants.PUBLIC_KEY.test(search)) { throw BMAConstants.ERRORS.NO_IDTY_MATCHING_PUB_OR_UID; } @@ -245,7 +245,7 @@ export class WOTBinding extends AbstractController { async certifiedBy(req: any): Promise<HttpCertifications> { const search = await ParametersService.getSearchP(req); let idty: FullIindexEntry; - if (req.query.pubkey) { + if (ParametersService.getIsPubkey(req)) { idty = (await this.server.dal.getWrittenIdtyByPubkeyForHashingAndIsMember( search )) as FullIindexEntry; diff --git a/app/modules/bma/lib/parameters.ts b/app/modules/bma/lib/parameters.ts index 49a437f26c53ad1e00efcd9146f2bdcea021c730..c5463ecd963be1655785292a448d83d6f42179d0 100644 --- a/app/modules/bma/lib/parameters.ts +++ b/app/modules/bma/lib/parameters.ts @@ -96,6 +96,16 @@ export class ParametersService { callback(null, matches[0]); }; + static getIsPubkey(req: any): boolean { + const value = req.query.pubkey; + return ( + value !== null && + value !== undefined && + value !== "false" && + value !== false + ); + } + static getPubkeyP(req: any) { return Q.nbind(ParametersService.getPubkey, this)(req); }