Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/fixtures/auth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'node:fs'
import { ed25519 } from '@noble/curves/ed25519'
import { ed25519 } from '@noble/curves/ed25519.js'

const BASE58_ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "^0.3.185",
"@noble/curves": "^1.8.2",
"@noble/curves": "^2.4.0",
"@noble/hashes": "^2.2.0",
"@sip-protocol/sdk": "^0.11.0",
"@sip-protocol/types": "^0.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/agent/src/routes/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Router, type Request, type Response, type NextFunction } from 'express'
import jwt from 'jsonwebtoken'
import crypto from 'node:crypto'
import { ed25519 } from '@noble/curves/ed25519'
import { ed25519 } from '@noble/curves/ed25519.js'
import { createStore } from '../state/ephemeral.js'

// ─────────────────────────────────────────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion packages/agent/src/sentinel/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
WSOL_MINT,
} from '@sipher/sdk'
import type { ScanParams } from '@sipher/sdk'
import { ed25519 } from '@noble/curves/ed25519'
import { ed25519 } from '@noble/curves/ed25519.js'
import { type Detection, detectUnclaimedPayment, detectBalanceChange } from './detector.js'
import { getSentinelConfig } from './config.js'
import { loadNetworkConfig } from '../config/network.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/agent/src/tools/claim-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Buffer } from 'node:buffer'
import { ed25519 } from '@noble/curves/ed25519'
import { ed25519 } from '@noble/curves/ed25519.js'
import {
WSOL_MINT,
USDC_MINT,
Expand Down
2 changes: 1 addition & 1 deletion packages/agent/src/tools/consolidate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AnthropicTool } from '../pi/tool-adapter.js'
import { createScheduledOp, getOrCreateSession } from '../db.js'
import { createConnection, scanForPayments } from '@sipher/sdk'
import { ed25519 } from '@noble/curves/ed25519'
import { ed25519 } from '@noble/curves/ed25519.js'
import { loadNetworkConfig } from '../config/network.js'

// ─────────────────────────────────────────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion packages/agent/src/tools/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
scanForPayments,
fromBaseUnits,
} from '@sipher/sdk'
import { ed25519 } from '@noble/curves/ed25519'
import { ed25519 } from '@noble/curves/ed25519.js'
import { loadNetworkConfig } from '../config/network.js'

// ─────────────────────────────────────────────────────────────────────────────
Expand Down
4 changes: 2 additions & 2 deletions packages/agent/tests/routes/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, it, expect, beforeEach, afterEach } from 'vitest'
import express from 'express'
import supertest from 'supertest'
import jwt from 'jsonwebtoken'
import { ed25519 } from '@noble/curves/ed25519'
import { ed25519 } from '@noble/curves/ed25519.js'

const JWT_SECRET = 'test-jwt-secret-at-least-16-chars'

Expand Down Expand Up @@ -30,7 +30,7 @@ function encodeBase58(bytes: Uint8Array): string {
* Returns { privateKey, publicKey, wallet } where wallet is the base58 address.
*/
function generateTestWallet() {
const privateKey = ed25519.utils.randomPrivateKey()
const privateKey = ed25519.utils.randomSecretKey()
const publicKey = ed25519.getPublicKey(privateKey)
return { privateKey, publicKey, wallet: encodeBase58(publicKey) }
}
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/src/privacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { TOKEN_PROGRAM_ID } from '@solana/spl-token'
import { checkEd25519StealthAddress } from '@sip-protocol/sdk'
import type { StealthAddress } from '@sip-protocol/sdk'
import { ed25519 } from '@noble/curves/ed25519'
import { ed25519 } from '@noble/curves/ed25519.js'
import { sha256 as sha256Hash, sha512 } from '@noble/hashes/sha2.js'
import {
SIPHER_VAULT_PROGRAM_ID,
Expand Down Expand Up @@ -350,9 +350,9 @@ export async function scanForPayments(

// Compute viewTag: sha256(viewingScalar * ephemeralPub)[0]
// This matches what checkEd25519StealthAddress does internally.
const ephPoint = ed25519.ExtendedPoint.fromHex(ephRaw)
const ephPoint = ed25519.Point.fromBytes(ephRaw)
const sharedSecretPoint = ephPoint.multiply(viewingScalar)
const sharedSecretHash = sha256Hash(sharedSecretPoint.toRawBytes())
const sharedSecretHash = sha256Hash(sharedSecretPoint.toBytes())
const viewTag = sharedSecretHash[0]

const stealthAddr: StealthAddress = {
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/tests/privacy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@sip-protocol/sdk'
import { sha256 } from '@noble/hashes/sha2.js'
import { sha512 } from '@noble/hashes/sha2.js'
import { ed25519 } from '@noble/curves/ed25519'
import { ed25519 } from '@noble/curves/ed25519.js'
import { PublicKey, type Connection } from '@solana/web3.js'
import { scanForPayments, buildPrivateSendTx } from '../src/privacy.js'
import { deriveVaultConfigPDA } from '../src/vault.js'
Expand Down Expand Up @@ -411,9 +411,9 @@ describe('Scan matching simulation', () => {
// On-chain events don't store the viewTag, so the scanner derives it
// (canonical EIP-5564: the ECDH shared secret is computed on the viewing key).
const viewingScalar = deriveEd25519Scalar(hexToBytes(meta.viewingPrivateKey))
const ephPoint = ed25519.ExtendedPoint.fromHex(stripped)
const ephPoint = ed25519.Point.fromBytes(stripped)
const sharedPoint = ephPoint.multiply(viewingScalar)
const sharedHash = sha256(sharedPoint.toRawBytes())
const sharedHash = sha256(sharedPoint.toBytes())
const viewTag = sharedHash[0]

const reconstructed = {
Expand Down
116 changes: 107 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/routes/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { sha256 } from '@noble/hashes/sha2.js'
import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js'
import { PublicKey, Keypair, Transaction } from '@solana/web3.js'
import { getAssociatedTokenAddress, createTransferInstruction, getAccount } from '@solana/spl-token'
import { ed25519 } from '@noble/curves/ed25519'
import { ed25519 } from '@noble/curves/ed25519.js'

const router = Router()

Expand Down Expand Up @@ -191,7 +191,7 @@ router.post(
let validScalar = scalarBigInt % ED25519_ORDER
if (validScalar === 0n) validScalar = 1n

const derivedPubKeyBytes = ed25519.ExtendedPoint.BASE.multiply(validScalar).toRawBytes()
const derivedPubKeyBytes = ed25519.Point.BASE.multiply(validScalar).toBytes()
if (!derivedPubKeyBytes.every((b, i) => b === expectedPubKeyBytes[i])) {
throw new Error('Stealth key derivation failed: derived key does not match expected public key')
}
Expand Down
Loading