0.46.0 • Published 10 months ago

@lidofinance/satanizer v0.46.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@lidofinance/satanizer

Zero dependencies tool, which masks secrets 🕵️

Installation

yarn add @lidofinance/satanizer

Usage

There are two types of usage, you can provide secrets first and then appy mask function.

import { satanizer } from '@lidofinance/satanizer';

const mask = satanizer([/0x[a-zA-Z0-9]+/])
const target = 'qwe 0xABC1 asd'
const result = 'qwe ****** asd'

expect(mask(target)).toBe(result)

Alternatively you can execute satanizer right away.

import { satanizer } from '@lidofinance/satanizer';

const target = 'qwe secret asd'
const result = 'qwe ****** asd'

expect(satanizer(['secret'], target)).toBe(result)

Pattern can be string or regular expression.

import { satanizer } from '@lidofinance/satanizer';

assert(satanizer(['secret', /0x[s]ecret/], 'qwe secret 0xsecret asd') === 'qwe ****** ******** asd')

Target can be a anything - string, object, array or Error.

import { satanizer } from '@lidofinance/satanizer';

const mask = satanizer(['secret'])

const target = { message: `there are secret` }
const result = { message: `there are ******` }
expect(mask(target)).toMatchObject(result)

const target = ['some secret item', 'some item']
const result = ['some ****** item', 'some item']
expect(mask(target)).toMatchObject(result)

const target = new Error(`there are secret`)
const result = { message: `there are ******` }
expect(mask(target)).toMatchObject(result)

Configuration

You can specify as well as your own secrets, as well as use some pre-build secrets patterns:

  • blockchainAddress (ETH and others).
  • ensAddress.
  • ipAddress.
  • macAddress.

You can use them one by one or all together.

import { commonPatterns } from '@lidofinance/satanizer'

const secrets = [/* your secrets */]
const mask = satanizer([...commonPatterns, ...secrets])
0.46.0

10 months ago

0.45.1

10 months ago

0.44.0

11 months ago

0.45.0

11 months ago

0.43.0

1 year ago

0.42.0

1 year ago

0.41.0

1 year ago

0.40.0

1 year ago

0.39.1

2 years ago

0.39.0

2 years ago

0.38.0

2 years ago

0.37.1

2 years ago

0.37.0

2 years ago

0.36.0

2 years ago

0.35.0

2 years ago

0.34.0

2 years ago

0.33.0

2 years ago

0.32.0

2 years ago

0.31.0

2 years ago

0.30.0

2 years ago

0.29.0

2 years ago

0.28.0

2 years ago

0.21.0

2 years ago

0.27.0

2 years ago

0.26.0

2 years ago

0.25.0

2 years ago

0.24.0

2 years ago

0.23.0

2 years ago

0.22.0

2 years ago

0.19.0

2 years ago

0.20.0

2 years ago

0.17.0

2 years ago

0.18.0

2 years ago

0.16.0

2 years ago