Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 新增sjcl库版本的base64算法 #63

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/cw/cw_cryptojs_library/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## 1.0.2

Associated Task: [#281727](https://projectmanage.netease-official.lcap.163yun.com/dashboard/TaskDetail?id=2817277092559616)

### ✨Features

- [bbaa239](https://github.com/vusion/cloud-ui-materials/commit/bbaa23939f08ec7397ff463caf9736cf63c3a291) Thanks [ncqwer](https://github.com/ncqwer) ! - 新增sjcl库版本的base64算法

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- name: base64Withsjcl
description: 使用sjcl库完成utf8的base64
type: both
belong: logic
labels: [Runtime]
10 changes: 10 additions & 0 deletions packages/cw/cw_cryptojs_library/logics/base64Withsjcl/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import sjcl from 'sjcl';

// doc: https://github.com/bitwiseshiftleft/sjcl
/**
* @param {string} string <true> 原始字符串
* @returns {string} 加密后结果
*/
export default (string) => {
return sjcl.codec.base64url.fromBits(sjcl.codec.utf8String.toBits(string));
};
2 changes: 2 additions & 0 deletions packages/cw/cw_cryptojs_library/logics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import encryptByDes from './encryptByDes'
import encryptSha256 from './encryptSha256'
import encryptDataWithSalt from './encryptDataWithSalt'
import decryptDataWithSalt from './decryptDataWithSalt'
import base64Withsjcl from './base64Withsjcl'
// LOGIC IMPORTS
UtilsLogics.install = function (Vue, option = {}) {
Vue.prototype.$library = Vue.prototype.$library || {}
Expand All @@ -13,6 +14,7 @@ UtilsLogics.install = function (Vue, option = {}) {
Vue.prototype.$library[`${$libraryName}`].encryptSha256=encryptSha256
Vue.prototype.$library[`${$libraryName}`].encryptDataWithSalt=encryptDataWithSalt
Vue.prototype.$library[`${$libraryName}`].decryptDataWithSalt=decryptDataWithSalt
Vue.prototype.$library[`${$libraryName}`].base64Withsjcl=base64Withsjcl
// LOGIC USE
window.__$libraryEncryptSha256 = encryptSha256
}
Expand Down
6 changes: 3 additions & 3 deletions packages/cw/cw_cryptojs_library/manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Plugin-Version: 1.0.0
Library-Type: Frontend
Metadata-File: usage.json
packages/extension/[email protected].1/dist-theme/demo.html: dist-theme/demo.html
packages/extension/[email protected].1/dist-theme/index.js: dist-theme/index.js
packages/extension/[email protected].1/dist-theme/index.js.map: dist-theme/index.js.map
packages/extension/[email protected].2/dist-theme/demo.html: dist-theme/demo.html
packages/extension/[email protected].2/dist-theme/index.js: dist-theme/index.js
packages/extension/[email protected].2/dist-theme/index.js.map: dist-theme/index.js.map
7 changes: 4 additions & 3 deletions packages/cw/cw_cryptojs_library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "cw_cryptojs_library",
"title": "前端加密依赖库",
"description": "",
"version": "1.0.1",
"version": "1.0.2",
"main": "./index.js",
"author": "",
"repository": "",
Expand Down Expand Up @@ -49,6 +49,7 @@
"inited": true
},
"dependencies": {
"crypto-js": "^4.2.0"
"crypto-js": "^4.2.0",
"sjcl": "^1.0.8"
}
}
}
Loading