Repository navigation
feat(tempo): add Account.serialize, Account.deserialize and keyAuthorization option - #5388
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 5591c21 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5591c215c7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const accessKeyAddress = Address.fromPublicKey(parameters.publicKey) | ||
| if ( | ||
| keyAuthorization && | ||
| !Address.isEqual(keyAuthorization.address, accessKeyAddress) |
There was a problem hiding this comment.
Validate authorization identity before caching it
When the same P256 public key was authorized with one key type but is reconstructed with another (for example, p256 versus webAuthn), or when the authorization names a different parent account, this address-only check accepts and caches it. The transaction path requires the authorization's key type and named account to match exactly (src/tempo/internal/relay/feePayer.ts:668-690), so the account will attach an unusable authorization and its first transaction will fail; validate keyAuthorization.type and any keyAuthorization.account against parameters.keyType and parentAddress here.
Useful? React with 👍 / 👎.
| * @param account Configurable account. | ||
| * @returns Serialized account. | ||
| */ | ||
| export function serialize(account: ConfigurableAccount): Serialized { |
There was a problem hiding this comment.
Add site docs for the new persistence APIs
A repo-wide search of site/pages and site/vocs.config.ts finds the existing Account.fromConfig page and sidebar entry, but no page or navigation entry for either new Account.serialize or Account.deserialize API. This leaves the newly exported persistence workflow undiscoverable from the public Tempo documentation; add the required account subpages and sidebar wiring.
AGENTS.md reference: AGENTS.md:L106-L107
Useful? React with 👍 / 👎.
| | 'keyAuthorization' | ||
| | 'keyAuthorizationManager' |
There was a problem hiding this comment.
Add type tests for the new public signatures
This commit adds public serialization types and threads keyAuthorization through inference-heavy conditional account constructors, but it does not update the existing src/tempo/Account.test-d.ts. The runtime tests cannot verify that keyAuthorization is accepted only with access, that those calls still infer AccessKeyAccount, or that the new serialized/deserialized shapes remain usable through the public entrypoint; add focused expectTypeOf and rejection cases for these signatures.
AGENTS.md reference: AGENTS.md:L72-L76
Useful? React with 👍 / 👎.
Adds serialization for configurable accounts (TIP-1107) and a
keyAuthorizationoption for access key accounts toviem/tempo, so apps that store accounts or access keys (such as Tempo ID's@tempoxyz/id) stop reimplementing them.Account.serialize(account)returns{ address, config? }(config in RPC format, JSON-safe).Account.deserialize(value, { credentials?, getFn? })rebuilds the account without a request. A passkey amongcredentialssigns as an owner when its public key derives an owner address. A version-zero config must deriveaddress(Account.AddressMismatchErrorotherwise), and a later version keepsaddress.keyAuthorizationonfromSecp256k1/fromP256/fromWebCryptoP256/fromHeadlessWebAuthn/fromwithaccess: the account holds the signed authorization and attaches it until the chain registers the access key. NoKeyAuthorizationManageris needed. It throws if the authorization is for another access key.Validation:
tscandpnpm test --project tempo --run src/tempo/Account.test.ts(62 tests, 7 new) pass.