-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: replace crypto-es with crypto-js
- Loading branch information
Showing
13 changed files
with
108 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
- 登录界面动画优化 | ||
- 修复 github 仓库体积过大问题. | ||
- 默认隐藏表格全屏按钮 | ||
- `crypto-es`改为`crypto-js`,减小打包体积 | ||
|
||
### 🐛 Bug Fixes | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { lib } from 'crypto-js'; | ||
|
||
import { encrypt, decrypt } from 'crypto-js/aes'; | ||
import Uft8, { parse } from 'crypto-js/enc-utf8'; | ||
import pkcs7 from 'crypto-js/pad-pkcs7'; | ||
|
||
export interface EncryptionParams { | ||
key: string; | ||
iv: string; | ||
} | ||
|
||
export class Encryption { | ||
private key: lib.WordArray; | ||
private iv: lib.WordArray; | ||
|
||
constructor(opt: EncryptionParams) { | ||
const { key, iv } = opt; | ||
this.key = parse(key); | ||
this.iv = parse(iv); | ||
} | ||
|
||
get getOptions() { | ||
return { | ||
// mode: mode.CBC, | ||
padding: pkcs7, | ||
iv: this.iv, | ||
}; | ||
} | ||
|
||
encryptByAES(str: string) { | ||
return encrypt(str, this.key, this.getOptions).toString(); | ||
} | ||
|
||
decryptByAES(str: string) { | ||
return decrypt(str, this.key, this.getOptions).toString(Uft8); | ||
} | ||
} | ||
export default Encryption; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,6 @@ | ||
<template> | ||
<div class="test"> 位于主框架外的页面 </div> | ||
<div class="fixed h-full w-full flex flex-col justify-center items-center text-4xl"> | ||
<div class=""> 位于主框架外的页面 </div> | ||
<a-button @click="$router.go(-1)" class="mt-10" type="primary">Back</a-button> | ||
</div> | ||
</template> | ||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
export default defineComponent({}); | ||
</script> | ||
|
||
<style scoped> | ||
.test { | ||
position: fixed; | ||
display: flex; | ||
width: 100%; | ||
height: 100%; | ||
justify-content: center; | ||
align-items: center; | ||
font-size: 50px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters