From 88c99ab9eeae72c870bc727fbe3aea55c8c08bb3 Mon Sep 17 00:00:00 2001 From: Dan Dascalescu Date: Wed, 31 May 2017 21:11:19 -0700 Subject: [PATCH] Add ES6 import example --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 1f4b0ef..d947b1d 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,18 @@ npm install crypto-js ### Usage +ES6 import for typical API call signing use case: + +```javascript +import sha256 from 'crypto-js/sha256'; +import hmacSHA512 from 'crypto-js/hmac-sha512'; +import Base64 from 'crypto-js/enc-base64'; + +const message, nonce, path, privateKey; // ... +const hashDigest = sha256(nonce + message); +const hmacDigest = Base64.stringify(hmacSHA512(path + hashDigest, privateKey)); +``` + Modular include: ```javascript