-
Notifications
You must be signed in to change notification settings - Fork 41
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
Conversation
Pull Request Test Coverage Report for Build 8881628851Details
💛 - Coveralls |
chain_id?: string; | ||
signer_address?: `0x${string}`; | ||
|
||
constructor(props?: { signer_address?: `0x${string}`; chain_id?: string }) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
new AuthPayload({ | ||
chain_id: undefined, | ||
signer_address: undefined, | ||
}), |
There was a problem hiding this comment.
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());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in 880cda4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 🚀
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 theAuth
decorator according to the session present in the requestChanges
AuthPayload
toAuthPayloadDto
AuthPayload
entityAuthPayload
inAuth
decorator