diff --git a/Gruntfile.js b/Gruntfile.js
index b59be4b..4ab946a 100755
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -87,7 +87,7 @@ module.exports = function(grunt) {
copy: {
jquery: {
- src: 'bower_components/jquery/index.js',
+ src: 'bower_components/jquery/dist/jquery.min.js',
dest: 'build/common/dep/jquery.min.js'
},
vendor: {
@@ -263,7 +263,7 @@ module.exports = function(grunt) {
'dep/safari/openpgpjs/compression/rawdeflate.min.js',
'dep/safari/openpgpjs/compression/rawdeflate.min.js.map'
],
- dest: 'build/e2e-plugin.safariextension/dep/'
+ dest: 'build/e2e-plugin.safariextension/'
},
{
expand: true,
@@ -292,7 +292,7 @@ module.exports = function(grunt) {
expand: true,
flatten: true,
src: ['dep/chrome/openpgpjs/openpgp.js', 'dep/chrome/openpgpjs/openpgp.worker.js'],
- dest: 'build/chrome/dep/'
+ dest: 'build/chrome/'
},
{
expand: true,
@@ -321,7 +321,7 @@ module.exports = function(grunt) {
expand: true,
flatten: true,
src: ['dep/firefox/openpgpjs/openpgp.js', 'dep/firefox/openpgpjs/openpgp.worker.js'],
- dest: 'build/firefox/dep/'
+ dest: 'build/firefox/'
},
{
expand: true,
@@ -350,7 +350,7 @@ module.exports = function(grunt) {
expand: true,
flatten: true,
src: ['dep/edge/openpgpjs/openpgp.js', 'dep/edge/openpgpjs/openpgp.worker.js'],
- dest: 'build/edge/Extension/dep/'
+ dest: 'build/edge/Extension/'
},
{
expand: true,
diff --git a/bower.json b/bower.json
index 8f86e11..7e2b7d3 100755
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "porto",
- "version": "4.1.0",
+ "version": "5.0.0",
"description": "Porto is a browser extension library for Google Chrome,Firefox and Safari that allows to develop cross platform browser extension with ease.",
"license": "ALS",
"private": true,
@@ -12,14 +12,11 @@
"tests"
],
"dependencies": {
- "jquery": "https://code.jquery.com/jquery-2.2.4.min.js",
- "bootstrap": "~3.3.1",
+ "jquery": "3.3.1",
+ "bootstrap": "3.3.1",
"requirejs": "2.1.14",
"dompurify": "0.7.3",
- "bootstrap-sortable": "~1.10.0",
+ "bootstrap-sortable": "1.10.0",
"qrcodejs": "0.1.0"
- },
- "resolutions": {
- "jquery": "e-tag:W/\"573f485"
}
}
diff --git a/chrome/background.js b/chrome/background.js
index e671935..a10213a 100755
--- a/chrome/background.js
+++ b/chrome/background.js
@@ -5,7 +5,7 @@ var porto = porto || null;
requirejs.config({
baseUrl: 'lib', paths: {
jquery: '../common/dep/jquery.min',
- openpgp: '../dep/openpgp',
+ openpgp: '../openpgp',
porto: '../common/ui/porto',
parser_rules: '../common/dep/wysihtml5/js/advanced_parser_rules',
dompurify: '../common/dep/purify'
diff --git a/chrome/manifest.json b/chrome/manifest.json
index 132214a..c67cdae 100755
--- a/chrome/manifest.json
+++ b/chrome/manifest.json
@@ -1,7 +1,7 @@
{
"name": "__MSG_ext_name__",
- "version": "4.2.0",
- "version_name": "4.2.0",
+ "version": "5.0.0",
+ "version_name": "5.0.0",
"description": "__MSG_ext_description__",
"homepage_url":"https://subutai.io",
"manifest_version": 2,
diff --git a/common/css/libs/sweetalert.css b/common/css/libs/sweetalert.css
deleted file mode 100755
index ab07f9a..0000000
--- a/common/css/libs/sweetalert.css
+++ /dev/null
@@ -1,932 +0,0 @@
-body.stop-scrolling {
- height: 100%;
- overflow: hidden; }
-
-.sweet-overlay {
- background-color: black;
- /* IE8 */
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
- /* IE8 */
- background-color: rgba(0, 0, 0, 0.4);
- position: fixed;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- display: none;
- z-index: 10000; }
-
-.sweet-alert {
- background-color: white;
- font-family: 'Ubuntu', 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
- width: 478px;
- padding: 17px;
- border-radius: 5px;
- text-align: center;
- position: fixed;
- left: 50%;
- top: 50%;
- margin-left: -256px;
- margin-top: -200px;
- overflow: hidden;
- display: none;
- z-index: 99999; }
- @media all and (max-width: 540px) {
- .sweet-alert {
- width: auto;
- margin-left: 0;
- margin-right: 0;
- left: 15px;
- right: 15px; } }
- .sweet-alert h2 {
- color: #19286e;
- font-size: 30px;
- text-align: center;
- font-weight: 600;
- text-transform: none;
- position: relative;
- margin: 25px 0;
- padding: 0;
- line-height: 40px;
- display: block; }
- .sweet-alert p {
- color: #19286e;
- font-size: 16px;
- text-align: center;
- font-weight: 300;
- position: relative;
- text-align: inherit;
- float: none;
- margin: 0;
- padding: 0;
- line-height: normal; }
- .sweet-alert fieldset {
- border: none;
- position: relative; }
- .sweet-alert .sa-error-container {
- background-color: #f1f1f1;
- margin-left: -17px;
- margin-right: -17px;
- overflow: hidden;
- padding: 0 10px;
- max-height: 0;
- webkit-transition: padding 0.15s, max-height 0.15s;
- transition: padding 0.15s, max-height 0.15s; }
- .sweet-alert .sa-error-container.show {
- padding: 10px 0;
- max-height: 100px;
- webkit-transition: padding 0.2s, max-height 0.2s;
- transition: padding 0.25s, max-height 0.25s; }
- .sweet-alert .sa-error-container .icon {
- display: inline-block;
- width: 24px;
- height: 24px;
- border-radius: 50%;
- background-color: #ea7d7d;
- color: white;
- line-height: 24px;
- text-align: center;
- margin-right: 3px; }
- .sweet-alert .sa-error-container p {
- display: inline-block; }
- .sweet-alert .sa-input-error {
- position: absolute;
- top: 29px;
- right: 26px;
- width: 20px;
- height: 20px;
- opacity: 0;
- -webkit-transform: scale(0.5);
- transform: scale(0.5);
- -webkit-transform-origin: 50% 50%;
- transform-origin: 50% 50%;
- -webkit-transition: all 0.1s;
- transition: all 0.1s; }
- .sweet-alert .sa-input-error::before, .sweet-alert .sa-input-error::after {
- content: "";
- width: 20px;
- height: 6px;
- background-color: #f06e57;
- border-radius: 3px;
- position: absolute;
- top: 50%;
- margin-top: -4px;
- left: 50%;
- margin-left: -9px; }
- .sweet-alert .sa-input-error::before {
- -webkit-transform: rotate(-45deg);
- transform: rotate(-45deg); }
- .sweet-alert .sa-input-error::after {
- -webkit-transform: rotate(45deg);
- transform: rotate(45deg); }
- .sweet-alert .sa-input-error.show {
- opacity: 1;
- -webkit-transform: scale(1);
- transform: scale(1); }
- .sweet-alert input {
- width: 100%;
- box-sizing: border-box;
- border-radius: 3px;
- border: 1px solid #d7d7d7;
- height: 43px;
- margin-top: 10px;
- margin-bottom: 17px;
- font-size: 18px;
- box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.06);
- padding: 0 12px;
- display: none;
- -webkit-transition: all 0.3s;
- transition: all 0.3s; }
- .sweet-alert input:focus {
- outline: none;
- box-shadow: 0px 0px 3px #c4e6f5;
- border: 1px solid #b4dbed; }
- .sweet-alert input:focus::-moz-placeholder {
- transition: opacity 0.3s 0.03s ease;
- opacity: 0.5; }
- .sweet-alert input:focus:-ms-input-placeholder {
- transition: opacity 0.3s 0.03s ease;
- opacity: 0.5; }
- .sweet-alert input:focus::-webkit-input-placeholder {
- transition: opacity 0.3s 0.03s ease;
- opacity: 0.5; }
- .sweet-alert input::-moz-placeholder {
- color: #bdbdbd; }
- .sweet-alert input:-ms-input-placeholder {
- color: #bdbdbd; }
- .sweet-alert input::-webkit-input-placeholder {
- color: #bdbdbd; }
- .sweet-alert.show-input input {
- display: block; }
- .sweet-alert .sa-confirm-button-container {
- display: inline-block;
- position: relative; }
- .sweet-alert .la-ball-fall {
- position: absolute;
- left: 50%;
- top: 50%;
- margin-left: -27px;
- margin-top: 4px;
- opacity: 0;
- visibility: hidden; }
- .sweet-alert button {
- background-color: #22b573;
- color: white;
- border: none;
- box-shadow: none;
- font-size: 17px;
- font-weight: 500;
- -webkit-border-radius: 4px;
- border-radius: 5px;
- padding: 6px 20px;
- margin: 26px 5px 0 5px;
- cursor: pointer; }
- .sweet-alert button:focus {
- outline: none;
- box-shadow: 0 0 2px rgba(128, 179, 235, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.05); }
- .sweet-alert button:hover {
- background-color: #22b547; }
- .sweet-alert button:active {
- background-color: #22b590; }
- .sweet-alert button.cancel {
- background-color: #255fb5; }
- .sweet-alert button.cancel:hover {
- background-color: #255fff; }
- .sweet-alert button.cancel:active {
- background-color: #255fff; }
- .sweet-alert button.cancel:focus {
- box-shadow: rgba(197, 205, 211, 0.8) 0px 0px 2px, rgba(0, 0, 0, 0.0470588) 0px 0px 0px 1px inset !important; }
- .sweet-alert button[disabled] {
- opacity: .6;
- cursor: default; }
- .sweet-alert button.confirm[disabled] {
- color: transparent; }
- .sweet-alert button.confirm[disabled] ~ .la-ball-fall {
- opacity: 1;
- visibility: visible;
- transition-delay: 0s; }
- .sweet-alert button::-moz-focus-inner {
- border: 0; }
- .sweet-alert[data-has-cancel-button=false] button {
- box-shadow: none !important; }
- .sweet-alert[data-has-confirm-button=false][data-has-cancel-button=false] {
- padding-bottom: 40px; }
- .sweet-alert .sa-icon {
- width: 80px;
- height: 80px;
- border: 4px solid gray;
- -webkit-border-radius: 40px;
- border-radius: 40px;
- border-radius: 50%;
- margin: 20px auto;
- padding: 0;
- position: relative;
- box-sizing: content-box; }
- .sweet-alert .sa-icon.sa-error {
- border-color: #F27474; }
- .sweet-alert .sa-icon.sa-error .sa-x-mark {
- position: relative;
- display: block; }
- .sweet-alert .sa-icon.sa-error .sa-line {
- position: absolute;
- height: 5px;
- width: 47px;
- background-color: #F27474;
- display: block;
- top: 37px;
- border-radius: 2px; }
- .sweet-alert .sa-icon.sa-error .sa-line.sa-left {
- -webkit-transform: rotate(45deg);
- transform: rotate(45deg);
- left: 17px; }
- .sweet-alert .sa-icon.sa-error .sa-line.sa-right {
- -webkit-transform: rotate(-45deg);
- transform: rotate(-45deg);
- right: 16px; }
- .sweet-alert .sa-icon.sa-warning {
- border-color: #F8BB86; }
- .sweet-alert .sa-icon.sa-warning .sa-body {
- position: absolute;
- width: 5px;
- height: 47px;
- left: 50%;
- top: 10px;
- -webkit-border-radius: 2px;
- border-radius: 2px;
- margin-left: -2px;
- background-color: #F8BB86; }
- .sweet-alert .sa-icon.sa-warning .sa-dot {
- position: absolute;
- width: 7px;
- height: 7px;
- -webkit-border-radius: 50%;
- border-radius: 50%;
- margin-left: -3px;
- left: 50%;
- bottom: 10px;
- background-color: #F8BB86; }
- .sweet-alert .sa-icon.sa-info {
- border-color: #C9DAE1; }
- .sweet-alert .sa-icon.sa-info::before {
- content: "";
- position: absolute;
- width: 5px;
- height: 29px;
- left: 50%;
- bottom: 17px;
- border-radius: 2px;
- margin-left: -2px;
- background-color: #C9DAE1; }
- .sweet-alert .sa-icon.sa-info::after {
- content: "";
- position: absolute;
- width: 7px;
- height: 7px;
- border-radius: 50%;
- margin-left: -3px;
- top: 19px;
- background-color: #C9DAE1; }
- .sweet-alert .sa-icon.sa-success {
- border-color: #A5DC86; }
- .sweet-alert .sa-icon.sa-success::before, .sweet-alert .sa-icon.sa-success::after {
- content: '';
- -webkit-border-radius: 40px;
- border-radius: 40px;
- border-radius: 50%;
- position: absolute;
- width: 60px;
- height: 120px;
- background: white;
- -webkit-transform: rotate(45deg);
- transform: rotate(45deg); }
- .sweet-alert .sa-icon.sa-success::before {
- -webkit-border-radius: 120px 0 0 120px;
- border-radius: 120px 0 0 120px;
- top: -7px;
- left: -33px;
- -webkit-transform: rotate(-45deg);
- transform: rotate(-45deg);
- -webkit-transform-origin: 60px 60px;
- transform-origin: 60px 60px; }
- .sweet-alert .sa-icon.sa-success::after {
- -webkit-border-radius: 0 120px 120px 0;
- border-radius: 0 120px 120px 0;
- top: -11px;
- left: 30px;
- -webkit-transform: rotate(-45deg);
- transform: rotate(-45deg);
- -webkit-transform-origin: 0px 60px;
- transform-origin: 0px 60px; }
- .sweet-alert .sa-icon.sa-success .sa-placeholder {
- width: 80px;
- height: 80px;
- border: 4px solid rgba(165, 220, 134, 0.2);
- -webkit-border-radius: 40px;
- border-radius: 40px;
- border-radius: 50%;
- box-sizing: content-box;
- position: absolute;
- left: -4px;
- top: -4px;
- z-index: 2; }
- .sweet-alert .sa-icon.sa-success .sa-fix {
- width: 5px;
- height: 90px;
- background-color: white;
- position: absolute;
- left: 28px;
- top: 8px;
- z-index: 1;
- -webkit-transform: rotate(-45deg);
- transform: rotate(-45deg); }
- .sweet-alert .sa-icon.sa-success .sa-line {
- height: 5px;
- background-color: #A5DC86;
- display: block;
- border-radius: 2px;
- position: absolute;
- z-index: 2; }
- .sweet-alert .sa-icon.sa-success .sa-line.sa-tip {
- width: 25px;
- left: 14px;
- top: 46px;
- -webkit-transform: rotate(45deg);
- transform: rotate(45deg); }
- .sweet-alert .sa-icon.sa-success .sa-line.sa-long {
- width: 47px;
- right: 8px;
- top: 38px;
- -webkit-transform: rotate(-45deg);
- transform: rotate(-45deg); }
- .sweet-alert .sa-icon.sa-custom {
- background-size: contain;
- border-radius: 0;
- border: none;
- background-position: center center;
- background-repeat: no-repeat; }
-
-/*
- * Animations
- */
-@-webkit-keyframes showSweetAlert {
- 0% {
- transform: scale(0.7);
- -webkit-transform: scale(0.7); }
- 45% {
- transform: scale(1.05);
- -webkit-transform: scale(1.05); }
- 80% {
- transform: scale(0.95);
- -webkit-transform: scale(0.95); }
- 100% {
- transform: scale(1);
- -webkit-transform: scale(1); } }
-
-@keyframes showSweetAlert {
- 0% {
- transform: scale(0.7);
- -webkit-transform: scale(0.7); }
- 45% {
- transform: scale(1.05);
- -webkit-transform: scale(1.05); }
- 80% {
- transform: scale(0.95);
- -webkit-transform: scale(0.95); }
- 100% {
- transform: scale(1);
- -webkit-transform: scale(1); } }
-
-@-webkit-keyframes hideSweetAlert {
- 0% {
- transform: scale(1);
- -webkit-transform: scale(1); }
- 100% {
- transform: scale(0.5);
- -webkit-transform: scale(0.5); } }
-
-@keyframes hideSweetAlert {
- 0% {
- transform: scale(1);
- -webkit-transform: scale(1); }
- 100% {
- transform: scale(0.5);
- -webkit-transform: scale(0.5); } }
-
-@-webkit-keyframes slideFromTop {
- 0% {
- top: 0%; }
- 100% {
- top: 50%; } }
-
-@keyframes slideFromTop {
- 0% {
- top: 0%; }
- 100% {
- top: 50%; } }
-
-@-webkit-keyframes slideToTop {
- 0% {
- top: 50%; }
- 100% {
- top: 0%; } }
-
-@keyframes slideToTop {
- 0% {
- top: 50%; }
- 100% {
- top: 0%; } }
-
-@-webkit-keyframes slideFromBottom {
- 0% {
- top: 70%; }
- 100% {
- top: 50%; } }
-
-@keyframes slideFromBottom {
- 0% {
- top: 70%; }
- 100% {
- top: 50%; } }
-
-@-webkit-keyframes slideToBottom {
- 0% {
- top: 50%; }
- 100% {
- top: 70%; } }
-
-@keyframes slideToBottom {
- 0% {
- top: 50%; }
- 100% {
- top: 70%; } }
-
-.showSweetAlert[data-animation=pop] {
- -webkit-animation: showSweetAlert 0.3s;
- animation: showSweetAlert 0.3s; }
-
-.showSweetAlert[data-animation=none] {
- -webkit-animation: none;
- animation: none; }
-
-.showSweetAlert[data-animation=slide-from-top] {
- -webkit-animation: slideFromTop 0.3s;
- animation: slideFromTop 0.3s; }
-
-.showSweetAlert[data-animation=slide-from-bottom] {
- -webkit-animation: slideFromBottom 0.3s;
- animation: slideFromBottom 0.3s; }
-
-.hideSweetAlert[data-animation=pop] {
- -webkit-animation: hideSweetAlert 0.2s;
- animation: hideSweetAlert 0.2s; }
-
-.hideSweetAlert[data-animation=none] {
- -webkit-animation: none;
- animation: none; }
-
-.hideSweetAlert[data-animation=slide-from-top] {
- -webkit-animation: slideToTop 0.4s;
- animation: slideToTop 0.4s; }
-
-.hideSweetAlert[data-animation=slide-from-bottom] {
- -webkit-animation: slideToBottom 0.3s;
- animation: slideToBottom 0.3s; }
-
-@-webkit-keyframes animateSuccessTip {
- 0% {
- width: 0;
- left: 1px;
- top: 19px; }
- 54% {
- width: 0;
- left: 1px;
- top: 19px; }
- 70% {
- width: 50px;
- left: -8px;
- top: 37px; }
- 84% {
- width: 17px;
- left: 21px;
- top: 48px; }
- 100% {
- width: 25px;
- left: 14px;
- top: 45px; } }
-
-@keyframes animateSuccessTip {
- 0% {
- width: 0;
- left: 1px;
- top: 19px; }
- 54% {
- width: 0;
- left: 1px;
- top: 19px; }
- 70% {
- width: 50px;
- left: -8px;
- top: 37px; }
- 84% {
- width: 17px;
- left: 21px;
- top: 48px; }
- 100% {
- width: 25px;
- left: 14px;
- top: 45px; } }
-
-@-webkit-keyframes animateSuccessLong {
- 0% {
- width: 0;
- right: 46px;
- top: 54px; }
- 65% {
- width: 0;
- right: 46px;
- top: 54px; }
- 84% {
- width: 55px;
- right: 0px;
- top: 35px; }
- 100% {
- width: 47px;
- right: 8px;
- top: 38px; } }
-
-@keyframes animateSuccessLong {
- 0% {
- width: 0;
- right: 46px;
- top: 54px; }
- 65% {
- width: 0;
- right: 46px;
- top: 54px; }
- 84% {
- width: 55px;
- right: 0px;
- top: 35px; }
- 100% {
- width: 47px;
- right: 8px;
- top: 38px; } }
-
-@-webkit-keyframes rotatePlaceholder {
- 0% {
- transform: rotate(-45deg);
- -webkit-transform: rotate(-45deg); }
- 5% {
- transform: rotate(-45deg);
- -webkit-transform: rotate(-45deg); }
- 12% {
- transform: rotate(-405deg);
- -webkit-transform: rotate(-405deg); }
- 100% {
- transform: rotate(-405deg);
- -webkit-transform: rotate(-405deg); } }
-
-@keyframes rotatePlaceholder {
- 0% {
- transform: rotate(-45deg);
- -webkit-transform: rotate(-45deg); }
- 5% {
- transform: rotate(-45deg);
- -webkit-transform: rotate(-45deg); }
- 12% {
- transform: rotate(-405deg);
- -webkit-transform: rotate(-405deg); }
- 100% {
- transform: rotate(-405deg);
- -webkit-transform: rotate(-405deg); } }
-
-.animateSuccessTip {
- -webkit-animation: animateSuccessTip 0.75s;
- animation: animateSuccessTip 0.75s; }
-
-.animateSuccessLong {
- -webkit-animation: animateSuccessLong 0.75s;
- animation: animateSuccessLong 0.75s; }
-
-.sa-icon.sa-success.animate::after {
- -webkit-animation: rotatePlaceholder 4.25s ease-in;
- animation: rotatePlaceholder 4.25s ease-in; }
-
-@-webkit-keyframes animateErrorIcon {
- 0% {
- transform: rotateX(100deg);
- -webkit-transform: rotateX(100deg);
- opacity: 0; }
- 100% {
- transform: rotateX(0deg);
- -webkit-transform: rotateX(0deg);
- opacity: 1; } }
-
-@keyframes animateErrorIcon {
- 0% {
- transform: rotateX(100deg);
- -webkit-transform: rotateX(100deg);
- opacity: 0; }
- 100% {
- transform: rotateX(0deg);
- -webkit-transform: rotateX(0deg);
- opacity: 1; } }
-
-.animateErrorIcon {
- -webkit-animation: animateErrorIcon 0.5s;
- animation: animateErrorIcon 0.5s; }
-
-@-webkit-keyframes animateXMark {
- 0% {
- transform: scale(0.4);
- -webkit-transform: scale(0.4);
- margin-top: 26px;
- opacity: 0; }
- 50% {
- transform: scale(0.4);
- -webkit-transform: scale(0.4);
- margin-top: 26px;
- opacity: 0; }
- 80% {
- transform: scale(1.15);
- -webkit-transform: scale(1.15);
- margin-top: -6px; }
- 100% {
- transform: scale(1);
- -webkit-transform: scale(1);
- margin-top: 0;
- opacity: 1; } }
-
-@keyframes animateXMark {
- 0% {
- transform: scale(0.4);
- -webkit-transform: scale(0.4);
- margin-top: 26px;
- opacity: 0; }
- 50% {
- transform: scale(0.4);
- -webkit-transform: scale(0.4);
- margin-top: 26px;
- opacity: 0; }
- 80% {
- transform: scale(1.15);
- -webkit-transform: scale(1.15);
- margin-top: -6px; }
- 100% {
- transform: scale(1);
- -webkit-transform: scale(1);
- margin-top: 0;
- opacity: 1; } }
-
-.animateXMark {
- -webkit-animation: animateXMark 0.5s;
- animation: animateXMark 0.5s; }
-
-@-webkit-keyframes pulseWarning {
- 0% {
- border-color: #F8D486; }
- 100% {
- border-color: #F8BB86; } }
-
-@keyframes pulseWarning {
- 0% {
- border-color: #F8D486; }
- 100% {
- border-color: #F8BB86; } }
-
-.pulseWarning {
- -webkit-animation: pulseWarning 0.75s infinite alternate;
- animation: pulseWarning 0.75s infinite alternate; }
-
-@-webkit-keyframes pulseWarningIns {
- 0% {
- background-color: #F8D486; }
- 100% {
- background-color: #F8BB86; } }
-
-@keyframes pulseWarningIns {
- 0% {
- background-color: #F8D486; }
- 100% {
- background-color: #F8BB86; } }
-
-.pulseWarningIns {
- -webkit-animation: pulseWarningIns 0.75s infinite alternate;
- animation: pulseWarningIns 0.75s infinite alternate; }
-
-@-webkit-keyframes rotate-loading {
- 0% {
- transform: rotate(0deg); }
- 100% {
- transform: rotate(360deg); } }
-
-@keyframes rotate-loading {
- 0% {
- transform: rotate(0deg); }
- 100% {
- transform: rotate(360deg); } }
-
-/* Internet Explorer 9 has some special quirks that are fixed here */
-/* The icons are not animated. */
-/* This file is automatically merged into sweet-alert.min.js through Gulp */
-/* Error icon */
-.sweet-alert .sa-icon.sa-error .sa-line.sa-left {
- -ms-transform: rotate(45deg) \9; }
-
-.sweet-alert .sa-icon.sa-error .sa-line.sa-right {
- -ms-transform: rotate(-45deg) \9; }
-
-/* Success icon */
-.sweet-alert .sa-icon.sa-success {
- border-color: transparent\9; }
-
-.sweet-alert .sa-icon.sa-success .sa-line.sa-tip {
- -ms-transform: rotate(45deg) \9; }
-
-.sweet-alert .sa-icon.sa-success .sa-line.sa-long {
- -ms-transform: rotate(-45deg) \9; }
-
-/*!
- * Load Awesome v1.1.0 (http://github.danielcardoso.net/load-awesome/)
- * Copyright 2015 Daniel Cardoso <@DanielCardoso>
- * Licensed under MIT
- */
-.la-ball-fall,
-.la-ball-fall > div {
- position: relative;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box; }
-
-.la-ball-fall {
- display: block;
- font-size: 0;
- color: #fff; }
-
-.la-ball-fall.la-dark {
- color: #333; }
-
-.la-ball-fall > div {
- display: inline-block;
- float: none;
- background-color: currentColor;
- border: 0 solid currentColor; }
-
-.la-ball-fall {
- width: 54px;
- height: 18px; }
-
-.la-ball-fall > div {
- width: 10px;
- height: 10px;
- margin: 4px;
- border-radius: 100%;
- opacity: 0;
- -webkit-animation: ball-fall 1s ease-in-out infinite;
- -moz-animation: ball-fall 1s ease-in-out infinite;
- -o-animation: ball-fall 1s ease-in-out infinite;
- animation: ball-fall 1s ease-in-out infinite; }
-
-.la-ball-fall > div:nth-child(1) {
- -webkit-animation-delay: -200ms;
- -moz-animation-delay: -200ms;
- -o-animation-delay: -200ms;
- animation-delay: -200ms; }
-
-.la-ball-fall > div:nth-child(2) {
- -webkit-animation-delay: -100ms;
- -moz-animation-delay: -100ms;
- -o-animation-delay: -100ms;
- animation-delay: -100ms; }
-
-.la-ball-fall > div:nth-child(3) {
- -webkit-animation-delay: 0ms;
- -moz-animation-delay: 0ms;
- -o-animation-delay: 0ms;
- animation-delay: 0ms; }
-
-.la-ball-fall.la-sm {
- width: 26px;
- height: 8px; }
-
-.la-ball-fall.la-sm > div {
- width: 4px;
- height: 4px;
- margin: 2px; }
-
-.la-ball-fall.la-2x {
- width: 108px;
- height: 36px; }
-
-.la-ball-fall.la-2x > div {
- width: 20px;
- height: 20px;
- margin: 8px; }
-
-.la-ball-fall.la-3x {
- width: 162px;
- height: 54px; }
-
-.la-ball-fall.la-3x > div {
- width: 30px;
- height: 30px;
- margin: 12px; }
-
-/*
- * Animation
- */
-@-webkit-keyframes ball-fall {
- 0% {
- opacity: 0;
- -webkit-transform: translateY(-145%);
- transform: translateY(-145%); }
- 10% {
- opacity: .5; }
- 20% {
- opacity: 1;
- -webkit-transform: translateY(0);
- transform: translateY(0); }
- 80% {
- opacity: 1;
- -webkit-transform: translateY(0);
- transform: translateY(0); }
- 90% {
- opacity: .5; }
- 100% {
- opacity: 0;
- -webkit-transform: translateY(145%);
- transform: translateY(145%); } }
-
-@-moz-keyframes ball-fall {
- 0% {
- opacity: 0;
- -moz-transform: translateY(-145%);
- transform: translateY(-145%); }
- 10% {
- opacity: .5; }
- 20% {
- opacity: 1;
- -moz-transform: translateY(0);
- transform: translateY(0); }
- 80% {
- opacity: 1;
- -moz-transform: translateY(0);
- transform: translateY(0); }
- 90% {
- opacity: .5; }
- 100% {
- opacity: 0;
- -moz-transform: translateY(145%);
- transform: translateY(145%); } }
-
-@-o-keyframes ball-fall {
- 0% {
- opacity: 0;
- -o-transform: translateY(-145%);
- transform: translateY(-145%); }
- 10% {
- opacity: .5; }
- 20% {
- opacity: 1;
- -o-transform: translateY(0);
- transform: translateY(0); }
- 80% {
- opacity: 1;
- -o-transform: translateY(0);
- transform: translateY(0); }
- 90% {
- opacity: .5; }
- 100% {
- opacity: 0;
- -o-transform: translateY(145%);
- transform: translateY(145%); } }
-
-@keyframes ball-fall {
- 0% {
- opacity: 0;
- -webkit-transform: translateY(-145%);
- -moz-transform: translateY(-145%);
- -o-transform: translateY(-145%);
- transform: translateY(-145%); }
- 10% {
- opacity: .5; }
- 20% {
- opacity: 1;
- -webkit-transform: translateY(0);
- -moz-transform: translateY(0);
- -o-transform: translateY(0);
- transform: translateY(0); }
- 80% {
- opacity: 1;
- -webkit-transform: translateY(0);
- -moz-transform: translateY(0);
- -o-transform: translateY(0);
- transform: translateY(0); }
- 90% {
- opacity: .5; }
- 100% {
- opacity: 0;
- -webkit-transform: translateY(145%);
- -moz-transform: translateY(145%);
- -o-transform: translateY(145%);
- transform: translateY(145%); } }
diff --git a/common/lib/keyring.js b/common/lib/keyring.js
index 6b35b72..a785aed 100755
--- a/common/lib/keyring.js
+++ b/common/lib/keyring.js
@@ -238,23 +238,6 @@ define(function(require, exports, module) {
return result;
}
-/*
- function getKeyType(algorithm) {
- var result;
- switch (algorithm) {
- case "RSA/RSA":
- result = openpgp.enums.publicKey.rsa_encrypt_sign;
- break;
- case "DSA/ElGamal":
- result = openpgp.enums.publicKey.dsa;
- break;
- default:
- throw new Error('Key type not supported');
- }
- return result;
- }
-*/
-
Keyring.prototype.getKeyDetails = function(guid) {
var details = {};
var keys = this.keyring.getKeysForId(guid);
@@ -656,8 +639,7 @@ define(function(require, exports, module) {
options.userIds = options.userIds.map(function(userId) {
return (new goog.format.EmailAddress(userId.email, userId.fullName)).toString();
});
- var userId = options.userIds[0];
- openpgp.generateKeyPair({numBits: parseInt(options.numBits), userId: userId, passphrase: options.passphrase}).then(function(data) {
+ openpgp.generateKey({numBits: parseInt(options.numBits), userIds: options.userIds, passphrase: options.passphrase}).then(function(data) {
if (data) {
that.keyring.privateKeys.push(data.key);
that.sync.add(data.key.primaryKey.getFingerprint(), keyringSync.INSERT);
diff --git a/common/lib/pgpModel.js b/common/lib/pgpModel.js
index c06693d..68b1ea0 100755
--- a/common/lib/pgpModel.js
+++ b/common/lib/pgpModel.js
@@ -28,7 +28,7 @@ define(function(require, exports, module) {
function initOpenPGP() {
openpgp.config.commentstring = 'https://subutai.io/';
openpgp.config.versionstring = 'Subutai v' + defaults.getVersion();
- openpgp.initWorker('dep/openpgp.worker.js');
+ openpgp.initWorker('openpgp.worker.js');
}
exports.init = init;
@@ -128,7 +128,15 @@ define(function(require, exports, module) {
}
function unlockKey(privKey, keyid, passwd, callback) {
- return openpgp.getWorker().decryptKeyPacket(privKey, [openpgp.Keyid.fromId(keyid)], passwd);
+ return openpgp.decryptKey({privateKey: privKey, passphrase: passwd})
+ .then(result => result.key)
+ .catch(e => {
+ if (/Invalid passphrase/.test(e.message)) {
+ porto.util.throwError('Could not unlock key: wrong password', 'WRONG_PASSWORD');
+ } else {
+ porto.util.throwError('Error in openpgp.decryptKey');
+ }
+ });
}
function decryptMessage(message, keyringId, callback) {
@@ -136,7 +144,9 @@ define(function(require, exports, module) {
var keyRing = keyring.getById(keyringId);
var signingKeys = keyRing.getKeyByAddress([message.options.senderAddress], {validity: true});
signingKeys = signingKeys[message.options.senderAddress] || [message.key];
- openpgp.getWorker().decryptAndVerifyMessage(message.key, signingKeys, message.message).then(function(result) {
+
+ openpgp.decrypt({message: message.message, privateKey: message.key, publicKeys: signingKeys})
+ .then(result => {
result.signatures = result.signatures.map(function(signature) {
signature.keyid = signature.keyid.toHex();
if (signature.valid !== null) {
@@ -146,7 +156,7 @@ define(function(require, exports, module) {
return signature;
});
callback(null, result);
- }, callback);
+ });
} else {
openpgp.getWorker().decryptMessage(message.key, message.message).then(function(result) {
callback(null, {text: result});
@@ -176,17 +186,18 @@ define(function(require, exports, module) {
message: 'No key found for encryption'
});
} else {
- openpgp.getWorker().encryptMessage(keys, options.message)
- .then(function(msg) {
- resolve(msg);
- })
- .catch(function(e) {
- console.log('openpgp.getWorker().encryptMessage() error', e);
- reject({
- type: 'error',
- message: l10n('encrypt_error', [e])
- });
- });
+ openpgp.encrypt({data: options.message, publicKeys: keys})
+ .then(msg => {
+ // logEncryption(uiLogSource, keys);
+ return msg.data;
+ })
+ .catch(e => {
+ console.log('openpgp.encrypt() error', e);
+ throw {
+ code: 'ENCRYPT_ERROR',
+ message: l10n('encrypt_error', [e])
+ };
+ });
}
});
}
@@ -237,23 +248,22 @@ define(function(require, exports, module) {
}).filter(function(key) {
return key !== null;
});
- try {
- var verified = message.verify(keys);
- signers = signers.map(function(signer) {
- signer.valid = signer.key && verified.some(function(verifiedSig) {
- return signer.keyid === verifiedSig.keyid.toHex() && verifiedSig.valid;
- });
+ openpgp.verify({message, publicKeys: keys})
+ .then((signatures) => {
+ signers = signers.map(signer => {
+ signer.valid = signer.key && signatures.some(verifiedSig => signer.keyid === verifiedSig.keyid.toHex() && verifiedSig.valid);
// remove key object
delete signer.key;
return signer;
});
callback(null, signers);
- } catch (e) {
+ })
+ .catch(e => {
callback({
type: 'error',
message: l10n('verify_error', [e])
});
- }
+ });
}
/**
@@ -262,12 +272,8 @@ define(function(require, exports, module) {
* @return {Promise
window
)
+ * @param {Object} foreign - ignored
+ * @param {ArrayBuffer} buffer - heap buffer to link with
+ */
+ var wrapper = function ( stdlib, foreign, buffer ) {
+ // Init AES stuff for the first time
+ if ( !aes_init_done ) aes_init();
+
+ // Fill up AES tables
+ var heap = new Uint32Array(buffer);
+ heap.set( aes_sbox, 0x0800>>2 );
+ heap.set( aes_sinv, 0x0c00>>2 );
+ for ( var i = 0; i < 4; i++ ) {
+ heap.set( aes_enc[i], ( 0x1000 + 0x400 * i )>>2 );
+ heap.set( aes_dec[i], ( 0x2000 + 0x400 * i )>>2 );
+ }
- for (var i = 0; i < subscribers.length; i += 3) {
- child = subscribers[i];
- callback = subscribers[i + settled];
+ /**
+ * Calculate AES key schedules.
+ * @instance
+ * @memberof AES_asm
+ * @param {int} ks - key size, 4/6/8 (for 128/192/256-bit key correspondingly)
+ * @param {int} k0..k7 - key vector components
+ */
+ function set_key ( ks, k0, k1, k2, k3, k4, k5, k6, k7 ) {
+ var ekeys = heap.subarray( 0x000, 60 ),
+ dkeys = heap.subarray( 0x100, 0x100+60 );
+
+ // Encryption key schedule
+ ekeys.set( [ k0, k1, k2, k3, k4, k5, k6, k7 ] );
+ for ( var i = ks, rcon = 1; i < 4*ks+28; i++ ) {
+ var k = ekeys[i-1];
+ if ( ( i % ks === 0 ) || ( ks === 8 && i % ks === 4 ) ) {
+ k = aes_sbox[k>>>24]<<24 ^ aes_sbox[k>>>16&255]<<16 ^ aes_sbox[k>>>8&255]<<8 ^ aes_sbox[k&255];
+ }
+ if ( i % ks === 0 ) {
+ k = (k << 8) ^ (k >>> 24) ^ (rcon << 24);
+ rcon = (rcon << 1) ^ ( (rcon & 0x80) ? 0x1b : 0 );
+ }
+ ekeys[i] = ekeys[i-ks] ^ k;
+ }
- invokeCallback(settled, child, callback, detail);
- }
+ // Decryption key schedule
+ for ( var j = 0; j < i; j += 4 ) {
+ for ( var jj = 0; jj < 4; jj++ ) {
+ var k = ekeys[i-(4+j)+(4-jj)%4];
+ if ( j < 4 || j >= i-4 ) {
+ dkeys[j+jj] = k;
+ } else {
+ dkeys[j+jj] = aes_dec[0][aes_sbox[k>>>24]]
+ ^ aes_dec[1][aes_sbox[k>>>16&255]]
+ ^ aes_dec[2][aes_sbox[k>>>8&255]]
+ ^ aes_dec[3][aes_sbox[k&255]];
+ }
+ }
+ }
- promise._subscribers = null;
-}
+ // Set rounds number
+ asm.set_rounds( ks + 5 );
+ }
-Promise.prototype = {
- constructor: Promise,
+ var asm = function ( stdlib, foreign, buffer ) {
+ "use asm";
+
+ var S0 = 0, S1 = 0, S2 = 0, S3 = 0,
+ I0 = 0, I1 = 0, I2 = 0, I3 = 0,
+ N0 = 0, N1 = 0, N2 = 0, N3 = 0,
+ M0 = 0, M1 = 0, M2 = 0, M3 = 0,
+ H0 = 0, H1 = 0, H2 = 0, H3 = 0,
+ R = 0;
+
+ var HEAP = new stdlib.Uint32Array(buffer),
+ DATA = new stdlib.Uint8Array(buffer);
+
+ /**
+ * AES core
+ * @param {int} k - precomputed key schedule offset
+ * @param {int} s - precomputed sbox table offset
+ * @param {int} t - precomputed round table offset
+ * @param {int} r - number of inner rounds to perform
+ * @param {int} x0..x3 - 128-bit input block vector
+ */
+ function _core ( k, s, t, r, x0, x1, x2, x3 ) {
+ k = k|0;
+ s = s|0;
+ t = t|0;
+ r = r|0;
+ x0 = x0|0;
+ x1 = x1|0;
+ x2 = x2|0;
+ x3 = x3|0;
+
+ var t1 = 0, t2 = 0, t3 = 0,
+ y0 = 0, y1 = 0, y2 = 0, y3 = 0,
+ i = 0;
+
+ t1 = t|0x400, t2 = t|0x800, t3 = t|0xc00;
+
+ // round 0
+ x0 = x0 ^ HEAP[(k|0)>>2],
+ x1 = x1 ^ HEAP[(k|4)>>2],
+ x2 = x2 ^ HEAP[(k|8)>>2],
+ x3 = x3 ^ HEAP[(k|12)>>2];
+
+ // round 1..r
+ for ( i = 16; (i|0) <= (r<<4); i = (i+16)|0 ) {
+ y0 = HEAP[(t|x0>>22&1020)>>2] ^ HEAP[(t1|x1>>14&1020)>>2] ^ HEAP[(t2|x2>>6&1020)>>2] ^ HEAP[(t3|x3<<2&1020)>>2] ^ HEAP[(k|i|0)>>2],
+ y1 = HEAP[(t|x1>>22&1020)>>2] ^ HEAP[(t1|x2>>14&1020)>>2] ^ HEAP[(t2|x3>>6&1020)>>2] ^ HEAP[(t3|x0<<2&1020)>>2] ^ HEAP[(k|i|4)>>2],
+ y2 = HEAP[(t|x2>>22&1020)>>2] ^ HEAP[(t1|x3>>14&1020)>>2] ^ HEAP[(t2|x0>>6&1020)>>2] ^ HEAP[(t3|x1<<2&1020)>>2] ^ HEAP[(k|i|8)>>2],
+ y3 = HEAP[(t|x3>>22&1020)>>2] ^ HEAP[(t1|x0>>14&1020)>>2] ^ HEAP[(t2|x1>>6&1020)>>2] ^ HEAP[(t3|x2<<2&1020)>>2] ^ HEAP[(k|i|12)>>2];
+ x0 = y0, x1 = y1, x2 = y2, x3 = y3;
+ }
- _state: undefined,
- _detail: undefined,
- _subscribers: undefined,
+ // final round
+ S0 = HEAP[(s|x0>>22&1020)>>2]<<24 ^ HEAP[(s|x1>>14&1020)>>2]<<16 ^ HEAP[(s|x2>>6&1020)>>2]<<8 ^ HEAP[(s|x3<<2&1020)>>2] ^ HEAP[(k|i|0)>>2],
+ S1 = HEAP[(s|x1>>22&1020)>>2]<<24 ^ HEAP[(s|x2>>14&1020)>>2]<<16 ^ HEAP[(s|x3>>6&1020)>>2]<<8 ^ HEAP[(s|x0<<2&1020)>>2] ^ HEAP[(k|i|4)>>2],
+ S2 = HEAP[(s|x2>>22&1020)>>2]<<24 ^ HEAP[(s|x3>>14&1020)>>2]<<16 ^ HEAP[(s|x0>>6&1020)>>2]<<8 ^ HEAP[(s|x1<<2&1020)>>2] ^ HEAP[(k|i|8)>>2],
+ S3 = HEAP[(s|x3>>22&1020)>>2]<<24 ^ HEAP[(s|x0>>14&1020)>>2]<<16 ^ HEAP[(s|x1>>6&1020)>>2]<<8 ^ HEAP[(s|x2<<2&1020)>>2] ^ HEAP[(k|i|12)>>2];
+ }
- then: function(onFulfillment, onRejection) {
- var promise = this;
+ /**
+ * ECB mode encryption
+ * @param {int} x0..x3 - 128-bit input block vector
+ */
+ function _ecb_enc ( x0, x1, x2, x3 ) {
+ x0 = x0|0;
+ x1 = x1|0;
+ x2 = x2|0;
+ x3 = x3|0;
+
+ _core(
+ 0x0000, 0x0800, 0x1000,
+ R,
+ x0,
+ x1,
+ x2,
+ x3
+ );
+ }
- var thenPromise = new this.constructor(function() {});
+ /**
+ * ECB mode decryption
+ * @param {int} x0..x3 - 128-bit input block vector
+ */
+ function _ecb_dec ( x0, x1, x2, x3 ) {
+ x0 = x0|0;
+ x1 = x1|0;
+ x2 = x2|0;
+ x3 = x3|0;
+
+ var t = 0;
+
+ _core(
+ 0x0400, 0x0c00, 0x2000,
+ R,
+ x0,
+ x3,
+ x2,
+ x1
+ );
+
+ t = S1, S1 = S3, S3 = t;
+ }
- if (this._state) {
- var callbacks = arguments;
- config.async(function invokePromiseCallback() {
- invokeCallback(promise._state, thenPromise, callbacks[promise._state - 1], promise._detail);
- });
- } else {
- subscribe(this, thenPromise, onFulfillment, onRejection);
- }
- return thenPromise;
- },
+ /**
+ * CBC mode encryption
+ * @param {int} x0..x3 - 128-bit input block vector
+ */
+ function _cbc_enc ( x0, x1, x2, x3 ) {
+ x0 = x0|0;
+ x1 = x1|0;
+ x2 = x2|0;
+ x3 = x3|0;
+
+ _core(
+ 0x0000, 0x0800, 0x1000,
+ R,
+ I0 ^ x0,
+ I1 ^ x1,
+ I2 ^ x2,
+ I3 ^ x3
+ );
+
+ I0 = S0,
+ I1 = S1,
+ I2 = S2,
+ I3 = S3;
+ }
- 'catch': function(onRejection) {
- return this.then(null, onRejection);
- }
-};
+ /**
+ * CBC mode decryption
+ * @param {int} x0..x3 - 128-bit input block vector
+ */
+ function _cbc_dec ( x0, x1, x2, x3 ) {
+ x0 = x0|0;
+ x1 = x1|0;
+ x2 = x2|0;
+ x3 = x3|0;
+
+ var t = 0;
+
+ _core(
+ 0x0400, 0x0c00, 0x2000,
+ R,
+ x0,
+ x3,
+ x2,
+ x1
+ );
+
+ t = S1, S1 = S3, S3 = t;
+
+ S0 = S0 ^ I0,
+ S1 = S1 ^ I1,
+ S2 = S2 ^ I2,
+ S3 = S3 ^ I3;
+
+ I0 = x0,
+ I1 = x1,
+ I2 = x2,
+ I3 = x3;
+ }
-Promise.all = all;
-Promise.race = race;
-Promise.resolve = staticResolve;
-Promise.reject = staticReject;
+ /**
+ * CFB mode encryption
+ * @param {int} x0..x3 - 128-bit input block vector
+ */
+ function _cfb_enc ( x0, x1, x2, x3 ) {
+ x0 = x0|0;
+ x1 = x1|0;
+ x2 = x2|0;
+ x3 = x3|0;
+
+ _core(
+ 0x0000, 0x0800, 0x1000,
+ R,
+ I0,
+ I1,
+ I2,
+ I3
+ );
+
+ I0 = S0 = S0 ^ x0,
+ I1 = S1 = S1 ^ x1,
+ I2 = S2 = S2 ^ x2,
+ I3 = S3 = S3 ^ x3;
+ }
-function handleThenable(promise, value) {
- var then = null,
- resolved;
- try {
- if (promise === value) {
- throw new TypeError("A promises callback cannot return that same promise.");
- }
+ /**
+ * CFB mode decryption
+ * @param {int} x0..x3 - 128-bit input block vector
+ */
+ function _cfb_dec ( x0, x1, x2, x3 ) {
+ x0 = x0|0;
+ x1 = x1|0;
+ x2 = x2|0;
+ x3 = x3|0;
+
+ _core(
+ 0x0000, 0x0800, 0x1000,
+ R,
+ I0,
+ I1,
+ I2,
+ I3
+ );
+
+ S0 = S0 ^ x0,
+ S1 = S1 ^ x1,
+ S2 = S2 ^ x2,
+ S3 = S3 ^ x3;
+
+ I0 = x0,
+ I1 = x1,
+ I2 = x2,
+ I3 = x3;
+ }
- if (objectOrFunction(value)) {
- then = value.then;
+ /**
+ * OFB mode encryption / decryption
+ * @param {int} x0..x3 - 128-bit input block vector
+ */
+ function _ofb ( x0, x1, x2, x3 ) {
+ x0 = x0|0;
+ x1 = x1|0;
+ x2 = x2|0;
+ x3 = x3|0;
+
+ _core(
+ 0x0000, 0x0800, 0x1000,
+ R,
+ I0,
+ I1,
+ I2,
+ I3
+ );
+
+ I0 = S0,
+ I1 = S1,
+ I2 = S2,
+ I3 = S3;
+
+ S0 = S0 ^ x0,
+ S1 = S1 ^ x1,
+ S2 = S2 ^ x2,
+ S3 = S3 ^ x3;
+ }
- if (isFunction(then)) {
- then.call(value, function(val) {
- if (resolved) { return true; }
- resolved = true;
+ /**
+ * CTR mode encryption / decryption
+ * @param {int} x0..x3 - 128-bit input block vector
+ */
+ function _ctr ( x0, x1, x2, x3 ) {
+ x0 = x0|0;
+ x1 = x1|0;
+ x2 = x2|0;
+ x3 = x3|0;
+
+ _core(
+ 0x0000, 0x0800, 0x1000,
+ R,
+ N0,
+ N1,
+ N2,
+ N3
+ );
+
+ N3 = ( ~M3 & N3 ) | M3 & ( N3 + 1 ),
+ N2 = ( ~M2 & N2 ) | M2 & ( N2 + ( (N3|0) == 0 ) ),
+ N1 = ( ~M1 & N1 ) | M1 & ( N1 + ( (N2|0) == 0 ) ),
+ N0 = ( ~M0 & N0 ) | M0 & ( N0 + ( (N1|0) == 0 ) );
+
+ S0 = S0 ^ x0,
+ S1 = S1 ^ x1,
+ S2 = S2 ^ x2,
+ S3 = S3 ^ x3;
+ }
- if (value !== val) {
- resolve(promise, val);
- } else {
- fulfill(promise, val);
- }
- }, function(val) {
- if (resolved) { return true; }
- resolved = true;
+ /**
+ * GCM mode MAC calculation
+ * @param {int} x0..x3 - 128-bit input block vector
+ */
+ function _gcm_mac ( x0, x1, x2, x3 ) {
+ x0 = x0|0;
+ x1 = x1|0;
+ x2 = x2|0;
+ x3 = x3|0;
+
+ var y0 = 0, y1 = 0, y2 = 0, y3 = 0,
+ z0 = 0, z1 = 0, z2 = 0, z3 = 0,
+ i = 0, c = 0;
+
+ x0 = x0 ^ I0,
+ x1 = x1 ^ I1,
+ x2 = x2 ^ I2,
+ x3 = x3 ^ I3;
+
+ y0 = H0|0,
+ y1 = H1|0,
+ y2 = H2|0,
+ y3 = H3|0;
+
+ for ( ; (i|0) < 128; i = (i + 1)|0 ) {
+ if ( y0 >>> 31 ) {
+ z0 = z0 ^ x0,
+ z1 = z1 ^ x1,
+ z2 = z2 ^ x2,
+ z3 = z3 ^ x3;
+ }
+
+ y0 = (y0 << 1) | (y1 >>> 31),
+ y1 = (y1 << 1) | (y2 >>> 31),
+ y2 = (y2 << 1) | (y3 >>> 31),
+ y3 = (y3 << 1);
+
+ c = x3 & 1;
+
+ x3 = (x3 >>> 1) | (x2 << 31),
+ x2 = (x2 >>> 1) | (x1 << 31),
+ x1 = (x1 >>> 1) | (x0 << 31),
+ x0 = (x0 >>> 1);
+
+ if ( c ) x0 = x0 ^ 0xe1000000;
+ }
- reject(promise, val);
- });
+ I0 = z0,
+ I1 = z1,
+ I2 = z2,
+ I3 = z3;
+ }
- return true;
- }
- }
- } catch (error) {
- if (resolved) { return true; }
- reject(promise, error);
- return true;
- }
+ /**
+ * Set the internal rounds number.
+ * @instance
+ * @memberof AES_asm
+ * @param {int} r - number if inner AES rounds
+ */
+ function set_rounds ( r ) {
+ r = r|0;
+ R = r;
+ }
- return false;
-}
+ /**
+ * Populate the internal state of the module.
+ * @instance
+ * @memberof AES_asm
+ * @param {int} s0...s3 - state vector
+ */
+ function set_state ( s0, s1, s2, s3 ) {
+ s0 = s0|0;
+ s1 = s1|0;
+ s2 = s2|0;
+ s3 = s3|0;
+
+ S0 = s0,
+ S1 = s1,
+ S2 = s2,
+ S3 = s3;
+ }
-function resolve(promise, value) {
- if (promise === value) {
- fulfill(promise, value);
- } else if (!handleThenable(promise, value)) {
- fulfill(promise, value);
- }
-}
+ /**
+ * Populate the internal iv of the module.
+ * @instance
+ * @memberof AES_asm
+ * @param {int} i0...i3 - iv vector
+ */
+ function set_iv ( i0, i1, i2, i3 ) {
+ i0 = i0|0;
+ i1 = i1|0;
+ i2 = i2|0;
+ i3 = i3|0;
+
+ I0 = i0,
+ I1 = i1,
+ I2 = i2,
+ I3 = i3;
+ }
-function fulfill(promise, value) {
- if (promise._state !== PENDING) { return; }
- promise._state = SEALED;
- promise._detail = value;
+ /**
+ * Set nonce for CTR-family modes.
+ * @instance
+ * @memberof AES_asm
+ * @param {int} n0..n3 - nonce vector
+ */
+ function set_nonce ( n0, n1, n2, n3 ) {
+ n0 = n0|0;
+ n1 = n1|0;
+ n2 = n2|0;
+ n3 = n3|0;
+
+ N0 = n0,
+ N1 = n1,
+ N2 = n2,
+ N3 = n3;
+ }
- config.async(publishFulfillment, promise);
-}
+ /**
+ * Set counter mask for CTR-family modes.
+ * @instance
+ * @memberof AES_asm
+ * @param {int} m0...m3 - counter mask vector
+ */
+ function set_mask ( m0, m1, m2, m3 ) {
+ m0 = m0|0;
+ m1 = m1|0;
+ m2 = m2|0;
+ m3 = m3|0;
+
+ M0 = m0,
+ M1 = m1,
+ M2 = m2,
+ M3 = m3;
+ }
-function reject(promise, reason) {
- if (promise._state !== PENDING) { return; }
- promise._state = SEALED;
- promise._detail = reason;
+ /**
+ * Set counter for CTR-family modes.
+ * @instance
+ * @memberof AES_asm
+ * @param {int} c0...c3 - counter vector
+ */
+ function set_counter ( c0, c1, c2, c3 ) {
+ c0 = c0|0;
+ c1 = c1|0;
+ c2 = c2|0;
+ c3 = c3|0;
+
+ N3 = ( ~M3 & N3 ) | M3 & c3,
+ N2 = ( ~M2 & N2 ) | M2 & c2,
+ N1 = ( ~M1 & N1 ) | M1 & c1,
+ N0 = ( ~M0 & N0 ) | M0 & c0;
+ }
- config.async(publishRejection, promise);
-}
+ /**
+ * Store the internal state vector into the heap.
+ * @instance
+ * @memberof AES_asm
+ * @param {int} pos - offset where to put the data
+ * @return {int} The number of bytes have been written into the heap, always 16.
+ */
+ function get_state ( pos ) {
+ pos = pos|0;
+
+ if ( pos & 15 ) return -1;
+
+ DATA[pos|0] = S0>>>24,
+ DATA[pos|1] = S0>>>16&255,
+ DATA[pos|2] = S0>>>8&255,
+ DATA[pos|3] = S0&255,
+ DATA[pos|4] = S1>>>24,
+ DATA[pos|5] = S1>>>16&255,
+ DATA[pos|6] = S1>>>8&255,
+ DATA[pos|7] = S1&255,
+ DATA[pos|8] = S2>>>24,
+ DATA[pos|9] = S2>>>16&255,
+ DATA[pos|10] = S2>>>8&255,
+ DATA[pos|11] = S2&255,
+ DATA[pos|12] = S3>>>24,
+ DATA[pos|13] = S3>>>16&255,
+ DATA[pos|14] = S3>>>8&255,
+ DATA[pos|15] = S3&255;
+
+ return 16;
+ }
-function publishFulfillment(promise) {
- publish(promise, promise._state = FULFILLED);
-}
+ /**
+ * Store the internal iv vector into the heap.
+ * @instance
+ * @memberof AES_asm
+ * @param {int} pos - offset where to put the data
+ * @return {int} The number of bytes have been written into the heap, always 16.
+ */
+ function get_iv ( pos ) {
+ pos = pos|0;
+
+ if ( pos & 15 ) return -1;
+
+ DATA[pos|0] = I0>>>24,
+ DATA[pos|1] = I0>>>16&255,
+ DATA[pos|2] = I0>>>8&255,
+ DATA[pos|3] = I0&255,
+ DATA[pos|4] = I1>>>24,
+ DATA[pos|5] = I1>>>16&255,
+ DATA[pos|6] = I1>>>8&255,
+ DATA[pos|7] = I1&255,
+ DATA[pos|8] = I2>>>24,
+ DATA[pos|9] = I2>>>16&255,
+ DATA[pos|10] = I2>>>8&255,
+ DATA[pos|11] = I2&255,
+ DATA[pos|12] = I3>>>24,
+ DATA[pos|13] = I3>>>16&255,
+ DATA[pos|14] = I3>>>8&255,
+ DATA[pos|15] = I3&255;
+
+ return 16;
+ }
-function publishRejection(promise) {
- publish(promise, promise._state = REJECTED);
-}
+ /**
+ * GCM initialization.
+ * @instance
+ * @memberof AES_asm
+ */
+ function gcm_init ( ) {
+ _ecb_enc( 0, 0, 0, 0 );
+ H0 = S0,
+ H1 = S1,
+ H2 = S2,
+ H3 = S3;
+ }
-exports.Promise = Promise;
-},{"./all":2,"./asap":3,"./config":4,"./race":7,"./reject":8,"./resolve":9,"./utils":10}],7:[function(require,module,exports){
-"use strict";
-/* global toString */
-var isArray = require("./utils").isArray;
+ /**
+ * Perform ciphering operation on the supplied data.
+ * @instance
+ * @memberof AES_asm
+ * @param {int} mode - block cipher mode (see {@link AES_asm} mode constants)
+ * @param {int} pos - offset of the data being processed
+ * @param {int} len - length of the data being processed
+ * @return {int} Actual amount of data have been processed.
+ */
+ function cipher ( mode, pos, len ) {
+ mode = mode|0;
+ pos = pos|0;
+ len = len|0;
+
+ var ret = 0;
+
+ if ( pos & 15 ) return -1;
+
+ while ( (len|0) >= 16 ) {
+ _cipher_modes[mode&7](
+ DATA[pos|0]<<24 | DATA[pos|1]<<16 | DATA[pos|2]<<8 | DATA[pos|3],
+ DATA[pos|4]<<24 | DATA[pos|5]<<16 | DATA[pos|6]<<8 | DATA[pos|7],
+ DATA[pos|8]<<24 | DATA[pos|9]<<16 | DATA[pos|10]<<8 | DATA[pos|11],
+ DATA[pos|12]<<24 | DATA[pos|13]<<16 | DATA[pos|14]<<8 | DATA[pos|15]
+ );
+
+ DATA[pos|0] = S0>>>24,
+ DATA[pos|1] = S0>>>16&255,
+ DATA[pos|2] = S0>>>8&255,
+ DATA[pos|3] = S0&255,
+ DATA[pos|4] = S1>>>24,
+ DATA[pos|5] = S1>>>16&255,
+ DATA[pos|6] = S1>>>8&255,
+ DATA[pos|7] = S1&255,
+ DATA[pos|8] = S2>>>24,
+ DATA[pos|9] = S2>>>16&255,
+ DATA[pos|10] = S2>>>8&255,
+ DATA[pos|11] = S2&255,
+ DATA[pos|12] = S3>>>24,
+ DATA[pos|13] = S3>>>16&255,
+ DATA[pos|14] = S3>>>8&255,
+ DATA[pos|15] = S3&255;
+
+ ret = (ret + 16)|0,
+ pos = (pos + 16)|0,
+ len = (len - 16)|0;
+ }
-/**
- `RSVP.race` allows you to watch a series of promises and act as soon as the
- first promise given to the `promises` argument fulfills or rejects.
+ return ret|0;
+ }
- Example:
+ /**
+ * Calculates MAC of the supplied data.
+ * @instance
+ * @memberof AES_asm
+ * @param {int} mode - block cipher mode (see {@link AES_asm} mode constants)
+ * @param {int} pos - offset of the data being processed
+ * @param {int} len - length of the data being processed
+ * @return {int} Actual amount of data have been processed.
+ */
+ function mac ( mode, pos, len ) {
+ mode = mode|0;
+ pos = pos|0;
+ len = len|0;
+
+ var ret = 0;
+
+ if ( pos & 15 ) return -1;
+
+ while ( (len|0) >= 16 ) {
+ _mac_modes[mode&1](
+ DATA[pos|0]<<24 | DATA[pos|1]<<16 | DATA[pos|2]<<8 | DATA[pos|3],
+ DATA[pos|4]<<24 | DATA[pos|5]<<16 | DATA[pos|6]<<8 | DATA[pos|7],
+ DATA[pos|8]<<24 | DATA[pos|9]<<16 | DATA[pos|10]<<8 | DATA[pos|11],
+ DATA[pos|12]<<24 | DATA[pos|13]<<16 | DATA[pos|14]<<8 | DATA[pos|15]
+ );
+
+ ret = (ret + 16)|0,
+ pos = (pos + 16)|0,
+ len = (len - 16)|0;
+ }
- ```javascript
- var promise1 = new RSVP.Promise(function(resolve, reject){
- setTimeout(function(){
- resolve("promise 1");
- }, 200);
- });
+ return ret|0;
+ }
- var promise2 = new RSVP.Promise(function(resolve, reject){
- setTimeout(function(){
- resolve("promise 2");
- }, 100);
- });
+ /**
+ * AES cipher modes table (virual methods)
+ */
+ var _cipher_modes = [ _ecb_enc, _ecb_dec, _cbc_enc, _cbc_dec, _cfb_enc, _cfb_dec, _ofb, _ctr ];
+
+ /**
+ * AES MAC modes table (virual methods)
+ */
+ var _mac_modes = [ _cbc_enc, _gcm_mac ];
+
+ /**
+ * Asm.js module exports
+ */
+ return {
+ set_rounds: set_rounds,
+ set_state: set_state,
+ set_iv: set_iv,
+ set_nonce: set_nonce,
+ set_mask: set_mask,
+ set_counter:set_counter,
+ get_state: get_state,
+ get_iv: get_iv,
+ gcm_init: gcm_init,
+ cipher: cipher,
+ mac: mac
+ };
+ }( stdlib, foreign, buffer );
+
+ asm.set_key = set_key;
+
+ return asm;
+ };
- RSVP.race([promise1, promise2]).then(function(result){
- // result === "promise 2" because it was resolved before promise1
- // was resolved.
- });
- ```
+ /**
+ * AES enciphering mode constants
+ * @enum {int}
+ * @const
+ */
+ wrapper.ENC = {
+ ECB: 0,
+ CBC: 2,
+ CFB: 4,
+ OFB: 6,
+ CTR: 7
+ },
- `RSVP.race` is deterministic in that only the state of the first completed
- promise matters. For example, even if other promises given to the `promises`
- array argument are resolved, but the first completed promise has become
- rejected before the other promises became fulfilled, the returned promise
- will become rejected:
+ /**
+ * AES deciphering mode constants
+ * @enum {int}
+ * @const
+ */
+ wrapper.DEC = {
+ ECB: 1,
+ CBC: 3,
+ CFB: 5,
+ OFB: 6,
+ CTR: 7
+ },
- ```javascript
- var promise1 = new RSVP.Promise(function(resolve, reject){
- setTimeout(function(){
- resolve("promise 1");
- }, 200);
- });
+ /**
+ * AES MAC mode constants
+ * @enum {int}
+ * @const
+ */
+ wrapper.MAC = {
+ CBC: 0,
+ GCM: 1
+ };
- var promise2 = new RSVP.Promise(function(resolve, reject){
- setTimeout(function(){
- reject(new Error("promise 2"));
- }, 100);
- });
+ /**
+ * Heap data offset
+ * @type {int}
+ * @const
+ */
+ wrapper.HEAP_DATA = 0x4000;
- RSVP.race([promise1, promise2]).then(function(result){
- // Code here never runs because there are rejected promises!
- }, function(reason){
- // reason.message === "promise2" because promise 2 became rejected before
- // promise 1 became fulfilled
- });
- ```
+ return wrapper;
+}();
- @method race
- @for RSVP
- @param {Array} promises array of promises to observe
- @param {String} label optional string for describing the promise returned.
- Useful for tooling.
- @return {Promise} a promise that becomes fulfilled with the value the first
- completed promises is resolved with if the first completed promise was
- fulfilled, or rejected with the reason that the first completed promise
- was rejected with.
-*/
-function race(promises) {
- /*jshint validthis:true */
- var Promise = this;
+function AES ( options ) {
+ options = options || {};
- if (!isArray(promises)) {
- throw new TypeError('You must pass an array to race.');
- }
- return new Promise(function(resolve, reject) {
- var results = [], promise;
+ this.heap = _heap_init( Uint8Array, options ).subarray( AES_asm.HEAP_DATA );
+ this.asm = options.asm || AES_asm( global, null, this.heap.buffer );
+ this.mode = null;
+ this.key = null;
- for (var i = 0; i < promises.length; i++) {
- promise = promises[i];
+ this.reset( options );
+}
- if (promise && typeof promise.then === 'function') {
- promise.then(resolve, reject);
- } else {
- resolve(promise);
- }
+function AES_set_key ( key ) {
+ if ( key !== undefined ) {
+ if ( is_buffer(key) || is_bytes(key) ) {
+ key = new Uint8Array(key);
+ }
+ else if ( is_string(key) ) {
+ key = string_to_bytes(key);
+ }
+ else {
+ throw new TypeError("unexpected key type");
+ }
+
+ var keylen = key.length;
+ if ( keylen !== 16 && keylen !== 24 && keylen !== 32 )
+ throw new IllegalArgumentError("illegal key size");
+
+ var keyview = new DataView( key.buffer, key.byteOffset, key.byteLength );
+ this.asm.set_key(
+ keylen >> 2,
+ keyview.getUint32(0),
+ keyview.getUint32(4),
+ keyview.getUint32(8),
+ keyview.getUint32(12),
+ keylen > 16 ? keyview.getUint32(16) : 0,
+ keylen > 16 ? keyview.getUint32(20) : 0,
+ keylen > 24 ? keyview.getUint32(24) : 0,
+ keylen > 24 ? keyview.getUint32(28) : 0
+ );
+
+ this.key = key;
+ }
+ else if ( !this.key ) {
+ throw new Error("key is required");
}
- });
}
-exports.race = race;
-},{"./utils":10}],8:[function(require,module,exports){
-"use strict";
-/**
- `RSVP.reject` returns a promise that will become rejected with the passed
- `reason`. `RSVP.reject` is essentially shorthand for the following:
+function AES_set_iv ( iv ) {
+ if ( iv !== undefined ) {
+ if ( is_buffer(iv) || is_bytes(iv) ) {
+ iv = new Uint8Array(iv);
+ }
+ else if ( is_string(iv) ) {
+ iv = string_to_bytes(iv);
+ }
+ else {
+ throw new TypeError("unexpected iv type");
+ }
- ```javascript
- var promise = new RSVP.Promise(function(resolve, reject){
- reject(new Error('WHOOPS'));
- });
+ if ( iv.length !== 16 )
+ throw new IllegalArgumentError("illegal iv size");
- promise.then(function(value){
- // Code here doesn't run because the promise is rejected!
- }, function(reason){
- // reason.message === 'WHOOPS'
- });
- ```
+ var ivview = new DataView( iv.buffer, iv.byteOffset, iv.byteLength );
- Instead of writing the above, your code now simply becomes the following:
+ this.iv = iv;
+ this.asm.set_iv( ivview.getUint32(0), ivview.getUint32(4), ivview.getUint32(8), ivview.getUint32(12) );
+ }
+ else {
+ this.iv = null;
+ this.asm.set_iv( 0, 0, 0, 0 );
+ }
+}
- ```javascript
- var promise = RSVP.reject(new Error('WHOOPS'));
+function AES_set_padding ( padding ) {
+ if ( padding !== undefined ) {
+ this.padding = !!padding;
+ }
+ else {
+ this.padding = true;
+ }
+}
- promise.then(function(value){
- // Code here doesn't run because the promise is rejected!
- }, function(reason){
- // reason.message === 'WHOOPS'
- });
- ```
+function AES_reset ( options ) {
+ options = options || {};
- @method reject
- @for RSVP
- @param {Any} reason value that the returned promise will be rejected with.
- @param {String} label optional string for identifying the returned promise.
- Useful for tooling.
- @return {Promise} a promise that will become rejected with the given
- `reason`.
-*/
-function reject(reason) {
- /*jshint validthis:true */
- var Promise = this;
+ this.result = null;
+ this.pos = 0;
+ this.len = 0;
- return new Promise(function (resolve, reject) {
- reject(reason);
- });
+ AES_set_key.call( this, options.key );
+ if ( this.hasOwnProperty('iv') ) AES_set_iv.call( this, options.iv );
+ if ( this.hasOwnProperty('padding') ) AES_set_padding.call( this, options.padding );
+
+ return this;
}
-exports.reject = reject;
-},{}],9:[function(require,module,exports){
-"use strict";
-function resolve(value) {
- /*jshint validthis:true */
- if (value && typeof value === 'object' && value.constructor === this) {
- return value;
- }
+function AES_Encrypt_process ( data ) {
+ if ( is_string(data) )
+ data = string_to_bytes(data);
- var Promise = this;
+ if ( is_buffer(data) )
+ data = new Uint8Array(data);
- return new Promise(function(resolve) {
- resolve(value);
- });
-}
+ if ( !is_bytes(data) )
+ throw new TypeError("data isn't of expected type");
-exports.resolve = resolve;
-},{}],10:[function(require,module,exports){
-"use strict";
-function objectOrFunction(x) {
- return isFunction(x) || (typeof x === "object" && x !== null);
-}
+ var asm = this.asm,
+ heap = this.heap,
+ amode = AES_asm.ENC[this.mode],
+ hpos = AES_asm.HEAP_DATA,
+ pos = this.pos,
+ len = this.len,
+ dpos = 0,
+ dlen = data.length || 0,
+ rpos = 0,
+ rlen = (len + dlen) & -16,
+ wlen = 0;
-function isFunction(x) {
- return typeof x === "function";
-}
+ var result = new Uint8Array(rlen);
-function isArray(x) {
- return Object.prototype.toString.call(x) === "[object Array]";
-}
+ while ( dlen > 0 ) {
+ wlen = _heap_write( heap, pos+len, data, dpos, dlen );
+ len += wlen;
+ dpos += wlen;
+ dlen -= wlen;
-// Date.now is not available in browsers < IE9
-// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility
-var now = Date.now || function() { return new Date().getTime(); };
+ wlen = asm.cipher( amode, hpos + pos, len );
+ if ( wlen ) result.set( heap.subarray( pos, pos + wlen ), rpos );
+ rpos += wlen;
-exports.objectOrFunction = objectOrFunction;
-exports.isFunction = isFunction;
-exports.isArray = isArray;
-exports.now = now;
-},{}],11:[function(require,module,exports){
-// shim for using process in browser
+ if ( wlen < len ) {
+ pos += wlen;
+ len -= wlen;
+ } else {
+ pos = 0;
+ len = 0;
+ }
+ }
-var process = module.exports = {};
+ this.result = result;
+ this.pos = pos;
+ this.len = len;
-process.nextTick = (function () {
- var canSetImmediate = typeof window !== 'undefined'
- && window.setImmediate;
- var canPost = typeof window !== 'undefined'
- && window.postMessage && window.addEventListener
- ;
+ return this;
+}
- if (canSetImmediate) {
- return function (f) { return window.setImmediate(f) };
- }
+function AES_Encrypt_finish ( data ) {
+ var presult = null,
+ prlen = 0;
- if (canPost) {
- var queue = [];
- window.addEventListener('message', function (ev) {
- var source = ev.source;
- if ((source === window || source === null) && ev.data === 'process-tick') {
- ev.stopPropagation();
- if (queue.length > 0) {
- var fn = queue.shift();
- fn();
- }
- }
- }, true);
+ if ( data !== undefined ) {
+ presult = AES_Encrypt_process.call( this, data ).result;
+ prlen = presult.length;
+ }
- return function nextTick(fn) {
- queue.push(fn);
- window.postMessage('process-tick', '*');
- };
+ var asm = this.asm,
+ heap = this.heap,
+ amode = AES_asm.ENC[this.mode],
+ hpos = AES_asm.HEAP_DATA,
+ pos = this.pos,
+ len = this.len,
+ plen = 16 - len % 16,
+ rlen = len;
+
+ if ( this.hasOwnProperty('padding') ) {
+ if ( this.padding ) {
+ for ( var p = 0; p < plen; ++p ) heap[ pos + len + p ] = plen;
+ len += plen;
+ rlen = len;
+ }
+ else if ( len % 16 ) {
+ throw new IllegalArgumentError("data length must be a multiple of the block size");
+ }
+ }
+ else {
+ len += plen;
}
- return function nextTick(fn) {
- setTimeout(fn, 0);
- };
-})();
+ var result = new Uint8Array( prlen + rlen );
-process.title = 'browser';
-process.browser = true;
-process.env = {};
-process.argv = [];
+ if ( prlen ) result.set( presult );
-process.binding = function (name) {
- throw new Error('process.binding is not supported');
+ if ( len ) asm.cipher( amode, hpos + pos, len );
+
+ if ( rlen ) result.set( heap.subarray( pos, pos + rlen ), prlen );
+
+ this.result = result;
+ this.pos = 0;
+ this.len = 0;
+
+ return this;
}
-// TODO(shtylman)
-process.cwd = function () { return '/' };
-process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
-};
+function AES_Decrypt_process ( data ) {
+ if ( is_string(data) )
+ data = string_to_bytes(data);
+
+ if ( is_buffer(data) )
+ data = new Uint8Array(data);
+
+ if ( !is_bytes(data) )
+ throw new TypeError("data isn't of expected type");
+
+ var asm = this.asm,
+ heap = this.heap,
+ amode = AES_asm.DEC[this.mode],
+ hpos = AES_asm.HEAP_DATA,
+ pos = this.pos,
+ len = this.len,
+ dpos = 0,
+ dlen = data.length || 0,
+ rpos = 0,
+ rlen = (len + dlen) & -16,
+ plen = 0,
+ wlen = 0;
+
+ if ( this.hasOwnProperty('padding') && this.padding ) {
+ plen = len + dlen - rlen || 16;
+ rlen -= plen;
+ }
-},{}],12:[function(require,module,exports){
-// GPG4Browsers - An OpenPGP implementation in javascript
-// Copyright (C) 2011 Recurity Labs GmbH
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3.0 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ var result = new Uint8Array(rlen);
-/**
- * @requires config
- * @requires encoding/armor
- * @requires enums
- * @requires packet
- * @module cleartext
- */
+ while ( dlen > 0 ) {
+ wlen = _heap_write( heap, pos+len, data, dpos, dlen );
+ len += wlen;
+ dpos += wlen;
+ dlen -= wlen;
-'use strict';
+ wlen = asm.cipher( amode, hpos + pos, len - ( !dlen ? plen : 0 ) );
-var config = require('./config'),
- packet = require('./packet'),
- enums = require('./enums.js'),
- armor = require('./encoding/armor.js');
+ if ( wlen ) result.set( heap.subarray( pos, pos + wlen ), rpos );
+ rpos += wlen;
-/**
- * @class
- * @classdesc Class that represents an OpenPGP cleartext signed message.
- * See {@link http://tools.ietf.org/html/rfc4880#section-7}
- * @param {String} text The cleartext of the signed message
- * @param {module:packet/packetlist} packetlist The packetlist with signature packets or undefined
- * if message not yet signed
- */
+ if ( wlen < len ) {
+ pos += wlen;
+ len -= wlen;
+ } else {
+ pos = 0;
+ len = 0;
+ }
+ }
-function CleartextMessage(text, packetlist) {
- if (!(this instanceof CleartextMessage)) {
- return new CleartextMessage(text, packetlist);
- }
- // normalize EOL to canonical form =a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272,
-a-31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:throw"invalid length: "+a;}}var d=[],c,f;for(c=3;258>=c;c++)f=e(c),d[c]=f[2]<<24|
-f[1]<<16|f[0];return d}(),Ga=C?new Uint32Array(Fa):Fa;
-function na(e,d){function c(a,c){var b=a.g,d=[],f=0,e;e=Ga[a.length];d[f++]=e&65535;d[f++]=e>>16&255;d[f++]=e>>24;var g;switch(u){case 1===b:g=[0,b-1,0];break;case 2===b:g=[1,b-2,0];break;case 3===b:g=[2,b-3,0];break;case 4===b:g=[3,b-4,0];break;case 6>=b:g=[4,b-5,1];break;case 8>=b:g=[5,b-7,1];break;case 12>=b:g=[6,b-9,2];break;case 16>=b:g=[7,b-13,2];break;case 24>=b:g=[8,b-17,3];break;case 32>=b:g=[9,b-25,3];break;case 48>=b:g=[10,b-33,4];break;case 64>=b:g=[11,b-49,4];break;case 96>=b:g=[12,b-
-65,5];break;case 128>=b:g=[13,b-97,5];break;case 192>=b:g=[14,b-129,6];break;case 256>=b:g=[15,b-193,6];break;case 384>=b:g=[16,b-257,7];break;case 512>=b:g=[17,b-385,7];break;case 768>=b:g=[18,b-513,8];break;case 1024>=b:g=[19,b-769,8];break;case 1536>=b:g=[20,b-1025,9];break;case 2048>=b:g=[21,b-1537,9];break;case 3072>=b:g=[22,b-2049,10];break;case 4096>=b:g=[23,b-3073,10];break;case 6144>=b:g=[24,b-4097,11];break;case 8192>=b:g=[25,b-6145,11];break;case 12288>=b:g=[26,b-8193,12];break;case 16384>=
-b:g=[27,b-12289,12];break;case 24576>=b:g=[28,b-16385,13];break;case 32768>=b:g=[29,b-24577,13];break;default:throw"invalid distance";}e=g;d[f++]=e[0];d[f++]=e[1];d[f++]=e[2];var k,m;k=0;for(m=d.length;k =a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272,
+a-31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:throw"invalid length: "+a;}}var d=[],c,f;for(c=3;258>=c;c++)f=e(c),d[c]=f[2]<<24|
+f[1]<<16|f[0];return d}(),Ga=C?new Uint32Array(Fa):Fa;
+function na(e,d){function c(a,c){var b=a.g,d=[],f=0,e;e=Ga[a.length];d[f++]=e&65535;d[f++]=e>>16&255;d[f++]=e>>24;var g;switch(u){case 1===b:g=[0,b-1,0];break;case 2===b:g=[1,b-2,0];break;case 3===b:g=[2,b-3,0];break;case 4===b:g=[3,b-4,0];break;case 6>=b:g=[4,b-5,1];break;case 8>=b:g=[5,b-7,1];break;case 12>=b:g=[6,b-9,2];break;case 16>=b:g=[7,b-13,2];break;case 24>=b:g=[8,b-17,3];break;case 32>=b:g=[9,b-25,3];break;case 48>=b:g=[10,b-33,4];break;case 64>=b:g=[11,b-49,4];break;case 96>=b:g=[12,b-
+65,5];break;case 128>=b:g=[13,b-97,5];break;case 192>=b:g=[14,b-129,6];break;case 256>=b:g=[15,b-193,6];break;case 384>=b:g=[16,b-257,7];break;case 512>=b:g=[17,b-385,7];break;case 768>=b:g=[18,b-513,8];break;case 1024>=b:g=[19,b-769,8];break;case 1536>=b:g=[20,b-1025,9];break;case 2048>=b:g=[21,b-1537,9];break;case 3072>=b:g=[22,b-2049,10];break;case 4096>=b:g=[23,b-3073,10];break;case 6144>=b:g=[24,b-4097,11];break;case 8192>=b:g=[25,b-6145,11];break;case 12288>=b:g=[26,b-8193,12];break;case 16384>=
+b:g=[27,b-12289,12];break;case 24576>=b:g=[28,b-16385,13];break;case 32768>=b:g=[29,b-24577,13];break;default:throw"invalid distance";}e=g;d[f++]=e[0];d[f++]=e[1];d[f++]=e[2];var k,m;k=0;for(m=d.length;kf&&(b=e,f=g);if(258===g)break}return new ta(f,a-b)}
-function qa(d,a){var c=d.length,e=new ha(572),b=new (F?Uint8Array:Array)(c),f,g,h,k,n;if(!F)for(k=0;k
=A?(E[D++]=17,E[D++]=A-3,H[17]++):(E[D++]=18,E[D++]=A-11,H[18]++),s-=A;else if(E[D++]=F[r],H[F[r]]++,s--,3>s)for(;0y;y++)ia[y]=ea[Ia[y]];for(P=19;4=U?8:255>=U?9:279>=U?7:8;var ba=u(P),V=new (t?Uint8Array:Array)(30),W,ea;W=0;for(ea=V.length;Wf&&(b=e,f=g);if(258===g)break}return new ua(f,a-b)}
+function ra(d,a){var c=d.length,e=new ja(572),b=new (G?Uint8Array:Array)(c),f,g,h,k,p;if(!G)for(k=0;k
+ * Canonicalyzing the document by converting line endings. */
+ text: 1,
+ /** 0x02: Standalone signature.
+ * This signature is a signature of only its own subpacket contents.
+ * It is calculated identically to a signature over a zero-lengh
+ * binary document. Note that it doesn't make sense to have a V3
+ * standalone signature. */
+ standalone: 2,
+ /** 0x10: Generic certification of a User ID and Public-Key packet.
+ * The issuer of this certification does not make any particular
+ * assertion as to how well the certifier has checked that the owner
+ * of the key is in fact the person described by the User ID. */
+ cert_generic: 16,
+ /** 0x11: Persona certification of a User ID and Public-Key packet.
+ * The issuer of this certification has not done any verification of
+ * the claim that the owner of this key is the User ID specified. */
+ cert_persona: 17,
+ /** 0x12: Casual certification of a User ID and Public-Key packet.
+ * The issuer of this certification has done some casual
+ * verification of the claim of identity. */
+ cert_casual: 18,
+ /** 0x13: Positive certification of a User ID and Public-Key packet.
+ * The issuer of this certification has done substantial
+ * verification of the claim of identity.
+ *
+ * Most OpenPGP implementations make their "key signatures" as 0x10
+ * certifications. Some implementations can issue 0x11-0x13
+ * certifications, but few differentiate between the types. */
+ cert_positive: 19,
+ /** 0x30: Certification revocation signature
+ * This signature revokes an earlier User ID certification signature
+ * (signature class 0x10 through 0x13) or direct-key signature
+ * (0x1F). It should be issued by the same key that issued the
+ * revoked signature or an authorized revocation key. The signature
+ * is computed over the same data as the certificate that it
+ * revokes, and should have a later creation date than that
+ * certificate. */
+ cert_revocation: 48,
+ /** 0x18: Subkey Binding Signature
+ * This signature is a statement by the top-level signing key that
+ * indicates that it owns the subkey. This signature is calculated
+ * directly on the primary key and subkey, and not on any User ID or
+ * other packets. A signature that binds a signing subkey MUST have
+ * an Embedded Signature subpacket in this binding signature that
+ * contains a 0x19 signature made by the signing subkey on the
+ * primary key and subkey. */
+ subkey_binding: 24,
+ /** 0x19: Primary Key Binding Signature
+ * This signature is a statement by a signing subkey, indicating
+ * that it is owned by the primary key and subkey. This signature
+ * is calculated the same way as a 0x18 signature: directly on the
+ * primary key and subkey, and not on any User ID or other packets.
+ *
+ * When a signature is made over a key, the hash data starts with the
+ * octet 0x99, followed by a two-octet length of the key, and then body
+ * of the key packet. (Note that this is an old-style packet header for
+ * a key packet with two-octet length.) A subkey binding signature
+ * (type 0x18) or primary key binding signature (type 0x19) then hashes
+ * the subkey using the same format as the main key (also using 0x99 as
+ * the first octet). */
+ key_binding: 25,
+ /** 0x1F: Signature directly on a key
+ * This signature is calculated directly on a key. It binds the
+ * information in the Signature subpackets to the key, and is
+ * appropriate to be used for subpackets that provide information
+ * about the key, such as the Revocation Key subpacket. It is also
+ * appropriate for statements that non-self certifiers want to make
+ * about the key itself, rather than the binding between a key and a
+ * name. */
+ key: 31,
+ /** 0x20: Key revocation signature
+ * The signature is calculated directly on the key being revoked. A
+ * revoked key is not to be used. Only revocation signatures by the
+ * key being revoked, or by an authorized revocation key, should be
+ * considered valid revocation signatures.a */
+ key_revocation: 32,
+ /** 0x28: Subkey revocation signature
+ * The signature is calculated directly on the subkey being revoked.
+ * A revoked subkey is not to be used. Only revocation signatures
+ * by the top-level signature key that is bound to this subkey, or
+ * by an authorized revocation key, should be considered valid
+ * revocation signatures.
+ *
+ * Key revocation signatures (types 0x20 and 0x28)
+ * hash only the key being revoked. */
+ subkey_revocation: 40,
+ /** 0x40: Timestamp signature.
+ * This signature is only meaningful for the timestamp contained in
+ * it. */
+ timestamp: 64,
+ /** 0x50: Third-Party Confirmation signature.
+ * This signature is a signature over some other OpenPGP Signature
+ * packet(s). It is analogous to a notary seal on the signed data.
+ * A third-party signature SHOULD include Signature Target
+ * subpacket(s) to give easy identification. Note that we really do
+ * mean SHOULD. There are plausible uses for this (such as a blind
+ * party that only sees the signature, not the key or source
+ * document) that cannot include a target subpacket. */
+ third_party: 80
+ },
+
+ /** Signature subpacket type
+ * @enum {Integer}
+ * @readonly
*/
- literal: {
- /** Binary data 'b' */
- binary: 'b'.charCodeAt(),
- /** Text data 't' */
- text: 't'.charCodeAt(),
- /** Utf8 data 'u' */
- utf8: 'u'.charCodeAt()
+ signatureSubpacket: {
+ signature_creation_time: 2,
+ signature_expiration_time: 3,
+ exportable_certification: 4,
+ trust_signature: 5,
+ regular_expression: 6,
+ revocable: 7,
+ key_expiration_time: 9,
+ placeholder_backwards_compatibility: 10,
+ preferred_symmetric_algorithms: 11,
+ revocation_key: 12,
+ issuer: 16,
+ notation_data: 20,
+ preferred_hash_algorithms: 21,
+ preferred_compression_algorithms: 22,
+ key_server_preferences: 23,
+ preferred_key_server: 24,
+ primary_user_id: 25,
+ policy_uri: 26,
+ key_flags: 27,
+ signers_user_id: 28,
+ reason_for_revocation: 29,
+ features: 30,
+ signature_target: 31,
+ embedded_signature: 32
+ },
+
+ /** Key flags
+ * @enum {Integer}
+ * @readonly
+ */
+ keyFlags: {
+ /** 0x01 - This key may be used to certify other keys. */
+ certify_keys: 1,
+ /** 0x02 - This key may be used to sign data. */
+ sign_data: 2,
+ /** 0x04 - This key may be used to encrypt communications. */
+ encrypt_communication: 4,
+ /** 0x08 - This key may be used to encrypt storage. */
+ encrypt_storage: 8,
+ /** 0x10 - The private component of this key may have been split
+ * by a secret-sharing mechanism. */
+ split_private_key: 16,
+ /** 0x20 - This key may be used for authentication. */
+ authentication: 32,
+ /** 0x80 - The private component of this key may be in the
+ * possession of more than one person. */
+ shared_private_key: 128
+ },
+
+ /** Key status
+ * @enum {Integer}
+ * @readonly
+ */
+ keyStatus: {
+ invalid: 0,
+ expired: 1,
+ revoked: 2,
+ valid: 3,
+ no_self_cert: 4
+ },
+
+ /** Armor type
+ * @enum {Integer}
+ * @readonly
+ */
+ armor: {
+ multipart_section: 0,
+ multipart_last: 1,
+ signed: 2,
+ message: 3,
+ public_key: 4,
+ private_key: 5,
+ signature: 6
+ },
+
+ /** Asserts validity and converts from string/integer to integer. */
+ write: function write(type, e) {
+ if (typeof e === 'number') {
+ e = this.read(type, e);
+ }
+
+ if (type[e] !== undefined) {
+ return type[e];
+ } else {
+ throw new Error('Invalid enum value.');
+ }
},
+ /** Converts from an integer to string. */
+ read: function read(type, e) {
+ for (var i in type) {
+ if (type[i] === parseInt(e)) {
+ return i;
+ }
+ }
+
+ throw new Error('Invalid enum value.');
+ }
+
+};
+
+},{}],36:[function(_dereq_,module,exports){
+// OpenPGP.js - An OpenPGP implementation in javascript
+// Copyright (C) 2015 Tankred Hase
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 3.0 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+/**
+ * @fileoverview This class implements a client for the OpenPGP HTTP Keyserver Protocol (HKP)
+ * in order to lookup and upload keys on standard public key servers.
+ */
+
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = HKP;
+
+var _config = _dereq_('./config');
+
+var _config2 = _interopRequireDefault(_config);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * Initialize the HKP client and configure it with the key server url and fetch function.
+ * @constructor
+ * @param {String} keyServerBaseUrl (optional) The HKP key server base url including
+ * the protocol to use e.g. https://pgp.mit.edu
+ */
+function HKP(keyServerBaseUrl) {
+ this._baseUrl = keyServerBaseUrl ? keyServerBaseUrl : _config2.default.keyserver;
+ this._fetch = typeof window !== 'undefined' ? window.fetch : _dereq_('node-fetch');
+}
+
+/**
+ * Search for a public key on the key server either by key ID or part of the user ID.
+ * @param {String} options.keyID The long public key ID.
+ * @param {String} options.query This can be any part of the key user ID such as name
+ * or email address.
+ * @return {Promise
- * Canonicalyzing the document by converting line endings. */
- text: 1,
- /** 0x02: Standalone signature.
- * This signature is a signature of only its own subpacket contents.
- * It is calculated identically to a signature over a zero-lengh
- * binary document. Note that it doesn't make sense to have a V3
- * standalone signature. */
- standalone: 2,
- /** 0x10: Generic certification of a User ID and Public-Key packet.
- * The issuer of this certification does not make any particular
- * assertion as to how well the certifier has checked that the owner
- * of the key is in fact the person described by the User ID. */
- cert_generic: 16,
- /** 0x11: Persona certification of a User ID and Public-Key packet.
- * The issuer of this certification has not done any verification of
- * the claim that the owner of this key is the User ID specified. */
- cert_persona: 17,
- /** 0x12: Casual certification of a User ID and Public-Key packet.
- * The issuer of this certification has done some casual
- * verification of the claim of identity. */
- cert_casual: 18,
- /** 0x13: Positive certification of a User ID and Public-Key packet.
- * The issuer of this certification has done substantial
- * verification of the claim of identity.
- *
- * Most OpenPGP implementations make their "key signatures" as 0x10
- * certifications. Some implementations can issue 0x11-0x13
- * certifications, but few differentiate between the types. */
- cert_positive: 19,
- /** 0x30: Certification revocation signature
- * This signature revokes an earlier User ID certification signature
- * (signature class 0x10 through 0x13) or direct-key signature
- * (0x1F). It should be issued by the same key that issued the
- * revoked signature or an authorized revocation key. The signature
- * is computed over the same data as the certificate that it
- * revokes, and should have a later creation date than that
- * certificate. */
- cert_revocation: 48,
- /** 0x18: Subkey Binding Signature
- * This signature is a statement by the top-level signing key that
- * indicates that it owns the subkey. This signature is calculated
- * directly on the primary key and subkey, and not on any User ID or
- * other packets. A signature that binds a signing subkey MUST have
- * an Embedded Signature subpacket in this binding signature that
- * contains a 0x19 signature made by the signing subkey on the
- * primary key and subkey. */
- subkey_binding: 24,
- /** 0x19: Primary Key Binding Signature
- * This signature is a statement by a signing subkey, indicating
- * that it is owned by the primary key and subkey. This signature
- * is calculated the same way as a 0x18 signature: directly on the
- * primary key and subkey, and not on any User ID or other packets.
- *
- * When a signature is made over a key, the hash data starts with the
- * octet 0x99, followed by a two-octet length of the key, and then body
- * of the key packet. (Note that this is an old-style packet header for
- * a key packet with two-octet length.) A subkey binding signature
- * (type 0x18) or primary key binding signature (type 0x19) then hashes
- * the subkey using the same format as the main key (also using 0x99 as
- * the first octet). */
- key_binding: 25,
- /** 0x1F: Signature directly on a key
- * This signature is calculated directly on a key. It binds the
- * information in the Signature subpackets to the key, and is
- * appropriate to be used for subpackets that provide information
- * about the key, such as the Revocation Key subpacket. It is also
- * appropriate for statements that non-self certifiers want to make
- * about the key itself, rather than the binding between a key and a
- * name. */
- key: 31,
- /** 0x20: Key revocation signature
- * The signature is calculated directly on the key being revoked. A
- * revoked key is not to be used. Only revocation signatures by the
- * key being revoked, or by an authorized revocation key, should be
- * considered valid revocation signatures.a */
- key_revocation: 32,
- /** 0x28: Subkey revocation signature
- * The signature is calculated directly on the subkey being revoked.
- * A revoked subkey is not to be used. Only revocation signatures
- * by the top-level signature key that is bound to this subkey, or
- * by an authorized revocation key, should be considered valid
- * revocation signatures.
- *
- * Key revocation signatures (types 0x20 and 0x28)
- * hash only the key being revoked. */
- subkey_revocation: 40,
- /** 0x40: Timestamp signature.
- * This signature is only meaningful for the timestamp contained in
- * it. */
- timestamp: 64,
- /** 0x50: Third-Party Confirmation signature.
- * This signature is a signature over some other OpenPGP Signature
- * packet(s). It is analogous to a notary seal on the signed data.
- * A third-party signature SHOULD include Signature Target
- * subpacket(s) to give easy identification. Note that we really do
- * mean SHOULD. There are plausible uses for this (such as a blind
- * party that only sees the signature, not the key or source
- * document) that cannot include a target subpacket. */
- third_party: 80
- },
+/**
+ * Reads an unarmored OpenPGP key list and returns one or multiple key objects
+ * @param {Uint8Array} data to be parsed
+ * @return {{keys: Array