Skip to content

Use distinct types for "with key" and "without key" in SessionEvent and SessionContext #797

Closed

Description

@spacebear21

This 2-state type is misuse of Option IMO. If this is really what the type is, it should be a variant with Publickey and without public key

Originally posted by @DanGould in #762 (comment)

Activity

  1. DanGould commented on Jun 26, 2025

    @DanGould
    Member

    I'm thinking of this more as v2::SessionContext::V1 and v2::SessionContext::V2 since that explains the reason the key is there or not there more than SessionContext::WithKey and `::WithoutKey

    edit:

    A big issue with enum Sessioncontext { WithoutKey {..}, WithKey{..} } is that the key isn't known until after the OriginalPayload has been processed.

  2. added this to the payjoin-1.0 milestone on Sep 22, 2025
  3. arminsabouri commented on Sep 22, 2025

    @arminsabouri
    Contributor

    The developer would still have to scrutinize the enum and would complicate our internal machinery. A option here may not be idomatic but worth it in this case.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions