Skip to content

fix(sdk): reject TLS keys in wallet adapters - #1283

Merged
kvinwang merged 1 commit into
nextfrom
fix/sdk-tls-key-scalar
Sep 22, 2026
Merged

kvinwang merged 1 commit into
nextfrom
fix/sdk-tls-key-scalar

Conversation

@kvinwang

@kvinwang kvinwang commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The deprecated Python and JavaScript wallet adapters accepted GetTlsKeyResponse. Their legacy conversion read the first 32 bytes of PKCS#8 DER as private-key material. Those bytes are fixed ASN.1 framing for P-256 keys, so different TLS keys produced the same Ethereum and Solana wallets.

Affected adapters:

  • Python: to_account, to_account_secure, to_keypair, to_keypair_secure
  • JavaScript: toViemAccount, toViemAccountSecure, toKeypair, toKeypairSecure

Fix

Remove the TLS-key-to-wallet path instead of defining a new conversion for a deprecated API:

  • adapter signatures now accept only GetKeyResponse
  • runtime calls with a TLS-key response fail with TypeError
  • GetTlsKeyResponse.as_uint8array() / asUint8Array() remain unchanged
  • no PKCS#8 parser or new key-conversion contract is introduced

Applications deriving wallets must use get_key() / getKey().

Security notice

Wallets previously produced by the non-secure TLS-key path use publicly derivable private-key material. Move any assets immediately. Upgrading prevents further derivation but cannot recover existing assets.

Verification

  • Python 3.12.3: 10 targeted adapter tests passed
  • Python: mypy and Ruff passed
  • Node.js: 8 targeted Vitest tests passed
  • TypeScript: tsc --noEmit passed

@kvinwang
kvinwang force-pushed the fix/sdk-tls-key-scalar branch from 9a2a9b0 to 8131222 Compare September 20, 2026 13:57
@kvinwang kvinwang added the P0 Highest priority: review or decide before anything else in the audit batch label Sep 21, 2026
@kvinwang
kvinwang force-pushed the fix/sdk-tls-key-scalar branch from 8131222 to 87dfac0 Compare September 22, 2026 01:33
@kvinwang kvinwang changed the title fix(sdk): Python and JS TLS-key byte accessors returned ASN.1 framing, so every app derived one shared wallet fix(sdk): reject TLS keys in wallet adapters Sep 22, 2026
@kvinwang
kvinwang force-pushed the fix/sdk-tls-key-scalar branch from 87dfac0 to a7a191e Compare September 22, 2026 01:48
@kvinwang
kvinwang merged commit 856bab4 into next Sep 22, 2026
7 checks passed
@kvinwang
kvinwang deleted the fix/sdk-tls-key-scalar branch September 22, 2026 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P0 Highest priority: review or decide before anything else in the audit batch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant