@@ -16,17 +16,17 @@ Requirements:
1616- npm (Node.js package manager)
1717
1818``` bash
19- npm install crypto-js
19+ npm install @leo-util/ crypto-js
2020```
2121
2222### Usage
2323
2424ES6 import for typical API call signing use case:
2525
26- ``` javascript
27- import sha256 from ' crypto-js/sha256' ;
28- import hmacSHA512 from ' crypto-js/hmac-sha512' ;
29- import Base64 from ' crypto-js/enc-base64' ;
26+ ``` typescript
27+ import sha256 from ' @leo-util/ crypto-js/sha256' ;
28+ import hmacSHA512 from ' @leo-util/ crypto-js/hmac-sha512' ;
29+ import Base64 from ' @leo-util/ crypto-js/enc-base64' ;
3030
3131const message, nonce, path, privateKey; // ...
3232const hashDigest = sha256 (nonce + message );
@@ -35,17 +35,17 @@ const hmacDigest = Base64.stringify(hmacSHA512(path + hashDigest, privateKey));
3535
3636Modular include:
3737
38- ``` javascript
39- var AES = require (" crypto-js/aes" );
40- var SHA256 = require (" crypto-js/sha256" );
38+ ``` typescript
39+ var AES = require (" @leo-util/ crypto-js/aes" );
40+ var SHA256 = require (" @leo-util/ crypto-js/sha256" );
4141...
4242console .log (SHA256 (" Message" ));
4343```
4444
4545Including all libraries, for access to extra methods:
4646
47- ``` javascript
48- var CryptoJS = require (" crypto-js" );
47+ ``` typescript
48+ const CryptoJS = require (" @leo-util/ crypto-js" );
4949console .log (CryptoJS .HmacSHA1 (" Message" , " Key" ));
5050```
5151
@@ -57,7 +57,7 @@ Requirements:
5757- Bower (package manager for frontend)
5858
5959``` bash
60- bower install crypto-js
60+ bower install @leo-util/ crypto-js
6161```
6262
6363### Usage
@@ -114,106 +114,106 @@ See: https://cryptojs.gitbook.io/docs/
114114#### Plain text encryption
115115
116116``` javascript
117- var CryptoJS = require (" crypto-js" );
117+ const CryptoJS = require (" @leo-util/ crypto-js" );
118118
119119// Encrypt
120- var ciphertext = CryptoJS .AES .encrypt (' my message' , ' secret key 123' ).toString ();
120+ const ciphertext = CryptoJS .AES .encrypt (' my message' , ' secret key 123' ).toString ();
121121
122122// Decrypt
123- var bytes = CryptoJS .AES .decrypt (ciphertext, ' secret key 123' );
124- var originalText = bytes .toString (CryptoJS .enc .Utf8 );
123+ const bytes = CryptoJS .AES .decrypt (ciphertext, ' secret key 123' );
124+ const originalText = bytes .toString (CryptoJS .enc .Utf8 );
125125
126126console .log (originalText); // 'my message'
127127```
128128
129129#### Object encryption
130130
131131``` javascript
132- var CryptoJS = require (" crypto-js" );
132+ const CryptoJS = require (" @leo-util/ crypto-js" );
133133
134- var data = [{id: 1 }, {id: 2 }]
134+ const data = [{id: 1 }, {id: 2 }]
135135
136136// Encrypt
137- var ciphertext = CryptoJS .AES .encrypt (JSON .stringify (data), ' secret key 123' ).toString ();
137+ const ciphertext = CryptoJS .AES .encrypt (JSON .stringify (data), ' secret key 123' ).toString ();
138138
139139// Decrypt
140- var bytes = CryptoJS .AES .decrypt (ciphertext, ' secret key 123' );
141- var decryptedData = JSON .parse (bytes .toString (CryptoJS .enc .Utf8 ));
140+ const bytes = CryptoJS .AES .decrypt (ciphertext, ' secret key 123' );
141+ const decryptedData = JSON .parse (bytes .toString (CryptoJS .enc .Utf8 ));
142142
143143console .log (decryptedData); // [{id: 1}, {id: 2}]
144144```
145145
146146### List of modules
147147
148148
149- - ``` crypto-js/core ```
150- - ``` crypto-js/x64-core ```
151- - ``` crypto-js/lib-typedarrays ```
149+ - ``` @leo-util/ crypto-js/core```
150+ - ``` @leo-util/ crypto-js/x64-core```
151+ - ``` @leo-util/ crypto-js/lib-typedarrays```
152152
153153---
154154
155- - ``` crypto-js/md5 ```
156- - ``` crypto-js/sha1 ```
157- - ``` crypto-js/sha256 ```
158- - ``` crypto-js/sha224 ```
159- - ``` crypto-js/sha512 ```
160- - ``` crypto-js/sha384 ```
161- - ``` crypto-js/sha3 ```
162- - ``` crypto-js/ripemd160 ```
155+ - ``` @leo-util/ crypto-js/md5```
156+ - ``` @leo-util/ crypto-js/sha1```
157+ - ``` @leo-util/ crypto-js/sha256```
158+ - ``` @leo-util/ crypto-js/sha224```
159+ - ``` @leo-util/ crypto-js/sha512```
160+ - ``` @leo-util/ crypto-js/sha384```
161+ - ``` @leo-util/ crypto-js/sha3```
162+ - ``` @leo-util/ crypto-js/ripemd160```
163163
164164---
165165
166- - ``` crypto-js/hmac-md5 ```
167- - ``` crypto-js/hmac-sha1 ```
168- - ``` crypto-js/hmac-sha256 ```
169- - ``` crypto-js/hmac-sha224 ```
170- - ``` crypto-js/hmac-sha512 ```
171- - ``` crypto-js/hmac-sha384 ```
172- - ``` crypto-js/hmac-sha3 ```
173- - ``` crypto-js/hmac-ripemd160 ```
166+ - ``` @leo-util/ crypto-js/hmac-md5```
167+ - ``` @leo-util/ crypto-js/hmac-sha1```
168+ - ``` @leo-util/ crypto-js/hmac-sha256```
169+ - ``` @leo-util/ crypto-js/hmac-sha224```
170+ - ``` @leo-util/ crypto-js/hmac-sha512```
171+ - ``` @leo-util/ crypto-js/hmac-sha384```
172+ - ``` @leo-util/ crypto-js/hmac-sha3```
173+ - ``` @leo-util/ crypto-js/hmac-ripemd160```
174174
175175---
176176
177- - ``` crypto-js/pbkdf2 ```
177+ - ``` @leo-util/ crypto-js/pbkdf2```
178178
179179---
180180
181- - ``` crypto-js/aes ```
182- - ``` crypto-js/tripledes ```
183- - ``` crypto-js/rc4 ```
184- - ``` crypto-js/rabbit ```
185- - ``` crypto-js/rabbit-legacy ```
186- - ``` crypto-js/evpkdf ```
181+ - ``` @leo-util/ crypto-js/aes```
182+ - ``` @leo-util/ crypto-js/tripledes```
183+ - ``` @leo-util/ crypto-js/rc4```
184+ - ``` @leo-util/ crypto-js/rabbit```
185+ - ``` @leo-util/ crypto-js/rabbit-legacy```
186+ - ``` @leo-util/ crypto-js/evpkdf```
187187
188188---
189189
190- - ``` crypto-js/format-openssl ```
191- - ``` crypto-js/format-hex ```
190+ - ``` @leo-util/ crypto-js/format-openssl```
191+ - ``` @leo-util/ crypto-js/format-hex```
192192
193193---
194194
195- - ``` crypto-js/enc-latin1 ```
196- - ``` crypto-js/enc-utf8 ```
197- - ``` crypto-js/enc-hex ```
198- - ``` crypto-js/enc-utf16 ```
199- - ``` crypto-js/enc-base64 ```
195+ - ``` @leo-util/ crypto-js/enc-latin1```
196+ - ``` @leo-util/ crypto-js/enc-utf8```
197+ - ``` @leo-util/ crypto-js/enc-hex```
198+ - ``` @leo-util/ crypto-js/enc-utf16```
199+ - ``` @leo-util/ crypto-js/enc-base64```
200200
201201---
202202
203- - ``` crypto-js/mode-cfb ```
204- - ``` crypto-js/mode-ctr ```
205- - ``` crypto-js/mode-ctr-gladman ```
206- - ``` crypto-js/mode-ofb ```
207- - ``` crypto-js/mode-ecb ```
203+ - ``` @leo-util/ crypto-js/mode-cfb```
204+ - ``` @leo-util/ crypto-js/mode-ctr```
205+ - ``` @leo-util/ crypto-js/mode-ctr-gladman```
206+ - ``` @leo-util/ crypto-js/mode-ofb```
207+ - ``` @leo-util/ crypto-js/mode-ecb```
208208
209209---
210210
211- - ``` crypto-js/pad-pkcs7 ```
212- - ``` crypto-js/pad-ansix923 ```
213- - ``` crypto-js/pad-iso10126 ```
214- - ``` crypto-js/pad-iso97971 ```
215- - ``` crypto-js/pad-zeropadding ```
216- - ``` crypto-js/pad-nopadding ```
211+ - ``` @leo-util/ crypto-js/pad-pkcs7```
212+ - ``` @leo-util/ crypto-js/pad-ansix923```
213+ - ``` @leo-util/ crypto-js/pad-iso10126```
214+ - ``` @leo-util/ crypto-js/pad-iso97971```
215+ - ``` @leo-util/ crypto-js/pad-zeropadding```
216+ - ``` @leo-util/ crypto-js/pad-nopadding```
217217
218218
219219## Release notes
0 commit comments