0.0.1 • Published 3 years ago

axios-encrypt v0.0.1

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

Axios plugin for encrypting your requests.

npm

At the moment library encrypts only body of requests.

Install

yarn add axios-encrypt

or

npm i -S axios-encrypt

Usage

Connect example:

import axios from 'axios'
import { applyEncryptToAxios } from 'axios-encrypt'
import CryptoJS from 'crypto-js'

const apiClient = axios.create({})


applyEncryptToAxios(apiClient, {
  onEncrypt(str: string): string {
    let encrypted = CryptoJS.AES.encrypt(str, 'secret')
    return encrypted.toString()
  },
})

Works with: