feat: support multiple session key grants in single request#1055
Open
avataraad wants to merge 1 commit into
Open
feat: support multiple session key grants in single request#1055avataraad wants to merge 1 commit into
avataraad wants to merge 1 commit into
Conversation
Allow `grantPermissions` to accept an array of permission requests, enabling apps to register multiple session keys in a single passkey prompt via `wallet_connect`. The relay infrastructure already supports `authorizeKeys: Key[]`, so this change is purely at the SDK layer. Changes: - `grantPermissions.Request` schema accepts `Request | readonly Request[]` - `PermissionsRequest.toKeys()` batch helper for parallel key generation - `createAccount`, `loadAccounts`, `prepareUpgradeAccount` mode actions accept array permissions and spread all session keys into authorizeKeys - Dialog mode updated with same array normalization pattern - Fix: pass `webAuthn` config to `Key.sign()` in relay `grantPermissions` (prevents crash on React Native WebAuthn environments) Backward compatible — single permission objects still accepted everywhere. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
@avataraad is attempting to deploy a commit to the Tempo Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Apps that need multiple session keys (e.g. server-side automation keys + local biometric-gated key) currently require N separate passkey prompts — one per
grantPermissionscall. This PR allows batching multiple permission grants into a singlewallet_connectcall, so all session keys are registered atomically in one passkey prompt.grantPermissionscapability now acceptsRequest | readonly Request[](backward compatible — single objects still work)PermissionsRequest.toKeys()batch helper for parallel key generationcreateAccount,loadAccounts, andprepareUpgradeAccountnormalize permissions to arrays and spread all session keys intoauthorizeKeyswebAuthnconfig toKey.sign()in relaygrantPermissionshandler (prevents crash in React Native WebAuthn environments)Motivation
Our wallet creates 3 distinct session keys at account creation:
Today this requires 3 passkey prompts — terrible UX. With this change:
Why this works
The relay infrastructure already supports this —
authorizeKeys: Key[]is an array at every layer:relay/schema/capabilities.ts—authorizeKeys = z.readonly(z.array(Key.WithPermissions))RelayActions.prepareCalls()—authorizeKeys?: readonly Key.Key[]createAccountalready sends[adminKey, ...adminKeys, sessionKey]todayThis PR just removes the artificial singular constraint at the SDK TypeScript/schema layer.
Files changed (5)
schema/capabilities.tsgrantPermissions.RequestacceptsRequest | readonly Request[]permissionsRequest.tstoKeys()batch helpermode.tspermissionsparam accepts arrays on 3 actionsmodes/relay.tsmodes/dialog.tsTest plan
tsc --noEmitpasses with zero type errorswallet_connectwith array of 3 permission requests creates account with 3 session keys🤖 Generated with Claude Code