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

Adding js/ts util method to verify JWT's generated by a scanner #212

Merged
merged 7 commits into from
Sep 7, 2022

Conversation

Robert-H-Leonard
Copy link
Contributor

@Robert-H-Leonard Robert-H-Leonard commented Sep 5, 2022

Feature work

  • Added new method to JS/TS sdk to verify a JWT generated by a scanner
  • Added new method to python sdk to verify a JWT generated by a scanner

Testing

Manual/Local testing

In order to validate the verification locally I generated a JWT locally and called the verify method during the initialization of my bot running locally. B/c this bot isn't deployed to validate the happy path locally, during testing I found a bot and an scanner who were linked and hardcoded their addresses in the call to areTheyLinked to make sure the smart contract call was valid:

  • BotId: 0xe0889c513f9b4fcad87f9c26e9df2e25474223b3b77f7348ee5398bec4e0ee73
  • ScannerId: 0xBF536900A88F13D02bc1ff80Af84e480c591001E

@Robert-H-Leonard Robert-H-Leonard changed the title WIP: Adding js/ts util method to verify JWT's generated by a scanner WIP: Adding js/ts and python util method to verify JWT's generated by a scanner Sep 5, 2022
@Robert-H-Leonard
Copy link
Contributor Author

In terms of E2E testing are there any other ways to test without having to manually deploy a bot?

Copy link
Collaborator

@haseebrabbani haseebrabbani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not seeing the Python SDK changes in the PR (maybe forgot to commit?)

sdk/utils.ts Outdated Show resolved Hide resolved
sdk/utils.ts Outdated Show resolved Hide resolved
sdk/utils.ts Outdated Show resolved Hide resolved
sdk/utils.ts Show resolved Hide resolved
sdk/utils.ts Show resolved Hide resolved
@haseebrabbani
Copy link
Collaborator

In terms of E2E testing are there any other ways to test without having to manually deploy a bot?

E2E would imply that we are testing the whole stack (and therefore deploying a bot). we can definitely unit test these methods (just created a ticket to add unit tests for SDK methods #213)

@Robert-H-Leonard Robert-H-Leonard changed the title WIP: Adding js/ts and python util method to verify JWT's generated by a scanner Adding js/ts util method to verify JWT's generated by a scanner Sep 6, 2022
python-sdk/src/forta_agent/utils.py Outdated Show resolved Hide resolved
python-sdk/src/forta_agent/utils.py Outdated Show resolved Hide resolved
@@ -7,7 +7,7 @@
from .trace import Trace, TraceAction, TraceResult
from .event_type import EventType
from .network import Network
from .utils import get_json_rpc_url, create_block_event, create_transaction_event, get_web3_provider, keccak256, get_transaction_receipt, get_alerts, fetch_Jwt_token, decode_Jwt_token
from .utils import get_json_rpc_url, create_block_event, create_transaction_event, get_web3_provider, keccak256, get_transaction_receipt, get_alerts, fetch_Jwt, decode_Jwt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fetch_jwt, decode_jwt*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

python-sdk/src/forta_agent/utils.py Outdated Show resolved Hide resolved
sdk/utils.ts Outdated Show resolved Hide resolved
sdk/utils.ts Outdated Show resolved Hide resolved
@Robert-H-Leonard Robert-H-Leonard merged commit dd5a8ff into master Sep 7, 2022
@haseebrabbani haseebrabbani deleted the parsing-signature-from-jwt branch September 7, 2022 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants