-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
feat: add a customProvider
option to the sdk JwtBearerAuth
class
#5105
base: main
Are you sure you want to change the base?
Conversation
customProvider
option to the sdk JwtBearerAuth
class
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.
LGTM
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@@ -44,6 +46,11 @@ export class JwtBearerAuth implements SIWEInterface, SRPInterface { | |||
throw new UnsupportedAuthTypeError('unsupported auth type'); | |||
} | |||
|
|||
setCustomProvider(provider: Eip1193Provider) { | |||
this.#assertSRP(this.#type, this.#sdk); |
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.
Perfect! Yeah we only need this for the SRP flow for now 🙂
@@ -143,6 +143,28 @@ describe('Authentication - constructor()', () => { | |||
); | |||
}).toThrow(UnsupportedAuthTypeError); | |||
}); | |||
|
|||
it('supports using a custom provider as a constructor option', async () => { |
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.
Amazing tests!
Explanation
This PR adds the possibility to use a
customProvider
for theJwtBearerAuth
class.This is added both as a constructor option, and as a method to set the custom provider as a later point in time, using the
setCustomProvider
method.References
Changelog
@metamask/profile-sync-controller
customProvider
option for the sdkJwtBearerAuth
classChecklist