Socket
Socket
Sign inDemoInstall

expo-crypto

Package Overview
Dependencies
Maintainers
25
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-crypto

Expo universal module for crypto


Version published
Weekly downloads
190K
increased by0.58%
Maintainers
25
Weekly downloads
 
Created

What is expo-crypto?

The expo-crypto package provides cryptographic utilities for Expo and React Native applications. It allows developers to perform various cryptographic operations such as hashing, HMAC, and generating random bytes.

What are expo-crypto's main functionalities?

Hashing

This feature allows you to generate a hash of a given string using various algorithms like SHA-256. The code sample demonstrates how to generate a SHA-256 hash of the string 'Hello, world!'.

const Crypto = require('expo-crypto');

async function generateHash() {
  const digest = await Crypto.digestStringAsync(
    Crypto.CryptoDigestAlgorithm.SHA256,
    'Hello, world!'
  );
  console.log(digest);
}
generateHash();

HMAC

This feature allows you to generate an HMAC (Hash-based Message Authentication Code) using a specified algorithm and key. The code sample demonstrates how to generate an HMAC using SHA-256 and a secret key.

const Crypto = require('expo-crypto');

async function generateHMAC() {
  const hmac = await Crypto.hmacStringAsync(
    Crypto.CryptoDigestAlgorithm.SHA256,
    'Hello, world!',
    'secret-key'
  );
  console.log(hmac);
}
generateHMAC();

Random Bytes

This feature allows you to generate a specified number of random bytes. The code sample demonstrates how to generate 16 random bytes.

const Crypto = require('expo-crypto');

async function generateRandomBytes() {
  const randomBytes = await Crypto.getRandomBytesAsync(16);
  console.log(randomBytes);
}
generateRandomBytes();

Other packages similar to expo-crypto

Keywords

FAQs

Package last updated on 02 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc