Skip to content

# Class diagram for new explicit session config utilities #215

@Dargon789

Description

@Dargon789

Reviewer's Guide

Implements new dapp-client utilities to build explicit session configs (including native token spending controls) and re-exports additional primitives for EOA login flows, extends login methods to support EOA, adjusts Apple OAuth handling to omit the scope parameter, and bumps multiple package versions and changelogs to 3.0.0-beta.9 with associated changesets.

Class diagram for new explicit session config utilities

classDiagram
  class SessionDuration {
    number days
    number hours
    number minutes
  }

  class NativeTokenSpending {
    bigint valueLimit
    Address[] allowedRecipients
  }

  class ExplicitSessionParams {
    number chainId
    SessionDuration expiresIn
    Permission[] permissions
    NativeTokenSpending nativeTokenSpending
  }

  class ExplicitSessionConfig {
    number chainId
    bigint valueLimit
    bigint deadline
    Permission[] permissions
  }

  class DappClientUtils {
    createExplicitSessionConfig(params ExplicitSessionParams) ExplicitSessionConfig
  }

  class LoginMethod {
    google
    apple
    email
    passkey
    mnemonic
    eoa
  }

  class AuthCodeHandler {
    LoginMethod signupKind
    buildAuthCodeRequestParams() void
  }

  SessionDuration <.. ExplicitSessionParams : uses
  NativeTokenSpending <.. ExplicitSessionParams : uses
  Permission <.. ExplicitSessionParams : uses
  Address <.. NativeTokenSpending : uses
  ExplicitSessionParams <.. DappClientUtils : input
  ExplicitSessionConfig <.. DappClientUtils : output
  LoginMethod <.. AuthCodeHandler : config
Loading

Flow diagram for createExplicitSessionConfig utility

flowchart TD
  Start([Start]) --> Now[Compute nowInSeconds from current time]
  Now --> Lifetime[Compute sessionLifetimeSeconds from expiresIn.days, expiresIn.hours, expiresIn.minutes]
  Lifetime --> Deadline[Compute deadline = nowInSeconds + sessionLifetimeSeconds]
  Deadline --> CheckPerms{Are any permissions provided?}
  CheckPerms -- No --> ThrowError[Throw Error: createExplicitSessionConfig requires at least one permission]
  CheckPerms -- Yes --> NativeSpending[Read nativeTokenSpending from params]
  NativeSpending --> ValueLimit[Set valueLimit = nativeTokenSpending.valueLimit or 0n]
  ValueLimit --> Receivers[Copy allowedRecipients into nativeTokenReceivers]
  Receivers --> MapPerms[Map each receiver to nativeTokenSpendingPermission with target and empty rules]
  MapPerms --> BuildConfig[Build ExplicitSessionConfig with chainId, valueLimit, deadline, combined permissions]
  BuildConfig --> End([Return ExplicitSessionConfig])
Loading

File-Level Changes

Change Details Files
Add utilities and exports in dapp-client to construct explicit session configs and expose network/relayer helpers and constants for consumers.
  • Introduce SessionDuration, NativeTokenSpending, and ExplicitSessionParams types to model explicit session configuration inputs, including optional native token spending constraints.
  • Implement createExplicitSessionConfig to derive ExplicitSessionConfig from human-friendly params, computing a deadline from the current time and duration, enforcing at least one base permission, and merging permission entries for allowed native token recipients and value limits.
  • Update imports to include ExplicitSessionConfig and Permission from wallet-core/wallet-primitives, add Address type from ox, and re-export VALUE_FORWARDER_ADDRESS from constants.
  • Expand dapp-client public API exports to include createExplicitSessionConfig, getNetwork, getRelayerUrl, getRpcUrl, VALUE_FORWARDER_ADDRESS, new session-related types, Network, MessageType, and TransportMessage.
packages/wallet/dapp-client/src/utils/index.ts
packages/wallet/dapp-client/src/index.ts
Extend login support to EOA and adjust Apple auth OAuth behavior to be compatible with provider expectations.
  • Add 'eoa' as a supported LoginMethod option for the dapp client.
  • Modify AuthCodeHandler to omit the OAuth scope parameter when signupKind is 'apple', while preserving existing behavior for other providers.
  • Update Apple-specific authcode test to assert that the generated authorization URL does not contain the scope query parameter.
packages/wallet/dapp-client/src/types/index.ts
packages/wallet/wdk/src/sequence/handlers/authcode.ts
packages/wallet/wdk/test/authcode.test.ts
Publish 3.0.0-beta.9 patch release across core, dapp-client, primitives, WDK, and various services with Apple auth fixes, EOA login updates, and dependency bumps.
  • Add 3.0.0-beta.7 to 3.0.0-beta.9 entries to multiple CHANGELOGs describing Apple auth fixes, dapp-client EOA login updates, and dependency updates across guard, identity-instrument, relayer, wallet-core, and wallet-primitives.
  • Bump versions from 3.0.0-beta.6 to 3.0.0-beta.9 in package.json files for services, utils/abi, wallet-core, dapp-client, wallet-primitives, and wallet-wdk packages.
  • Introduce changeset files documenting patch releases for Apple auth fixes and dapp client updates for EOA login across affected packages.
  • Update pre-release changeset configuration to include the new changesets.
packages/wallet/wdk/CHANGELOG.md
packages/wallet/dapp-client/CHANGELOG.md
packages/wallet/core/CHANGELOG.md
packages/services/relayer/CHANGELOG.md
packages/services/api/CHANGELOG.md
packages/services/builder/CHANGELOG.md
packages/services/guard/CHANGELOG.md
packages/services/identity-instrument/CHANGELOG.md
packages/services/indexer/CHANGELOG.md
packages/services/marketplace/CHANGELOG.md
packages/services/metadata/CHANGELOG.md
packages/services/userdata/CHANGELOG.md
packages/utils/abi/CHANGELOG.md
packages/wallet/primitives/CHANGELOG.md
packages/services/api/package.json
packages/services/builder/package.json
packages/services/guard/package.json
packages/services/identity-instrument/package.json
packages/services/indexer/package.json
packages/services/marketplace/package.json
packages/services/metadata/package.json
packages/services/relayer/package.json
packages/services/userdata/package.json
packages/utils/abi/package.json
packages/wallet/core/package.json
packages/wallet/dapp-client/package.json
packages/wallet/primitives/package.json
packages/wallet/wdk/package.json
.changeset/pre.json
.changeset/new-turkeys-double.md
.changeset/nice-tips-slide.md
.changeset/tiny-files-chew.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Originally posted by @sourcery-ai[bot] in #214 (comment)

Metadata

Metadata

Assignees

Labels

dependenciesPull requests that update a dependency filedocumentationImprovements or additions to documentationduplicateThis issue or pull request already existsenhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is neededinvalidThis doesn't seem rightjavascriptPull requests that update javascript codequestionFurther information is requested

Projects

Status

Done

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions