util-crypto: use the current @noble/hashes and @noble/curves APIs

The ranges ^1.3 resolve to @noble/curves 1.9 and @noble/hashes 1.8 for
everyone who installs this package, and those mark the calls used here
deprecated: the sha256/sha512/blake2b module paths, ProjectivePoint,
toRawBytes, px/py, Signature.fromCompact.

- hashes from @noble/hashes/sha2 and @noble/hashes/blake2
- secp256k1.Point with toBytes(true) for compression
- expand reads the affine x/y (toAffine) instead of the projective fields
- recover builds the signature with Signature.fromBytes(sig, 'compact') and
  returns toBytes() (compressed, as toRawBytes() did). Its method form of
  recoverPublicKey stays, with the reason on the line: the replacement is not
  in @noble/curves 1.9's types, and 2.x, which types it, is ESM-only.

The minimum versions rise with this (package.json, next commit).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Satoshi Qazi MuhammedandClaude Opus 5.5 authored and SatoshiQaziMuhammed committed 2026-10-07 19:21:45 +04:00
1 parent 6575789cfc
commit e9cccd2a04
7 files changed
+20 -17

No files matched your search

+2 -3
View File
@@ -1,9 +1,8 @@
// Copyright 2017-2025 @pezkuwi/util-crypto authors & contributors
// Copyright 2017-2026 @pezkuwi/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { hmac } from '@noble/hashes/hmac';
import { sha256 } from '@noble/hashes/sha256';
import { sha512 } from '@noble/hashes/sha512';
import { sha256, sha512 } from '@noble/hashes/sha2';
import { hasBigInt, u8aToU8a } from '@pezkuwi/util';
import { hmacSha256, hmacSha512, isReady } from '@pezkuwi/wasm-crypto';