Current collected state Current
Observed since 21 Oct, 09:00 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@0xkey-io/crypto
Encryption, decryption, and key related utility functions
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);
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
borshEnvironment{
"local_name": "borsh",
"alias": false,
"peer_metadata": null
} | 2.0.0 | runtime |
cbor-jsEnvironment{
"local_name": "cbor-js",
"alias": false,
"peer_metadata": null
} | 0.1.0 | runtime |
@noble/curvesEnvironment{
"local_name": "@noble/curves",
"alias": false,
"peer_metadata": null
} | 1.9.0 | runtime |
@noble/hashesEnvironment{
"local_name": "@noble/hashes",
"alias": false,
"peer_metadata": null
} | 1.8.0 | runtime |
@noble/ciphersEnvironment{
"local_name": "@noble/ciphers",
"alias": false,
"peer_metadata": null
} | 1.3.0 | runtime |
@peculiar/x509Environment{
"local_name": "@peculiar/x509",
"alias": false,
"peer_metadata": null
} | 1.12.3 | runtime |
@0xkey-io/encodingEnvironment{
"local_name": "@0xkey-io/encoding",
"alias": false,
"peer_metadata": null
} | 0.1.1 | runtime |
@0xkey-io/sdk-typesEnvironment{
"local_name": "@0xkey-io/sdk-types",
"alias": false,
"peer_metadata": null
} | 0.1.0 | runtime |
jestEnvironment{
"local_name": "jest",
"alias": false,
"peer_metadata": null
} | 29.7.0 | development |
@types/jestEnvironment{
"local_name": "@types/jest",
"alias": false,
"peer_metadata": null
} | ^29.5.3 | development |
@types/cbor-jsEnvironment{
"local_name": "@types/cbor-js",
"alias": false,
"peer_metadata": null
} | ^0.1.1 | development |
@0xkey-io/internal-crypto-coreEnvironment{
"local_name": "@0xkey-io/internal-crypto-core",
"alias": false,
"peer_metadata": null
} | 0.1.0 | development |
Source distribution
{
"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
}Observed since 21 Oct, 09:00 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:bb0135310c2785b0bbef993c625fde9fe796ce596c0e5da435011e5f82e4a841