Shared core package for the NeoFS TypeScript SDK. Provides cryptographic primitives, user identity utilities, type definitions, and helper functions used by platform-specific SDK packages.
- neofs-sdk-ts-react-native — uses
grpc-react-nativewith custom protobuf serialization - neofs-sdk-ts-node — uses
@grpc/grpc-jswith standard protobuf
npm install neofs-sdk-ts-coreThe package exposes four modules, each available as a subpath export:
ECDSA signing and verification with multiple signature schemes supported by NeoFS:
| Scheme | Description |
|---|---|
ECDSA_SHA512 |
ECDSA with SHA-512 hashing (FIPS 186-3) |
ECDSA_DETERMINISTIC_SHA256 |
Deterministic ECDSA with SHA-256 (RFC 6979) |
ECDSA_WALLETCONNECT |
WalletConnect signature scheme |
N3 |
Neo N3 witness |
Key exports:
Signer/SignerV2— interfaces for signing operationsPublicKey— interface for public key encoding, decoding, and verificationECDSASigner/ECDSASignerRFC6979— concrete ECDSA signer implementationsNeoFSSignature— signature wrapper with scheme-aware verificationScheme— enum of supported signature schemesregisterScheme()— register custom public key constructors per scheme- Tillich–Zémor homomorphic hash (
tzsubmodule)
import { ECDSASigner, Scheme } from 'neofs-sdk-ts-core/crypto';
const signer = new ECDSASigner(privateKeyHex);
const signature = signer.sign(data);
const pubKey = signer.getPublicKey();NeoFS Owner ID (User ID) derivation and validation. An owner ID is a 25-byte value derived from a Neo N3 public key (address version prefix + script hash + checksum).
import { ownerIdFromPublicKey, validateOwnerId } from 'neofs-sdk-ts-core/user';
const ownerId = ownerIdFromPublicKey(compressedPublicKey);
const isValid = validateOwnerId(ownerId);Decimal— arbitrary-precision decimal arithmetic for monetary computations (avoids floating-point issues). Supports protobuf serialization, add/subtract/multiply/divide, and comparison.
import { Decimal } from 'neofs-sdk-ts-core/types';
const balance = new Decimal(1000000n, 12);
console.log(balance.toString()); // "0.000001000000"Buffer and cryptographic helper functions:
hexToBytes()/bytesToHex()— hex string conversionfromBase64()/toBase64()— Base64 encoding/decodingrandomBytes()— secure random byte generationsha256()/sha512()/ripemd160()/doubleSha256()— hash functions
import { hexToBytes, sha256 } from 'neofs-sdk-ts-core/utils';
const data = hexToBytes('deadbeef');
const hash = sha256(data);# Install dependencies
npm install
# Build (compiles TypeScript to dist/)
npm run build
# Clean build artifacts
npm run cleanThis repository also contains protoc-gen-grpc-ts, a Go-based protoc plugin that generates TypeScript code from .proto files. It produces:
- Binary protobuf serialization (
BinaryWriter/BinaryReader) - gRPC service clients for React Native (
grpc-react-native) and Node.js (@grpc/grpc-js) - Support for unary, server-streaming, client-streaming, and bidirectional streaming RPCs
# Build the plugin
cd protoc-gen-grpc-ts
make build
# Install to PATH
make install
# Run tests
make testSee protoc-gen-grpc-ts/README.md for full usage documentation.