@gtcx/crypto-native
v0.2.0
Published
Native NAPI bindings loader for GTCX cryptographic operations
Readme
@gtcx/crypto-native
Native Node.js bindings loader for GTCX cryptographic operations.
This package loads the NAPI-RS binary produced by rust/gtcx-node and exposes a stable JS/TS API.
It is optional and intended to be consumed by @gtcx/crypto as the preferred backend.
Usage
import { sign, verify, generateKeyPair } from '@gtcx/crypto-native';
const { privateKey, publicKey } = generateKeyPair();
const signature = sign(new TextEncoder().encode('hello'), privateKey);
console.log(verify(signature, new TextEncoder().encode('hello'), publicKey));Building the Native Binary
# From repo root
pnpm --filter @gtcx/crypto-native build:nativeThe build script expects the Rust toolchain and will place the native addon in:
packages/crypto-native/native/gtcx_node.node
If the binary is not present, imports will fail and callers should fall back to JS implementations.
License
MIT
