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

@exodus/crypto

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@exodus/crypto

Reusable cryptography primitives, for browser/Node.js/Electron/React Native

  • 1.0.0-rc.18
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4K
decreased by-21.37%
Maintainers
0
Weekly downloads
 
Created
Source

@exodus/crypto

Reusable cryptography primitives, for browser/Node.js/Electron/React Native

For hashes not implemented by the platform, requires @noble/hashes dependency

A note about React Native

  • On React Native, methods that use randomness expect globalThis.crypto.getRandomValues to work. That can be polyfilled with require('react-native-get-random-values').

  • Buffer should be polyfilled (either globally or via a bundler).

Regular API

randomBytes(size)

import { randomBytes } from '@exodus/crypto/randomBytes'

Returns a Buffer instance of length size filled from CSPRNG.

On non-Node.js environments, requires polyfilled Buffer.

randomUUID()

import { randomUUID } from '@exodus/crypto/randomUUID'

Returns a random UUID (version 4, variant 1), filled from CSPRNG.

This contains 122 bits of randomness.

Compatible with Crypto.randomUUID().

await hash(type, arg[, form])

import { hash } from '@exodus/crypto/hash'

Hashes arg using the hash specified as type.

Returns the result as encoded as form (e.g. 'hex') or as a Buffer instance if form is not specified.

E.g.:

> await hash('sha256', 'abc', 'hex')
'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'
> await hash('sha256', Buffer.from('abc'), 'hex')
'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'
> await hash('sha256', new Uint8Array([97, 98, 99]), 'hex')
'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'
await hash('sha256', Buffer.from('abc'))
Buffer(32) [186, 120, 22, 191, 143, 1, 207, 234, 65, 65, 64, 222, 93, 174, 34, 35, 176, 3, 97, 163, 150, 23, 122, 156, 180, 16, 255, 97, 242, 0, 21, 173]

await hmac(type, secret, arg[, form])

import { hmac } from '@exodus/crypto/hmac'

HMAC implementation, usage similar to hash().

Empty secret values are not supported.

FAQs

Package last updated on 27 Oct 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