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

updating the signature check in register endpoint #84

Merged
merged 1 commit into from
Sep 19, 2023
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,13 @@ Stay tuned for more integrations and services. Follow the issues on github to se

## Contributing

This project is fully open-source, backed by the $OCEAN community and is obviously open for contributions.
This project is fully open-source, backed by the OCEAN community and is open for contributions.

The first version has been implemented following the TDD strategy, so please first familiarize yourself with the test suite, which can be run using the `./manage.py test` command, directly from the root of your server in the context of your virtual environment.

## Authors and acknowledgment

Thanks to the $OCEAN community for the funding and the $OCEAN core team for the technical support and insights.
Thanks to the OCEAN community for the funding and the OCEAN core team for the technical support and insights.

## License

Expand Down
5 changes: 4 additions & 1 deletion server/oceandbs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from .models import Quote, Storage, File, PaymentMethod, AcceptedToken, UPLOAD_CODE
from .utils import check_params_validity, upload_files_to_ipfs, upload_files_to_microservice, create_allowance
from web3.auto import w3
from eth_account.messages import encode_defunct


# Storage service creation class
Expand Down Expand Up @@ -100,7 +101,9 @@ def post(self, request):
try:
print(f"Received signature in request: {signature}")
print(f"Received original_message in request: {original_message}")
recovered_address = w3.eth.account.recover_message(original_message, signature=signature)
message = encode_defunct(text=original_message)
print(f"Encoded message: {message}")
recovered_address = w3.eth.account.recover_message(message, signature=signature)
print(f"Recovered Ethereum address: {recovered_address}")
except Exception as e:
print("Failed to verify the signature.")
Expand Down
Loading