Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expo-crypto

Package Overview
Dependencies
Maintainers
28
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-crypto

Provides cryptography primitives for Android, iOS and web.

  • 14.0.0-canary-20240927-ab8a962
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
167K
decreased by-10.54%
Maintainers
28
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 27 Sep 2024

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