[Pkg-javascript-commits] [node-keygrip] 47/68: Documentation reflects obligatory keylist

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Fri Jun 27 22:13:27 UTC 2014


This is an automated email from the git hooks/post-receive script.

andrewrk-guest pushed a commit to branch master
in repository node-keygrip.

commit 6f860effcc08ca0a2afa12fbf77f40fa32b4faad
Author: Vincens Mink <vincens at usepaddle.com>
Date:   Mon Jan 20 18:13:49 2014 +0000

    Documentation reflects obligatory keylist
    
    The documentation would still state that keylists are optional, but new versions of KeyGrip requires a keylist for initialisation.
---
 README.md | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/README.md b/README.md
index e142115..83ed075 100644
--- a/README.md
+++ b/README.md
@@ -13,14 +13,12 @@ Keygrip is a [node.js](http://nodejs.org/) module for signing and verifying data
 
 ### keys = new Keygrip([keylist], [hmacAlgorithm], [encoding])
 
-This creates a new Keygrip based on the provided keylist, an array of secret keys used for SHA1 HMAC digests. If no `keylist` is given, or is empty, Keygrip uses the default key created during `npm` installation, and will issue a warning to the console. `hmacAlgorithm` defaults to `'sha1'` and `encoding` defaults to `'base64'`.
+This creates a new Keygrip based on the provided keylist, an array of secret keys used for SHA1 HMAC digests. `keylist` is obligatory. `hmacAlgorithm` defaults to `'sha1'` and `encoding` defaults to `'base64'`.
 
 Note that the `new` operator is also optional, so all of the following will work when `Keygrip = require("keygrip")`:
 
 ```javascript
-keys = new Keygrip
 keys = new Keygrip(["SEKRIT2", "SEKRIT1"])
-keys = Keygrip()
 keys = Keygrip(["SEKRIT2", "SEKRIT1"])
 keys = require("keygrip")()
 keys = Keygrip(["SEKRIT2", "SEKRIT1"], 'sha256', 'hex')
@@ -56,22 +54,14 @@ var assert = require("assert")
   , Keygrip = require("keygrip")
   , keylist, keys, hash, index
 
-// keygrip takes an array of keys, but if none exist,
-// it uses the defaults created during npm installation.
-// (but it'll will warn you)
-console.log("Ignore this message:")
-keys = new Keygrip(/* empty list */)
-
-// .sign returns the hash for the first key
-// all hashes are SHA1 HMACs in url-safe base64
-hash = keys.sign("bieberschnitzel")
-assert.ok(/^[\w\-]{27}$/.test(hash))
-
 // but we're going to use our list.
 // (note that the 'new' operator is optional)
 keylist = ["SEKRIT3", "SEKRIT2", "SEKRIT1"]
 keys = Keygrip(keylist)
+// .sign returns the hash for the first key
+// all hashes are SHA1 HMACs in url-safe base64
 hash = keys.sign("bieberschnitzel")
+assert.ok(/^[\w\-]{27}$/.test(hash))
 
 // .index returns the index of the first matching key
 index = keys.index("bieberschnitzel", hash)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-keygrip.git



More information about the Pkg-javascript-commits mailing list