[Pkg-javascript-commits] [node-keygrip] 20/68: add travis-ci

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Fri Jun 27 22:13:24 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 ecd46e5a1df01ebbd52ca5d528c1895933310f4e
Author: Jed Schmidt <tr at nslator.jp>
Date:   Sun Jan 15 10:15:43 2012 +0900

    add travis-ci
---
 .travis.yml                      |  3 +++
 LICENSE.txt                      |  2 +-
 README.md                        |  8 +++----
 index.js                         | 49 +++++++++++++++++++++++++++++++++++++++-
 scripts/install.js => install.js |  0
 lib/keygrip.js                   | 48 ---------------------------------------
 package.json                     | 14 ++----------
 test.js                          |  2 +-
 8 files changed, 58 insertions(+), 68 deletions(-)

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..2d26206
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+  - 0.6
diff --git a/LICENSE.txt b/LICENSE.txt
index a612d47..161dfc3 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2011 Jed Schmidt, http://jedschmidt.com/
+Copyright (c) 2012 Jed Schmidt, http://jedschmidt.com/
  
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
diff --git a/README.md b/README.md
index 9539d70..d72736f 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,9 @@
 Keygrip
 =======
 
-Keygrip is a [node.js](http://nodejs.org/) module for signing and verifying data (such as cookies or URLs) through a rotating credential system, in which new server keys can be added and old ones removed regularly, without invalidating client credentials.
-
-## Requirements
+[![Build Status](https://secure.travis-ci.org/jed/keygrip.png)](http://travis-ci.org/jed/keygrip)
 
-* [node.js](http://nodejs.org/), tested with 0.4.1
+Keygrip is a [node.js](http://nodejs.org/) module for signing and verifying data (such as cookies or URLs) through a rotating credential system, in which new server keys can be added and old ones removed regularly, without invalidating client credentials.
 
 ## Install
 
@@ -96,6 +94,6 @@ This uses `index` to return `true` if the digest matches any existing keys, and
 Copyright
 ---------
 
-Copyright (c) 2011 Jed Schmidt. See LICENSE.txt for details.
+Copyright (c) 2012 Jed Schmidt. See LICENSE.txt for details.
 
 Send any questions or comments [here](http://twitter.com/jedschmidt).
\ No newline at end of file
diff --git a/index.js b/index.js
index 2d8e632..519d02e 100644
--- a/index.js
+++ b/index.js
@@ -1 +1,48 @@
-module.exports = require( "./lib/keygrip" )
\ No newline at end of file
+crypto = require( "crypto" )
+path = require( "path" )
+fs = require( "fs" )
+
+keysPath = path.join( __dirname, "defaultKeys.json" )
+
+defaults = path.existsSync( keysPath )
+  ? JSON.parse( fs.readFileSync( keysPath ) )
+  : undefined
+
+function Keygrip( keys ) {
+  if ( !( this instanceof Keygrip ) ) return new Keygrip( keys )
+  
+  if ( !keys || !( 0 in keys ) ) {
+    if ( keys = defaults ) console.warn( "No keys specified, using defaults instead." )
+    
+    else throw "Keys must be provided or default keys must exist."
+  }
+  
+  function sign( data, key ) {
+    return crypto
+      .createHmac( "sha1", key )
+      .update( data ).digest( "base64" )
+      .replace( /\/|\+|=/g, function( x ) {
+        return ({ "/": "_", "+": "-", "=": "" })[ x ]  
+      })
+  }
+
+  this.sign = function( data ){ return sign( data, keys[ 0 ] ) }
+
+  this.verify = function( data, digest ) {
+    return this.index( data, digest ) > -1
+  }
+
+  this.index = function( data, digest ) {
+    for ( var i = 0, l = keys.length; i < l; i++ ) {
+      if ( digest === sign( data, keys[ i ] ) ) return i
+    }
+    
+    return -1
+  }
+}
+
+Keygrip.sign = Keygrip.verify = Keygrip.index = function() {
+  throw "Usage: require( 'keygrip' )( <array-of-keys> )"
+}
+
+module.exports = Keygrip
\ No newline at end of file
diff --git a/scripts/install.js b/install.js
similarity index 100%
rename from scripts/install.js
rename to install.js
diff --git a/lib/keygrip.js b/lib/keygrip.js
deleted file mode 100644
index 519d02e..0000000
--- a/lib/keygrip.js
+++ /dev/null
@@ -1,48 +0,0 @@
-crypto = require( "crypto" )
-path = require( "path" )
-fs = require( "fs" )
-
-keysPath = path.join( __dirname, "defaultKeys.json" )
-
-defaults = path.existsSync( keysPath )
-  ? JSON.parse( fs.readFileSync( keysPath ) )
-  : undefined
-
-function Keygrip( keys ) {
-  if ( !( this instanceof Keygrip ) ) return new Keygrip( keys )
-  
-  if ( !keys || !( 0 in keys ) ) {
-    if ( keys = defaults ) console.warn( "No keys specified, using defaults instead." )
-    
-    else throw "Keys must be provided or default keys must exist."
-  }
-  
-  function sign( data, key ) {
-    return crypto
-      .createHmac( "sha1", key )
-      .update( data ).digest( "base64" )
-      .replace( /\/|\+|=/g, function( x ) {
-        return ({ "/": "_", "+": "-", "=": "" })[ x ]  
-      })
-  }
-
-  this.sign = function( data ){ return sign( data, keys[ 0 ] ) }
-
-  this.verify = function( data, digest ) {
-    return this.index( data, digest ) > -1
-  }
-
-  this.index = function( data, digest ) {
-    for ( var i = 0, l = keys.length; i < l; i++ ) {
-      if ( digest === sign( data, keys[ i ] ) ) return i
-    }
-    
-    return -1
-  }
-}
-
-Keygrip.sign = Keygrip.verify = Keygrip.index = function() {
-  throw "Usage: require( 'keygrip' )( <array-of-keys> )"
-}
-
-module.exports = Keygrip
\ No newline at end of file
diff --git a/package.json b/package.json
index dcde1cd..49ddf78 100644
--- a/package.json
+++ b/package.json
@@ -3,20 +3,10 @@
   "version": "0.1.7",
   "description": "Key signing and verification for rotated credentials",
   "scripts": {
-    "install": "node scripts/install.js"
+    "install": "node ./install.js"
   },
   "repository": {
     "type": "git",
     "url": "git://github.com/jed/keygrip.git"
-  },
-  "main": "./index",
-  "engines": [
-    "node"
-  ],
-  "directories": {
-    "lib": "./lib"
-  },
-  "files": [
-    ""
-  ]
+  }
 }
\ No newline at end of file
diff --git a/test.js b/test.js
index ec2969f..fead072 100644
--- a/test.js
+++ b/test.js
@@ -1,6 +1,6 @@
 // ./test.js
 var assert = require( "assert" )
-  , Keygrip = require( "keygrip" )
+  , Keygrip = require( "./" )
   , keylist, keys, hash, index
 
 // keygrip takes an array of keys, but if none exist,

-- 
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