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(thegraph): serialize and deserialize subscription extra auth token claims #65

Merged
merged 1 commit into from
Dec 22, 2023

Conversation

LNSD
Copy link
Contributor

@LNSD LNSD commented Dec 20, 2023

This follow-up PR extends the Subscriptions Auth token with support for serialization and deserialization of the "extra" claims:

  • Added support for serializing and deserializing the extra claims (e.g., allowed_domains, allowed_deployments, etc.).
  • Renamed the chain_id field into chain following @Theodus suggestion in the previous PR (feat(thegraph): add support for subscription payments ticket #60 (comment)).
  • Added some "getter" methods to provide a unified fields access API following the already existing user() method.
  • Extended the test coverage.

Note

The naming of the chain_id field is an API-breaking change. Upgrading the dependency will require changes in the code using this crate.

  • Instead of relying on the struct fields, one should use the new claims field accessor functions, i.e., use either claims.chain() or claims.chain_id() instead of accessing the claims.chain field directly.

This is a follow-up PR of #60

@LNSD LNSD requested a review from Theodus December 20, 2023 12:24
@LNSD LNSD self-assigned this Dec 20, 2023

This comment was marked as resolved.

Copy link
Member

@Theodus Theodus left a comment

Choose a reason for hiding this comment

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

LGTM

#[serde(default)]
pub name: Option<String>,

/// Comma-separated list of subgraphs that can be queried with this auth token.
/// List of subgraphs that can be queried with this auth token.
#[serde_as(as = "StringWithSeparator::<CommaSeparator, SubgraphId>")]
Copy link
Member

Choose a reason for hiding this comment

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

ooh, fancy

@LNSD LNSD merged commit e402d32 into main Dec 22, 2023
5 checks passed
@LNSD LNSD deleted the lnsd/feat-thegraph-serde-subs-auth-token-extras branch December 22, 2023 00:57
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