Skip to content

Add a custom ephemeral key storage callback to the SDK - #1357

Open
ebma wants to merge 8 commits into
stagingfrom
feat/sdk-ephemeral-storage-callback
Open

Add a custom ephemeral key storage callback to the SDK#1357
ebma wants to merge 8 commits into
stagingfrom
feat/sdk-ephemeral-storage-callback

Conversation

@ebma

@ebma ebma commented Aug 25, 2026

Copy link
Copy Markdown
Member

Summary

SDK integrators could opt out of the built-in ephemeral key backup (storeEphemeralKeys: false), but could not supply their own persistence: the secrets never cross the public SDK surface, so disabling the flag simply meant no recovery material at all. Clients wanting encrypted or vault-backed storage (KMS, HSM, backend DB) had no supported path.

This adds an optional storeEphemeralKeysCallback to VortexSdkConfig:

  • When configured, the SDK calls it with the structured recovery material (StoredEphemeralKey[]: { address, rampId, secret, type }) plus the ramp ID instead of using the built-in JSON-file/localStorage storage; storeEphemeralKeys then has no effect.
  • The fail-closed registration contract carries over unchanged: the callback is awaited during registerRamp, and a rejection aborts registration before ephemeral-owned transactions are signed.
  • Write-only by design — the SDK never reads keys back, and no automated recovery flow is planned.
  • Additive and non-breaking; without the callback, behavior is byte-for-byte identical.

Changes

  • packages/sdk/src/types.ts — new public StoredEphemeralKey / StoreEphemeralKeysCallback types and the config field
  • packages/sdk/src/VortexSdk.tsstoreEphemerals dispatches to the callback when configured
  • packages/sdk/test/vortexSdk.storeEphemerals.test.ts — regression tests: callback payload + built-in storage skipped, precedence over storeEphemeralKeys: false, rejection propagation (fail-closed), disabled storage stores nothing
  • Docs sync: SDK README.md (usage + example), ARCHITECTURE.md custody section, docs/security-spec/02-signing-keys/ephemeral-accounts.md (invariant 4 distinguishes local-only built-in storage from integrator-custodied callback destination)
  • .agents/skills/vortex-integration/SKILL.md — corrects a pre-existing wrong claim that storeEphemeralKeys: false allowed self-managed persistence

Testing

  • bun run test in packages/sdk: 62 tests pass, plus build, NodeNext consumer typecheck, and Node + browser dist smoke-loads
  • bun lint (ESLint) clean

ebma added 3 commits August 25, 2026 18:47
Integrations wanting encrypted or vault-backed ephemeral recovery storage
previously had no hook: the secrets never crossed the public SDK surface,
and storeEphemeralKeys: false silently disabled the backup entirely. The
callback replaces the built-in file/localStorage persistence and keeps
the fail-closed registration contract.
Sync README, ARCHITECTURE, and the ephemeral-accounts security spec with
the new storeEphemeralKeysCallback: built-in storage stays local-only,
a configured callback shifts destination custody to the integrator, and
both paths keep the fail-closed registration contract.
The skill claimed integrators could set storeEphemeralKeys: false and
persist the keys themselves, but the secrets never crossed the public
SDK surface, so that flag alone just disabled the recovery backup.
Point custom-storage integrations at storeEphemeralKeysCallback.
@netlify

netlify Bot commented Aug 25, 2026

Copy link
Copy Markdown

Deploy Preview for vortexfi canceled.

Name Link
🔨 Latest commit d2d3994
🔍 Latest deploy log https://app.netlify.com/projects/vortexfi/deploys/6a915c3fffa49d000810e3fe

@netlify

netlify Bot commented Aug 25, 2026

Copy link
Copy Markdown

Deploy Preview for vortex-sandbox ready!

Name Link
🔨 Latest commit d2d3994
🔍 Latest deploy log https://app.netlify.com/projects/vortex-sandbox/deploys/6a915c3fc229aa00096ccb5b
😎 Deploy Preview https://deploy-preview-1357--vortex-sandbox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 25, 2026

Copy link
Copy Markdown

Deploy Preview for vrtx-dashboard canceled.

Name Link
🔨 Latest commit d2d3994
🔍 Latest deploy log https://app.netlify.com/projects/vrtx-dashboard/deploys/6a915c3fffa49d000810e403

Additive only: StoredEphemeralKey, StoreEphemeralKeysCallback, and the
optional storeEphemeralKeysCallback config field. No existing surface
changed, so live integrators are unaffected.
@ebma
ebma requested a balanced review from Copilot August 25, 2026 17:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ebma
ebma requested a balanced review from Copilot August 25, 2026 18:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants