提交 22e56e27 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 三级等保加密

上级 a79fe6fa
......@@ -35,6 +35,7 @@
"react-redux": "^8.1.3",
"react-router-dom": "^6.23.1",
"redux-persist": "^6.0.0",
"sm4js": "^0.0.6",
"snabbdom": "^3.6.2",
"xml-formatter": "^3.6.2",
"zustand": "^4.5.5"
......@@ -2463,8 +2464,7 @@
"type": "consulting",
"url": "https://feross.org/support"
}
],
"peer": true
]
},
"node_modules/before-after-hook": {
"version": "2.2.3",
......@@ -8312,6 +8312,15 @@
"slate": ">=0.65.3"
}
},
"node_modules/sm4js": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/sm4js/-/sm4js-0.0.6.tgz",
"integrity": "sha512-lKJWSaSksB4MbVpYXfb0cFRgTAjEAAZSxoMZ498BuGtwVQ5aB/23wJVxFLRIZQx9cyoVihK98FiOYH7VxIZyMg==",
"license": "MIT",
"dependencies": {
"base64-js": "^1.3.1"
}
},
"node_modules/snabbdom": {
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/snabbdom/-/snabbdom-3.6.2.tgz",
......
......@@ -38,6 +38,7 @@
"react-redux": "^8.1.3",
"react-router-dom": "^6.23.1",
"redux-persist": "^6.0.0",
"sm4js": "^0.0.6",
"snabbdom": "^3.6.2",
"xml-formatter": "^3.6.2",
"zustand": "^4.5.5"
......
......@@ -2,6 +2,14 @@ import axios from 'axios'
import md5 from 'js-md5'
import qs from 'qs'
import { Modal, notification } from 'antd'
import Sm4js from 'sm4js'
const sm4 = new Sm4js({
key: 'XDXDXU_ZIJING_01',
mode: 'cbc',
iv: 'IVIVIV_ZHIXUE_01',
cipherType: 'base64'
})
function getToken() {
return window.localStorage.getItem('kiwi.token') ? window.localStorage.getItem('kiwi.token') : ''
......@@ -23,6 +31,7 @@ function alphabeticalSort(a, b) {
}
const httpRequest = axios.create({
// baseURL: import.meta.env.VITE_API_BASE_API_PREFFIX,
// timeout: 60000,
withCredentials: true
})
......@@ -59,6 +68,11 @@ httpRequest.interceptors.request.use(
}
config.headers = { ...config.headers, ...defaultHeaders }
if (config.data && config.headers['Content-Type'] !== 'multipart/form-data' && import.meta.env.PROD) {
// console.log({ ...config.data, expire: timestamp + 60 })
config.data = { data: sm4.encrypt(JSON.stringify({ ...config.data, expire: timestamp + 60 })) }
}
return config
},
error => {
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论