Socket
Socket
Sign inDemoInstall

@orion-js/crypto

Package Overview
Dependencies
7
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @orion-js/crypto

This project provides utility functions for symmetric and asymmetric encryption, decryption, signing, and hashing. It uses the crypto and bcryptjs libraries for cryptographic operations.


Version published
Weekly downloads
242
increased by14.69%
Maintainers
3
Created
Weekly downloads
 

Readme

Source

Orionjs Crypto

This project provides utility functions for symmetric and asymmetric encryption, decryption, signing, and hashing. It uses the crypto and bcryptjs libraries for cryptographic operations.

Symmetric Encryption

The symmetric encryption module provides functions for generating passwords and for encrypting and decrypting text. This can be used for securely storing sensitive data like user passwords.

import {symmetric} from './src/utils/symmetric'

const password = symmetric.generatePassword()
const encrypted = symmetric.encrypt('hello world', password)
const decrypted = symmetric.decrypt(encrypted, password)

Asymmetric Encryption

The asymmetric encryption module provides functions for generating key pairs, and for encrypting and decrypting messages. This can be used for secure communication between two parties.

import {asymmetric} from './src/utils/asymmetric'

const {encryptKey, decryptKey} = asymmetric.generateKeys()
const encrypted = asymmetric.encrypt(encryptKey, 'hello')
const decrypted = asymmetric.decrypt(decryptKey, encrypted)

Signing

The signing module provides functions for signing a payload and for verifying a signed payload. This can be used to ensure the integrity and authenticity of data.

import {sign} from './src/utils/sign'

const secret = 'my_secret'
const payload = 'hello world'
const checksum = sign.sign(payload, secret)
const isValid = sign.verify(payload, checksum, secret)

Hashing

The hashing module provides functions for creating a hash from a text and for comparing a text with a hash. This can be used for storing sensitive data like passwords in a secure way.

import {hash} from './src/utils/hash'

const text = 'hello world'
const hashed = hash.hash(text)
const isSame = hash.compare(text, hashed)

Hashing with Salt

The hashing with salt module provides functions for creating a hash from a password with a salt and for comparing a password with a hash. This can be used for storing user passwords in a secure way.

import {hashWithSalt} from './src/utils/hashWithSalt'

const password = 'password'
const hashed = hashWithSalt.hash(password)
const isSame = hashWithSalt.compare(password, hashed)

FAQs

Last updated on 11 Apr 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc