Socket
Socket
Sign inDemoInstall

aes-ts

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    aes-ts

0 dependency, pure TypesScript implementation of the AES block cipher and common modes of operation.


Version published
Weekly downloads
427
decreased by-8.57%
Maintainers
1
Install size
617 kB
Created
Weekly downloads
 

Readme

Source

AES-TS

test status npm version zero dependencies MIT License

a modern port of AES-JS:

A pure JavaScript implementation of the AES block cipher algorithm and all common modes of operation (CBC, CFB, CTR, ECB and OFB).

for proper documentation please check their README.md.

motivation

  • enable three shaking
    • it's rare that an app will use all this modes
    • not every app needs encryption + decryption
    • only half of the constants are needed on each direction
  • a good replacement for libraries that import crypto-browserify on the browser.
  • built-in typescript types

best practices

  • don't roll your own crypto, especially don't touch Block directly.
  • don't use ECB. don't reuse IVs.
  • don't use this library, use SubtleCrypto, whenever possible.

exports

ESM exports, listed by Common Mode Of Operation.

*EncryptorDecryptor
BlockEncryptorDecryptor
CBCCBCEncryptorCBCDecryptor
CFBCFBEncryptorCFBDecryptor
CTRCTREncryptorCTRDecryptor
ECBECBEncryptorECBDecryptor
OFBOFBEncryptorOFBDecryptor

interfaces

replace ___ for the mode of operation.

each mode has unique parameters, described by their types.

Encryptor
const encryptor = new ___Encryptor(key)
const ciphertext = encryptor.encrypt(plaintext)
Decryptor
const decryptor = new ___Decryptor(key)
const plaintext = decryptor.decrypt(ciphertext)
Encryptor + Decryptor
const mode = new ___(key)
const sametext = mode.decrypt(mode.encrypt(plaintext))

license and acknowledgments

MIT

all crypto code and tests were taken directly from AES-JS, written by @ricmoo.

Keywords

FAQs

Last updated on 10 Oct 2020

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