Skip to content

Organise payload issuing and validation code #921

Open
MatrixAI/Polykey-CLI
#433

Description

@aryanjassal

Specification

Currently, the JWTs are strewn everywhere, wherever it is relevant. This is kind of going against the modular and obvious domain structure we are using. So, all the different kinds of tokens, like claims tokens or identity tokens should all be present in a unified domain. In this case, all the payloads and validation methods can sit inside a directory in the tokens domain.

This will let both PKE and PKCLI to use a unified interface for issuing and validating the token, removing a potential friction point and better organising the code.

Additional context

  • Reference src/claims/payloads for a gold standard on achieving this

Tasks

  1. Move logic for creating and validating a token to src/tokens/payloads or a similar directory
  2. Reference src/claims/payloads for a gold standard

Activity

  1. self-assigned this
    on Jul 9, 2025
  2. linear commented on Jul 9, 2025

    @linear
  3. CMCDragonkai commented on Jul 9, 2025

    @CMCDragonkai
    Member

    How did JWTs get spread everywhere?

  4. aryanjassal commented on Jul 9, 2025

    @aryanjassal
    ContributorAuthor

    This was mostly prompted by a chat Brian and I had regarding centralising the signed auth token being used by the polykey auth login command into a module which can assert, parse, and maybe issue the token. This will make it easy for the logic to be imported in other applications, say PKE, instead of each application needing to roll out their own versions of parsing and validation.

    Once we were thinking about this issue, we realised that there is another session token used by Polykey, so we can consolidate the parsing and validation all under an organised path, like src/tokens/payloads. This is what this issue is addressing.

  5. tegefaulkes commented on Jul 9, 2025

    @tegefaulkes
    Contributor

    It's just consolidating. Before adding the token used to authenticate into PKE we only had the session token for the CLI sessions which had it's logic in the sessions domain and didn't define the token structure well. We're just tiding things up here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions