encrypt-kit
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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

Package Sidebar

Install

npm i encrypt-kit

Weekly Downloads

58

Version

1.0.1

License

none

Unpacked Size

5.28 kB

Total Files

7

Last publish

Collaborators

  • ahrimansource