diff --git a/packages/cw/cw_cryptojs_library/CHANGELOG.md b/packages/cw/cw_cryptojs_library/CHANGELOG.md new file mode 100644 index 00000000..92c81d18 --- /dev/null +++ b/packages/cw/cw_cryptojs_library/CHANGELOG.md @@ -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算法 + diff --git a/packages/cw/cw_cryptojs_library/logics/base64Withsjcl/api.yaml b/packages/cw/cw_cryptojs_library/logics/base64Withsjcl/api.yaml new file mode 100644 index 00000000..3eb784a3 --- /dev/null +++ b/packages/cw/cw_cryptojs_library/logics/base64Withsjcl/api.yaml @@ -0,0 +1,5 @@ +- name: base64Withsjcl + description: 使用sjcl库完成utf8的base64 + type: both + belong: logic + labels: [Runtime] diff --git a/packages/cw/cw_cryptojs_library/logics/base64Withsjcl/index.js b/packages/cw/cw_cryptojs_library/logics/base64Withsjcl/index.js new file mode 100644 index 00000000..c65491ed --- /dev/null +++ b/packages/cw/cw_cryptojs_library/logics/base64Withsjcl/index.js @@ -0,0 +1,10 @@ +import sjcl from 'sjcl'; + +// doc: https://github.com/bitwiseshiftleft/sjcl +/** + * @param {string} string 原始字符串 + * @returns {string} 加密后结果 + */ +export default (string) => { + return sjcl.codec.base64url.fromBits(sjcl.codec.utf8String.toBits(string)); +}; diff --git a/packages/cw/cw_cryptojs_library/logics/index.js b/packages/cw/cw_cryptojs_library/logics/index.js index 593770bd..7d855bf1 100644 --- a/packages/cw/cw_cryptojs_library/logics/index.js +++ b/packages/cw/cw_cryptojs_library/logics/index.js @@ -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 || {} @@ -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 } diff --git a/packages/cw/cw_cryptojs_library/manifest b/packages/cw/cw_cryptojs_library/manifest index 673541da..0e976119 100644 --- a/packages/cw/cw_cryptojs_library/manifest +++ b/packages/cw/cw_cryptojs_library/manifest @@ -1,6 +1,6 @@ Plugin-Version: 1.0.0 Library-Type: Frontend Metadata-File: usage.json -packages/extension/cw_cryptojs_library@1.0.1/dist-theme/demo.html: dist-theme/demo.html -packages/extension/cw_cryptojs_library@1.0.1/dist-theme/index.js: dist-theme/index.js -packages/extension/cw_cryptojs_library@1.0.1/dist-theme/index.js.map: dist-theme/index.js.map \ No newline at end of file +packages/extension/cw_cryptojs_library@1.0.2/dist-theme/demo.html: dist-theme/demo.html +packages/extension/cw_cryptojs_library@1.0.2/dist-theme/index.js: dist-theme/index.js +packages/extension/cw_cryptojs_library@1.0.2/dist-theme/index.js.map: dist-theme/index.js.map \ No newline at end of file diff --git a/packages/cw/cw_cryptojs_library/package.json b/packages/cw/cw_cryptojs_library/package.json index 648273f7..345abcd1 100644 --- a/packages/cw/cw_cryptojs_library/package.json +++ b/packages/cw/cw_cryptojs_library/package.json @@ -2,7 +2,7 @@ "name": "cw_cryptojs_library", "title": "前端加密依赖库", "description": "", - "version": "1.0.1", + "version": "1.0.2", "main": "./index.js", "author": "", "repository": "", @@ -49,6 +49,7 @@ "inited": true }, "dependencies": { - "crypto-js": "^4.2.0" + "crypto-js": "^4.2.0", + "sjcl": "^1.0.8" } -} +} \ No newline at end of file