Skip to content

coti-io/coti-sdk-typescript

Repository files navigation

image image image image COTI Website

COTI SDK TypeScript

image image

Welcome to COTI SDK TypeScript, a comprehensive set of encryption, decryption, and cryptographic utilities, including RSA and AES encryption, message signing, and key handling functions. The utilities are primarily designed to work with cryptographic operations for secure communication and message signing, particularly within Ethereum smart contracts or similar environments.

Documentation

Full API documentation is available in the COTI docs

Build and Install

npm install

Testing

npm test

Deprecations

The following legacy helpers remain available for compatibility, but will be removed in a future major version:

  • buildInputText: use prepareIT for unsigned integer input-text values. buildInputText is an older 64-bit-only wrapper; prepareIT supports the canonical 128-bit itUint path.
  • buildItSignature: use signInputText with an ethers Wallet for private-key signing. For browser wallets and 256-bit values, use buildItUint256WithSigner.
  • encodeString: use binaryStringToBytes. The old name suggests UTF-8 encoding, but the function converts a node-forge binary string to bytes.
  • generateRandomAesKeySizeNumber: use generateRandomAesKeyBinaryString. The old name suggests a numeric value; it returns a 16-byte binary string.

ctUint naming

ctUint (COTI ctUint64) is a bigint that packs 32 bytes of ciphertext material on-chain, not a 64-bit plaintext value. Plaintext limits depend on the API: encryptUint/decryptUint accept up to 64-bit plaintext; prepareIT accepts up to 128-bit plaintext using the same wire format.

Do not treat prepareIT256 and buildItUint256WithSigner as interchangeable: they intentionally sign different payload formats for different callers.


To report an issue, please see the issues tab.

About

TypeScript SDK for COTI - Privacy Preserving L2

Topics

Resources

License

Code of conduct

Contributing

Stars

6 stars

Watchers

3 watching

Forks

Contributors