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

Instantiate an AuthPayload from request #1478

Merged
merged 3 commits into from
Apr 29, 2024
Merged

Instantiate an AuthPayload from request #1478

merged 3 commits into from
Apr 29, 2024

Conversation

iamacook
Copy link
Member

Summary

Authorisation will require comparison of the chain or signer address to the session present in the request. This creates an AuthGuard entity that has helpers for achieving this. It is instantiated by the Auth decorator according to the session present in the request

Changes

  • Rename AuthPayload to AuthPayloadDto
  • Create AuthPayload entity
  • Instantiate AuthPayload in Auth decorator
  • Add/adjust associated test coverage

@iamacook iamacook requested a review from a team as a code owner April 29, 2024 14:29
@iamacook iamacook self-assigned this Apr 29, 2024
@coveralls
Copy link

coveralls commented Apr 29, 2024

Pull Request Test Coverage Report for Build 8881628851

Details

  • 12 of 12 (100.0%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.4%) to 92.28%

Totals Coverage Status
Change from base Build 8877536966: 0.4%
Covered Lines: 6891
Relevant Lines: 7204

💛 - Coveralls

chain_id?: string;
signer_address?: `0x${string}`;

constructor(props?: { signer_address?: `0x${string}`; chain_id?: string }) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can make the signer_address and the chain_id required here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed it to AuthPayloadDto in 880cda4.

Comment on lines 69 to 72
new AuthPayload({
chain_id: undefined,
signer_address: undefined,
}),
Copy link
Collaborator

Choose a reason for hiding this comment

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

If the chain_id and signer_address are required, we can change this to:

expect(authPayloadFromDecoractor).toStrictEqual(new AuthPayload());

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed in 880cda4.

@iamacook iamacook requested a review from fmrsabino April 29, 2024 15:58
Copy link
Collaborator

@fmrsabino fmrsabino left a comment

Choose a reason for hiding this comment

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

👏 🚀

@iamacook iamacook merged commit c3fa496 into main Apr 29, 2024
16 checks passed
@iamacook iamacook deleted the auth-payload-entity branch April 29, 2024 16:06
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.

None yet

3 participants