1.0.0 • Published 4 years ago

@jacobbubu/pull-bitflipper v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

@jacobbubu/pull-bitflipper

Build Status Coverage Status npm

Rewritten pull-bitflipper in TypeScript.

pull-bitflipper

pull stream that randomly flips bits in input stream, useful for testing authenticated cryptography.

Example

import bitFlipper from '@jacobbubu/pull-bitflipper'

pull(
  // Create a source that calls a callback when it gets aborted.
  source(function onAbort(err) {
    // This should be called when the output fails because a bit was filpped.
  }),

  createEncryptStream(),

  // Pass in the probability that a particular message should
  // Contain a flipped bit.
  bitFlipper(prop = 0.1),

  createDecryptStream(),

  sink(function (err) {
    // The sink should error when the decryption stream
    // finds a packet that does not authenticate.
  })
)