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

feat(client): add auth logout method #74

Merged
merged 3 commits into from
Apr 15, 2024
Merged

feat(client): add auth logout method #74

merged 3 commits into from
Apr 15, 2024

Conversation

KwilLuke
Copy link
Contributor

Add kwil.auth.logout() method to remove cookie when using KGW.

Add kwil.auth.logout() method to remove cookie when using KGW.
@KwilLuke KwilLuke marked this pull request as ready for review April 12, 2024 23:30
@KwilLuke KwilLuke requested a review from Yaiba April 12, 2024 23:30
src/auth/auth.ts Outdated
}

/**
* Authenticates a user with the Kwil Gateway (KGW). This is required to execute mustsign view actions.
Copy link

Choose a reason for hiding this comment

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

The comment is outdated, 'mustsign' action is no longer supported

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch

src/core/auth.ts Outdated
version: string,
chainId: string,
): void {
if (authParm.domain !== domain) {
Copy link

Choose a reason for hiding this comment

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

I think this is problematic if run against older kgw version? Since old kgw version won't return those fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is a good point - how are you handling this with Kwil-cli? Maybe we update the version number? So if > version 1, then run the verifyAuthProperties?

Copy link

Choose a reason for hiding this comment

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

We didn't change 'version', since 'version' is for something like template.

https://github.com/kwilteam/kwil-db/pull/657/files#diff-2a7eaeea47cbb7c8cd1df3a3972976df3131d7634f9d6a1d26d2409ee064718cR165 I only compare if the field is returned from KGW

add checks for auth properties from server before signing auth msg

Update kwil.test.ts

update auth msg
Copy link

@Yaiba Yaiba left a comment

Choose a reason for hiding this comment

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

LGTM

@KwilLuke KwilLuke merged commit 2cc16b7 into main Apr 15, 2024
2 checks passed
@KwilLuke KwilLuke deleted the feat/auth-logout branch April 15, 2024 21:40
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