1.0.1 • Published 6 months ago

encrypt-kit v1.0.1

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

encrypt-kit 使用指南

npm

npm install encrypt-kit

1 JsSm4Client 国密4 加密,解密

封装了JsSm4,

配置参数描述 key : 秘钥

  • 加密方法
  • @param plaintext
  • encryptData( plaintext:string): string
  • 解密方法
  • @param ciphertext
  • decryptData(ciphertext:string): string
// 引入

import {JsSm4Client} from 'encrypt-kit'

let jsSm4Client = new JsSm4Client('youKey')

let a = "1232123"

console.log(jsSm4Client.decryptData(jsSm4Client.encryptData(a))); // 1232123

2 RsaClient rsa 加密,解密

封装了RsaClient,

配置参数描述 key : 秘钥

  • 加密方法
  • @param plaintext
  • encryptData( plaintext:string): string
  • 解密方法
  • @param ciphertext
  • decryptData(ciphertext:string): string
// 引入

import {RsaClient} from 'encrypt-kit'

const publickKey = 'youPublickKey'
const privateKey = 'youPrivateKey'

let rsaClient = new RsaClient(key)

let a = "1232123"

console.log(rsaClient.decryptData(rsaClient.encryptData(a))); // 1232123
1.0.1

6 months ago