Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@oslojs/crypto

oslo-project472kMIT1.0.1TypeScript support: included

A very basic crypto library

auth, crypto, encoding, auth, random, hash, sha, hmac, ecdsa, rsa, sha1, sha2, sha3

readme

@oslojs/crypto documentation

Documentation: https://crypto.oslojs.dev

A basic JavaScript crypto library by Oslo. Includes APIs for SHA-1, SHA-2, SHA-3, HMAC, ECDSA, RSA, and cryptographically secure random generator.

  • Runtime-agnostic
  • No third-party dependencies
  • Fully typed

Algorithms such as SHA and ECDSA are tested against NIST test vectors.

Installation

npm i @oslojs/crypto

changelog

@oslojs/crypto

1.0.1

  • Fix ECDSAPublicKey.encodePKIXCompressed() creating uncompressed keys.

1.0.0

  • No changes.

0.6.2

  • Update dependencies.

0.6.1

  • Update dependencies.

0.6.0

  • [Breaking] Update generateRandomInteger(), generateRandomIntegerNumber(), and generateRandomString() parameters.
  • [Breaking] Remove alphabet() and random() from random module.

0.5.3

  • Add SHA-3 hash and extended hash functions.

0.5.2

  • Fix ECDSASignature.encodeIEEEP1363()

0.5.1

  • Add SHA-512/224 and SHA-512/256

0.5.0

  • [Breaking] Rename decodeX509ECDSAPublicKey(), decodeX509ECDSASignature(), ECDSAPublicKey.encodeX509Compressed(), ECDSAPublicKey.encodeX509Uncompressed(), and ECDSASignature.encodeX509() to decodePKIXECDSAPublicKey(), decodePKIXECDSASignature(), ECDSAPublicKey.encodePKIXCompressed(), ECDSAPublicKey.encodePKIXUncompressed(), and ECDSASignature.encodePKIX()
  • Add @oslojs/crypto/rsa

0.4.1

  • Update dependencies.

0.4.0

  • [Breaking] Replace verifyECDSA() with verifyECDSASignature().
  • [Breaking] Replace ECDSACurve with ECDSANamedCurve.
  • Add all SEC 2 curves.
  • Add decodeX509ECDSASignature(), decodeX509PublicKey(), ECDSASignature.encodeX509(), ECDSAPublicKey.encodeX509Uncompressed(), and ECDSAPublicKey.encodeX509Compressed()

0.3.0

  • [Breaking] generateRandomInteger() takes and returns a bigint.
  • Add generateRandomIntegerNumber().

0.2.1

  • Add @oslojs/crypto/ecdsa.
  • Export sha224() and SHA224.