Socket
Socket
Sign inDemoInstall

@toruslabs/openlogin-utils

Package Overview
Dependencies
Maintainers
4
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toruslabs/openlogin-utils

OpenLogin is a plug & play authentication suite that combines the simplicity of passwordless authentication with the security of non-custodial public key infrastructure (PKI).


Version published
Weekly downloads
116K
increased by5.96%
Maintainers
4
Weekly downloads
 
Created

What is @toruslabs/openlogin-utils?

@toruslabs/openlogin-utils is a utility package designed to assist with various functionalities related to OpenLogin, a passwordless authentication solution. It provides tools for encoding, decoding, and other cryptographic operations that are essential for secure authentication processes.

What are @toruslabs/openlogin-utils's main functionalities?

Base64 Encoding and Decoding

This feature allows you to encode and decode strings using base64url encoding, which is a URL-safe variant of base64 encoding.

const { base64url } = require('@toruslabs/openlogin-utils');

// Encoding a string to base64url
const encoded = base64url.encode('Hello, World!');
console.log(encoded); // Outputs: 'SGVsbG8sIFdvcmxkIQ'

// Decoding a base64url string
const decoded = base64url.decode(encoded);
console.log(decoded); // Outputs: 'Hello, World!'

Hex Encoding and Decoding

This feature allows you to convert strings to their hexadecimal representation and vice versa.

const { toHex, fromHex } = require('@toruslabs/openlogin-utils');

// Converting a string to hex
const hexString = toHex('Hello, World!');
console.log(hexString); // Outputs: '48656c6c6f2c20576f726c6421'

// Converting a hex string back to a regular string
const normalString = fromHex(hexString);
console.log(normalString); // Outputs: 'Hello, World!'

SHA-256 Hashing

This feature provides a way to hash strings using the SHA-256 algorithm, which is commonly used in cryptographic applications.

const { keccak256 } = require('@toruslabs/openlogin-utils');

// Hashing a string using SHA-256
const hash = keccak256('Hello, World!');
console.log(hash); // Outputs: '0x...'

Other packages similar to @toruslabs/openlogin-utils

FAQs

Package last updated on 07 Feb 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