Skip to content

Commit

Permalink
Fix/sjcl variable (#8099)
Browse files Browse the repository at this point in the history
* refactor: use files to add prefix

* fix: always use $tw.sjcl

* refactor: move sjcl to lib/sjcl

* fix: require sjcl in lib/

* refactor: move sjcl.js back into /boot
  • Loading branch information
linonetwo authored May 26, 2024
1 parent e3f9be9 commit a463783
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
3 changes: 0 additions & 3 deletions boot/sjcl.js.meta

This file was deleted.

35 changes: 35 additions & 0 deletions boot/tiddlywiki.files
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"tiddlers": [
{
"file": "sjcl.js",
"fields": {
"title": "$:/library/sjcl.js",
"type": "application/javascript",
"library": "yes"
},
"prefix": "(function(define) {\n",
"suffix": "\n})(function (_,defined){window.sjcl = defined()})\n"
},
{
"file": "boot.js",
"fields": {
"title": "$:/boot/boot.js",
"type": "application/javascript"
}
},
{
"file": "bootprefix.js",
"fields": {
"title": "$:/boot/bootprefix.js",
"type": "application/javascript"
}
},
{
"file": "boot.css.tid",
"fields": {
"title": "$:/boot/boot.css",
"type": "text/css"
}
}
]
}
2 changes: 1 addition & 1 deletion core/modules/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ options.length .. number of characters returned defaults to 64
*/
exports.sha256 = function(str, options) {
options = options || {}
return sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(str)).substr(0,options.length || 64);
return $tw.sjcl.codec.hex.fromBits($tw.sjcl.hash.sha256.hash(str)).substr(0,options.length || 64);
}

/*
Expand Down

0 comments on commit a463783

Please sign in to comment.