Skip to content

Commit 73c20dd

Browse files
authored
Merge pull request brix#96 from dandv/patch-1
Add ES6 import example
2 parents 4338ce0 + 88c99ab commit 73c20dd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ npm install crypto-js
1515

1616
### Usage
1717

18+
ES6 import for typical API call signing use case:
19+
20+
```javascript
21+
import sha256 from 'crypto-js/sha256';
22+
import hmacSHA512 from 'crypto-js/hmac-sha512';
23+
import Base64 from 'crypto-js/enc-base64';
24+
25+
const message, nonce, path, privateKey; // ...
26+
const hashDigest = sha256(nonce + message);
27+
const hmacDigest = Base64.stringify(hmacSHA512(path + hashDigest, privateKey));
28+
```
29+
1830
Modular include:
1931

2032
```javascript

0 commit comments

Comments
 (0)