Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Merges JWS (JSON Web Signature) support.
Browse files Browse the repository at this point in the history
Authored by Patrizio Bruno <desertconsulting@gmail.com>

note: I usually don't squash commits but I had to significantly re-work
the pull request and squashing was the only reasonable solution. The
commit history as well as the discussion is avaiable at:
#15

The main difference between the PR and this code are:
* jose-jwe-utils.js was renamed to jose-utils.js
* the Gruntfile was fixed to pass Travis build.
* style changes to jose-jwe-decrypt.js and jost-jwe-encrypt.js were
  rejected.
* `var that = this` constructs were rejected.
* alg is a required parameter for importRsaPublicKey and importRsaPrivateKey.
* isCryptoKey was added to the Utils namespace.

(in diff format: https://gist.github.com/alokmenghrajani/eb7fe614402d3723a451)
  • Loading branch information
alokmenghrajani committed Sep 9, 2015
1 parent 175dc8c commit 037532d
Show file tree
Hide file tree
Showing 16 changed files with 3,767 additions and 492 deletions.
45 changes: 32 additions & 13 deletions Gruntfile.js
Expand Up @@ -8,34 +8,52 @@ module.exports = function(grunt) {
},

concat: {
dist: {
prod: {
options: {
banner: '(function(exports, crypto, Promise, Error, Uint8Array){\n"use strict";\n\n// supporting Safari and its vendor prefix\nif(!crypto.subtle) crypto.subtle = crypto.webkitSubtle;\n',
footer: "}(window, window.crypto, window.Promise, window.Error, window.Uint8Array));\n"
},
src: [
'lib/jose-core.js',
'lib/jose-jwe-webcryptographer.js',
'lib/jose-utils.js',
'lib/jose-jwe-encrypt.js',
'lib/jose-jwe-decrypt.js',
'lib/jose-jws-sign.js',
'lib/jose-jws-verify.js'
],
dest: 'dist/jose.js'
},
testing: {
options: {
banner: "(function(){\n",
footer: "}());\n"
banner: '(function(exports, crypto, Promise, Error, Uint8Array){\n// supporting Safari and its vendor prefix\nif(!crypto.subtle) crypto.subtle = crypto.webkitSubtle;\n',
footer: "}(window, window.crypto, window.Promise, window.Error, window.Uint8Array));\n"
},
src: [
'lib/jose-jwe-core.js',
'lib/jose-core.js',
'lib/jose-jwe-webcryptographer.js',
'lib/jose-jwe-utils.js',
'lib/jose-utils.js',
'lib/jose-jwe-encrypt.js',
'lib/jose-jwe-decrypt.js',
'lib/jose-jws-sign.js',
'lib/jose-jws-verify.js'
],
dest: 'dist/jose-jwe.js'
dest: 'dist/jose-testing.js'
}
},

uglify: {
dist: {
src: 'dist/jose-jwe.js',
dest: 'dist/jose-jwe.min.js'
src: 'dist/jose.js',
dest: 'dist/jose.min.js'
}
},

karma: {
with_coverage: {
options: {
preprocessors: {
'dist/jose-jwe.js': ['coverage']
'dist/jose-testing.js': ['coverage']
},
reporters: ['coverage'],
coverageReporter: {
Expand All @@ -44,7 +62,7 @@ module.exports = function(grunt) {
},
frameworks: ['qunit'],
files: [
{pattern: 'dist/jose-jwe.js', watching: false, included: false},
{pattern: 'dist/jose-testing.js', watching: false, included: false},
{pattern: 'test/qunit-promises.js', watching: false, included: false},
'test/jose-jwe-test.html'
],
Expand All @@ -64,9 +82,10 @@ module.exports = function(grunt) {
options: {
frameworks: ['qunit'],
files: [
{pattern: 'dist/jose-jwe.js', watching: false, included: false},
{pattern: 'dist/jose-testing.js', watching: false, included: false},
{pattern: 'test/qunit-promises.js', watching: false, included: false},
'test/jose-jwe-test.html'
'test/jose-jwe-test.html',
'test/jose-jws-test.html'
],
autoWatch: true,
browsers: ['Chrome'],
Expand All @@ -91,7 +110,7 @@ module.exports = function(grunt) {
}
};

if(process.env.TRAVIS){
if (process.env.TRAVIS) {
config.karma.with_coverage.browsers = ['Chrome_travis_ci'];
config.karma.without_coverage.browsers = ['Chrome_travis_ci'];
}
Expand Down
1 change: 0 additions & 1 deletion dist/jose-jwe.min.js

This file was deleted.

0 comments on commit 037532d

Please sign in to comment.