forked from humanprotocol/human-protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Milestone 4 - draft: TODO * User stats endpoint, test and possible rework of response mapping * Add unit tests * Add proxy endpoints for: - user/register-address - auth/signin/web3 * Adds test coverage, minor fixes * Adds additional proxies for 4 milestone * Reworks reputation oracle gateway test suite, adds necessary mappings * adds missing await * Review fixes * Adds /user/register-address handling * Changes endpoint name * Adds import fixes * Adds controller and module to the main app module * Updates README.md (#125) * Updates README.md: Adds Caching section, Changes in signature type * README.md updates * README.md updates * fix(app/user/worker): remove chain id validation (#114) * fix(app/user/worker): remove chain id validation * Test fix and JWT User data align * Updates README.md: Adds Caching section, Changes in signature type * Removes commented code * Changes after hcaptcha api check * Adds interceptor for axios requests * Fix/signature (#126) * Updates README.md (#125) * Updates README.md: Adds Caching section, Changes in signature type * README.md updates * README.md updates * fix(app/worker): add signature field to req body * update(app): revert readme * fix(app/register-address): fix test --------- Co-authored-by: macnablocky <[email protected]> Co-authored-by: Kacper Koza <[email protected]> * Fixes undefined in POST data, fixes unit tests * Adds Resign job feature, small changes in the gateway config (#134) * Fixes * Fixes in dependencies --------- Co-authored-by: Kacper Koza <[email protected]> Co-authored-by: maciej.nabialek <[email protected]> Co-authored-by: macnablocky <[email protected]> * Fixes restore password * Fixes restore password part 2. * review fixes --------- Co-authored-by: KacperKoza343 <[email protected]> Co-authored-by: Kacper Koza <[email protected]> Co-authored-by: Bartosz Solka <[email protected]>
- Loading branch information
1 parent
035e9b1
commit 179358e
Showing
114 changed files
with
5,812 additions
and
3,638 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/apps/human-app/server/src/common/config/gateway-config.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { | ||
HCaptchaLabelingStatsEndpoints, | ||
HCaptchaLabelingVerifyEndpoints, | ||
ReputationOracleEndpoints, | ||
} from '../enums/reputation-oracle-endpoints'; | ||
|
||
export type GatewayEndpoints = | ||
| HCaptchaLabelingStatsEndpoints | ||
| ReputationOracleEndpoints | ||
| HCaptchaLabelingVerifyEndpoints; |
18 changes: 17 additions & 1 deletion
18
packages/apps/human-app/server/src/common/config/params-decorators.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,24 @@ | ||
import { createParamDecorator, ExecutionContext } from '@nestjs/common'; | ||
import { jwtDecode } from 'jwt-decode'; | ||
import { JwtUserData } from '../interfaces/jwt-token.model'; | ||
|
||
export const Authorization = createParamDecorator( | ||
(data: unknown, ctx: ExecutionContext) => { | ||
const request = ctx.switchToHttp().getRequest(); | ||
return request.headers['authorization']; | ||
}, | ||
); | ||
); | ||
export const JwtPayload = createParamDecorator( | ||
(data: unknown, ctx: ExecutionContext): any => { | ||
const request = ctx.switchToHttp().getRequest(); | ||
const token = request.headers['authorization']?.split(' ')[1]; | ||
if (!token) return null; | ||
try { | ||
const decoded = jwtDecode(token); | ||
return decoded as JwtUserData; | ||
} catch (error) { | ||
console.error('Error in decoding token: ', error); | ||
return null; | ||
} | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/apps/human-app/server/src/common/enums/external-api-name.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export enum ExternalApiName { | ||
REPUTATION_ORACLE = 'REPUTATION_ORACLE', | ||
HCAPTCHA_LABELING_STATS = 'HCAPTCHA_LABELING_STATS', | ||
HCAPTCHA_LABELING_VERIFY = 'HCAPTCHA_LABELING_VERIFY', | ||
} |
Oops, something went wrong.