Catalog npm
Back to packageRELEASE DETAILS

0.2.0

npm

@0xkey-io/crypto

Encryption, decryption, and key related utility functions

Published23 Jun 2026
Direct dependencies12
Transitive dependenciesNot calculated

README

Current package documentation

@0xkey-io/crypto

This package consolidates some common cryptographic utilities used across our applications, particularly primitives related to keys, encryption, and decryption in a pure JS implementation. For react-native you will need to polyfill our random byte generation by importing react-native-get-random-values

Example usage (Hpke E2E):

const senderKeyPair = generateP256KeyPair();
const receiverKeyPair = generateP256KeyPair();

const receiverPublicKeyUncompressed = uncompressRawPublicKey(
  uint8ArrayFromHexString(receiverKeyPair.publicKey),
);

const plainText = "Hello, this is a secure message!";
const plainTextBuf = textEncoder.encode(plainText);
const encryptedData = hpkeEncrypt({
  plainTextBuf: plainTextBuf,
  encappedKeyBuf: receiverPublicKeyUncompressed,
  senderPriv: senderKeyPair.privateKey,
});

// Extract the encapsulated key buffer and the ciphertext
const encappedKeyBuf = encryptedData.slice(0, 33);
const ciphertextBuf = encryptedData.slice(33);

const decryptedData = hpkeDecrypt({
  ciphertextBuf,
  encappedKeyBuf: uncompressRawPublicKey(encappedKeyBuf),
  receiverPriv: receiverKeyPair.privateKey,
});

// Convert decrypted data back to string
const decryptedText = new TextDecoder().decode(decryptedData);

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 12

Native requirements
12 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
borsh
Environment
{
  "local_name": "borsh",
  "alias": false,
  "peer_metadata": null
}
2.0.0runtime
cbor-js
Environment
{
  "local_name": "cbor-js",
  "alias": false,
  "peer_metadata": null
}
0.1.0runtime
@noble/curves
Environment
{
  "local_name": "@noble/curves",
  "alias": false,
  "peer_metadata": null
}
1.9.0runtime
@noble/hashes
Environment
{
  "local_name": "@noble/hashes",
  "alias": false,
  "peer_metadata": null
}
1.8.0runtime
@noble/ciphers
Environment
{
  "local_name": "@noble/ciphers",
  "alias": false,
  "peer_metadata": null
}
1.3.0runtime
@peculiar/x509
Environment
{
  "local_name": "@peculiar/x509",
  "alias": false,
  "peer_metadata": null
}
1.12.3runtime
@0xkey-io/encoding
Environment
{
  "local_name": "@0xkey-io/encoding",
  "alias": false,
  "peer_metadata": null
}
0.1.1runtime
@0xkey-io/sdk-types
Environment
{
  "local_name": "@0xkey-io/sdk-types",
  "alias": false,
  "peer_metadata": null
}
0.1.0runtime
jest
Environment
{
  "local_name": "jest",
  "alias": false,
  "peer_metadata": null
}
29.7.0development
@types/jest
Environment
{
  "local_name": "@types/jest",
  "alias": false,
  "peer_metadata": null
}
^29.5.3development
@types/cbor-js
Environment
{
  "local_name": "@types/cbor-js",
  "alias": false,
  "peer_metadata": null
}
^0.1.1development
@0xkey-io/internal-crypto-core
Environment
{
  "local_name": "@0xkey-io/internal-crypto-core",
  "alias": false,
  "peer_metadata": null
}
0.1.0development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "4c0eeadf004a5d0231f0c478df9c0ec11004347c",
  "tarball": "https://registry.npmjs.org/@0xkey-io/crypto/-/crypto-0.2.0.tgz",
  "fileCount": 22,
  "integrity": "sha512-j461F1VXYUlrmenA3Hp8EOC+QaEnqYzOFaaUOra7Yj2SEHHUB2KPgqaz1XqwRVdsOG6adAZWKGOCvUYUt1wxdA==",
  "signatures": [
    {
      "sig": "MEYCIQCD1U/Y+Dp21tmJ8kMWEqB+HDnf3UkrlP1hDkf7y5bjNAIhANi08RAx+9raYZp2kFho2kySwpm3KsulTbvMU1qaTNGz",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "unpackedSize": 456418
}

Repository

PENDING
0xkey-io/sdk-js

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:00 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:bb0135310c2785b0bbef993c625fde9fe796ce596c0e5da435011e5f82e4a841

Other collected versions

0.3.03 Jul0.1.122 May0.1.022 MayView all collected versions →