Skip to content

Commit

Permalink
Moving to grunt build.
Browse files Browse the repository at this point in the history
  • Loading branch information
travist committed Apr 19, 2016
1 parent a1c38e5 commit 46f2d0d
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 152 deletions.
109 changes: 0 additions & 109 deletions Gruntfile.js

This file was deleted.

15 changes: 5 additions & 10 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
File: src/LICENSE.txt
File: /src/LICENSE.txt
The MIT License (MIT)
Copyright (c) 2013 AllPlayers.com
Copyright (c) 2015 Form.io

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in the
Expand All @@ -19,8 +19,7 @@ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTIO
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


File: lib/jsrsasign/LICENSE.txt
File: /lib/jsrsasign/LICENSE.txt


CONTAINS CODE FROM YUI LIBRARY SEE LICENSE @ http://yuilibrary.com/license/
Expand All @@ -46,9 +45,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


File: lib/jsbn/LICENSE.txt
File: /lib/jsbn/LICENSE.txt


Licensing
Expand Down Expand Up @@ -91,9 +88,7 @@ Address all questions regarding this license to:

Tom Wu
[email protected]


File: lib/asn1js/LICENSE.txt
File: /lib/asn1js/LICENSE.txt


ASN.1 JavaScript decoder
Expand Down
29 changes: 22 additions & 7 deletions bin/jsencrypt.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*! JSEncrypt v2.2.0 | https://npmcdn.com/[email protected]/LICENSE.txt */
var JSEncryptExports = {};
(function(exports) {
// Copyright (c) 2005 Tom Wu
// Copyright (c) 2005 Tom Wu
// All Rights Reserved.
// See "LICENSE" for details.

Expand Down Expand Up @@ -559,6 +560,7 @@ BigInteger.prototype.modPowInt = bnModPowInt;
// "constants"
BigInteger.ZERO = nbv(0);
BigInteger.ONE = nbv(1);

// Copyright (c) 2005-2009 Tom Wu
// All Rights Reserved.
// See "LICENSE" for details.
Expand Down Expand Up @@ -1215,6 +1217,7 @@ BigInteger.prototype.square = bnSquare;
// int hashCode()
// long longValue()
// static BigInteger valueOf(long val)

// prng4.js - uses Arcfour as a PRNG

function Arcfour() {
Expand Down Expand Up @@ -1260,6 +1263,7 @@ function prng_newstate() {
// Pool size must be a multiple of 4 and greater than 32.
// An array of bytes the size of the pool will be passed to init()
var rng_psize = 256;

// Random number generator - requires a PRNG backend, e.g. prng4.js
var rng_state;
var rng_pool;
Expand Down Expand Up @@ -1329,6 +1333,7 @@ function rng_get_bytes(ba) {
function SecureRandom() {}

SecureRandom.prototype.nextBytes = rng_get_bytes;

// Depends on jsbn.js and rng.js

// Version 1.1: support utf-8 encoding in pkcs1pad2
Expand Down Expand Up @@ -1441,6 +1446,7 @@ RSAKey.prototype.doPublic = RSADoPublic;
RSAKey.prototype.setPublic = RSASetPublic;
RSAKey.prototype.encrypt = RSAEncrypt;
//RSAKey.prototype.encrypt_b64 = RSAEncryptB64;

// Depends on rsa.js and jsbn2.js

// Version 1.1: support utf-8 decoding in pkcs1unpad2
Expand Down Expand Up @@ -1573,6 +1579,7 @@ RSAKey.prototype.setPrivateEx = RSASetPrivateEx;
RSAKey.prototype.generate = RSAGenerate;
RSAKey.prototype.decrypt = RSADecrypt;
//RSAKey.prototype.b64_decrypt = RSAB64Decrypt;

// Copyright (c) 2011 Kevin M Burns Jr.
// All Rights Reserved.
// See "LICENSE" for details.
Expand Down Expand Up @@ -1724,7 +1731,8 @@ var bnpFromNumberAsync = function (a,b,c,callback) {
};
BigInteger.prototype.fromNumberAsync = bnpFromNumberAsync;

})();var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
})();
var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var b64pad="=";

function hex2b64(h) {
Expand Down Expand Up @@ -1795,6 +1803,7 @@ function b64toBA(s) {
}
return a;
}

/*! asn1-1.0.2.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
*/

Expand Down Expand Up @@ -3140,7 +3149,8 @@ KJUR.asn1.DERTaggedObject = function(params) {
}
}
};
JSX.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);// Hex JavaScript decoder
JSX.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);
// Hex JavaScript decoder
// Copyright (c) 2008-2013 Lapo Luchini <[email protected]>

// Permission to use, copy, modify, and/or distribute this software for any
Expand Down Expand Up @@ -3204,7 +3214,8 @@ Hex.decode = function(a) {

// export globals
window.Hex = Hex;
})();// Base64 JavaScript decoder
})();
// Base64 JavaScript decoder
// Copyright (c) 2008-2013 Lapo Luchini <[email protected]>

// Permission to use, copy, modify, and/or distribute this software for any
Expand Down Expand Up @@ -3289,7 +3300,8 @@ Base64.unarmor = function (a) {

// export globals
window.Base64 = Base64;
})();// ASN.1 JavaScript decoder
})();
// ASN.1 JavaScript decoder
// Copyright (c) 2008-2013 Lapo Luchini <[email protected]>

// Permission to use, copy, modify, and/or distribute this software for any
Expand Down Expand Up @@ -3823,7 +3835,8 @@ ASN1.test = function () {

// export globals
window.ASN1 = ASN1;
})();/**
})();
/**
* Retrieve the hexadecimal value (as a string) of the current ASN.1 element
* @returns {string}
* @public
Expand Down Expand Up @@ -4323,6 +4336,8 @@ JSEncrypt.prototype.getPublicKeyB64 = function () {
return this.getKey().getPublicBaseKeyB64();
};


JSEncrypt.version = '2.2.0';
exports.JSEncrypt = JSEncrypt;
})(JSEncryptExports);
(function (global, factory) {
Expand All @@ -4333,4 +4348,4 @@ exports.JSEncrypt = JSEncrypt;
} else {
global.JSEncrypt = factory;
}
}(this, JSEncryptExports.JSEncrypt));
}(this, JSEncryptExports.JSEncrypt));
87 changes: 73 additions & 14 deletions bin/jsencrypt.min.js

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var insert = require('gulp-insert');
var wrap = require('gulp-wrap');

var files = [
'lib/jsbn/jsbn.js',
'lib/jsbn/jsbn2.js',
'lib/jsbn/prng4.js',
'lib/jsbn/rng.js',
'lib/jsbn/rsa.js',
'lib/jsbn/rsa2.js',
'lib/jsbn/rsa-async.js',
'lib/jsbn/base64.js',
'lib/jsrsasign/asn1-1.0.js',
'lib/asn1js/hex.js',
'lib/asn1js/base64.js',
'lib/asn1js/asn1.js',
'src/jsencrypt.js'
];

var lintFiles = [
'src/jsencrypt.js'
];

var licenses = [
'src/LICENSE.txt',
'lib/jsrsasign/LICENSE.txt',
'lib/jsbn/LICENSE.txt',
'lib/asn1js/LICENSE.txt'
];

gulp.task('lint', function () {
return gulp.src(lintFiles)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});

gulp.task('license', function() {
return gulp.src(licenses)
.pipe(insert.transform(function(contents, file) {
return 'File: ' + file.path.replace(__dirname, '') + "\n" + contents;
}))
.pipe(concat('LICENSE.txt'))
.pipe(gulp.dest(''));
});

var packageJson = require('./package.json');
gulp.task('scripts', function() {
return gulp.src(files)
.pipe(concat('jsencrypt.js'))
.pipe(wrap({src: 'src/template.txt'}, {version: packageJson.version}, {variable: 'data'}))
.pipe(gulp.dest('bin/'))
.pipe(rename('jsencrypt.min.js'))
.pipe(uglify({preserveComments: 'license'}))
.pipe(gulp.dest('bin'));
});

gulp.task('build', ['lint', 'scripts', 'license']);
gulp.task('default', ['build']);
31 changes: 21 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
"version": "2.2.0",
"description": "A Javascript library to perform OpenSSL RSA Encryption, Decryption, and Key Generation.",
"main": "bin/jsencrypt.js",
"author": {
"name": "Travis Tidwell",
"email": "[email protected]",
"url": "http://github.com/travist"
},
"contributors": [
{
"name": "Travis Tidwell",
"email": "[email protected]",
"url": "http://github.com/travist"
},
{
"name": "Antonio",
"url": "https://github.com/zoloft"
}
],
"homepage": "http://www.travistidwell.com/jsencrypt",
"repository": {
"type": "git",
Expand All @@ -17,10 +23,15 @@
"url": "http://github.com/travist/jsencrypt/issues"
},
"devDependencies": {
"grunt": "~0.4.4",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-concat": "~0.4.0",
"grunt-jekyll": "0.4.2"
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-eslint": "^2.0.0",
"gulp-insert": "^0.5.0",
"gulp-watch": "^4.3.5",
"gulp-wrap": "^0.11.0"
},
"dependencies": {
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.5.3"
}
}
Loading

0 comments on commit 46f2d0d

Please sign in to comment.