├── README.md ├── admin ├── css │ └── signin.css ├── index.html └── js │ ├── amazon-cognito-identity.min.js │ ├── aws-cognito-sdk.min.js │ ├── aws-sdk.min.js │ ├── jquery-3.1.1.min.js │ ├── jsbn.js │ ├── jsbn2.js │ ├── jsrender.min.js │ └── sjcl.js ├── css ├── bootstrap.min.css ├── bootstrap.min.css.map ├── jumbotron.css └── signin.css ├── index.html └── screenshots ├── CreateIdentityPool.png ├── IAM-Policy.png ├── IAM-Role-ManagedPolicies.png ├── IAM-RoleAccess.png ├── IAM-RoleName.png ├── ServerlessCMS.png ├── UserPool-CreateUser.png └── UserPools-AppAccess.png /README.md: -------------------------------------------------------------------------------- 1 | #Serverless CMS 2 | This is a proof of concept demo for creating a custom serverless CMS for generating static websites. 3 | 4 | Built with: 5 | 6 | - [AWS SDK for JavaScript in the Browser](https://aws.amazon.com/sdk-for-browser/) 7 | - [Amazon Cognito](https://aws.amazon.com/cognito/), [IAM](https://aws.amazon.com/iam/) and [S3](https://aws.amazon.com/s3/) 8 | - [JSRender](https://github.com/BorisMoore/jsrender) and JSX 9 | 10 | To get the demo up and running you will need to sign up for an AWS account and configure the Cognito, IAM and S3 services. 11 | 12 | For step-by-step instructions, refer to the [Build a Custom CMS for a Serverless Static Site Generator](https://css-tricks.com/build-custom-cms-serverless-static-site-generator/) article on [CSS-Tricks](https://css-tricks.com/). 13 | 14 | -- 15 | 16 | Find me on Twitter at [@johnpolacek](https://twitter.com/johnpolacek) and online at [johnpolacek.com](http://johnpolacek.com/) 17 | -------------------------------------------------------------------------------- /admin/css/signin.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 40px; 3 | padding-bottom: 40px; 4 | background-color: #eee; 5 | } 6 | 7 | .form-signin { 8 | max-width: 330px; 9 | padding: 15px; 10 | margin: 0 auto; 11 | } 12 | .form-signin .form-signin-heading, 13 | .form-signin .checkbox { 14 | margin-bottom: 10px; 15 | } 16 | .form-signin .checkbox { 17 | font-weight: normal; 18 | } 19 | .form-signin .form-control { 20 | position: relative; 21 | height: auto; 22 | -webkit-box-sizing: border-box; 23 | box-sizing: border-box; 24 | padding: 10px; 25 | font-size: 16px; 26 | } 27 | .form-signin .form-control:focus { 28 | z-index: 2; 29 | } 30 | .form-signin input[type="email"] { 31 | margin-bottom: -1px; 32 | border-bottom-right-radius: 0; 33 | border-bottom-left-radius: 0; 34 | } 35 | .form-signin input[type="password"] { 36 | margin-bottom: 10px; 37 | border-top-left-radius: 0; 38 | border-top-right-radius: 0; 39 | } 40 | -------------------------------------------------------------------------------- /admin/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Serverless CMS Admin 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 |
31 | 34 |
35 | 36 |
37 | 38 | 44 | 45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 83 | 143 | 244 | 245 | 246 | -------------------------------------------------------------------------------- /admin/js/amazon-cognito-identity.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2016 Amazon.com, 3 | * Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Licensed under the Amazon Software License (the "License"). 6 | * You may not use this file except in compliance with the 7 | * License. A copy of the License is located at 8 | * 9 | * http://aws.amazon.com/asl/ 10 | * 11 | * or in the "license" file accompanying this file. This file is 12 | * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, express or implied. See the License 14 | * for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | 19 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("sjcl"),require("aws-sdk/clients/cognitoidentityserviceprovider"),require("jsbn")):"function"==typeof define&&define.amd?define(["sjcl","aws-sdk/clients/cognitoidentityserviceprovider","jsbn"],t):"object"==typeof exports?exports.AmazonCognitoIdentity=t(require("sjcl"),require("aws-sdk/clients/cognitoidentityserviceprovider"),require("jsbn")):e.AmazonCognitoIdentity=t(e.sjcl,e.AWSCognito.CognitoIdentityServiceProvider,e)}(this,function(e,t,n){return function(e){function t(i){if(n[i])return n[i].exports;var s=n[i]={exports:{},id:i,loaded:!1};return e[i].call(s.exports,s,s.exports,t),s.loaded=!0,s.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function s(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(14);Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})});var o=n(10),a=s(o),u=i(r);Object.keys(u).forEach(function(e){a["default"][e]=u[e]})},function(t,n){t.exports=e},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n= 0) { 35 | var v = x*this[i++]+w[j]+c; 36 | c = Math.floor(v/0x4000000); 37 | w[j++] = v&0x3ffffff; 38 | } 39 | return c; 40 | } 41 | // am2 avoids a big mult-and-extract completely. 42 | // Max digit bits should be <= 30 because we do bitwise ops 43 | // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) 44 | function am2(i,x,w,j,c,n) { 45 | var xl = x&0x7fff, xh = x>>15; 46 | while(--n >= 0) { 47 | var l = this[i]&0x7fff; 48 | var h = this[i++]>>15; 49 | var m = xh*l+h*xl; 50 | l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff); 51 | c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); 52 | w[j++] = l&0x3fffffff; 53 | } 54 | return c; 55 | } 56 | // Alternately, set max digit bits to 28 since some 57 | // browsers slow down when dealing with 32-bit numbers. 58 | function am3(i,x,w,j,c,n) { 59 | var xl = x&0x3fff, xh = x>>14; 60 | while(--n >= 0) { 61 | var l = this[i]&0x3fff; 62 | var h = this[i++]>>14; 63 | var m = xh*l+h*xl; 64 | l = xl*l+((m&0x3fff)<<14)+w[j]+c; 65 | c = (l>>28)+(m>>14)+xh*h; 66 | w[j++] = l&0xfffffff; 67 | } 68 | return c; 69 | } 70 | if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) { 71 | BigInteger.prototype.am = am2; 72 | dbits = 30; 73 | } 74 | else if(j_lm && (navigator.appName != "Netscape")) { 75 | BigInteger.prototype.am = am1; 76 | dbits = 26; 77 | } 78 | else { // Mozilla/Netscape seems to prefer am3 79 | BigInteger.prototype.am = am3; 80 | dbits = 28; 81 | } 82 | 83 | BigInteger.prototype.DB = dbits; 84 | BigInteger.prototype.DM = ((1<= 0; --i) r[i] = this[i]; 112 | r.t = this.t; 113 | r.s = this.s; 114 | } 115 | 116 | // (protected) set from integer value x, -DV <= x < DV 117 | function bnpFromInt(x) { 118 | this.t = 1; 119 | this.s = (x<0)?-1:0; 120 | if(x > 0) this[0] = x; 121 | else if(x < -1) this[0] = x+this.DV; 122 | else this.t = 0; 123 | } 124 | 125 | // return bigint initialized to value 126 | function nbv(i) { var r = nbi(); r.fromInt(i); return r; } 127 | 128 | // (protected) set from string and radix 129 | function bnpFromString(s,b) { 130 | var k; 131 | if(b == 16) k = 4; 132 | else if(b == 8) k = 3; 133 | else if(b == 256) k = 8; // byte array 134 | else if(b == 2) k = 1; 135 | else if(b == 32) k = 5; 136 | else if(b == 4) k = 2; 137 | else { this.fromRadix(s,b); return; } 138 | this.t = 0; 139 | this.s = 0; 140 | var i = s.length, mi = false, sh = 0; 141 | while(--i >= 0) { 142 | var x = (k==8)?s[i]&0xff:intAt(s,i); 143 | if(x < 0) { 144 | if(s.charAt(i) == "-") mi = true; 145 | continue; 146 | } 147 | mi = false; 148 | if(sh == 0) 149 | this[this.t++] = x; 150 | else if(sh+k > this.DB) { 151 | this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh)); 153 | } 154 | else 155 | this[this.t-1] |= x<= this.DB) sh -= this.DB; 158 | } 159 | if(k == 8 && (s[0]&0x80) != 0) { 160 | this.s = -1; 161 | if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this[this.t-1] == c) --this.t; 171 | } 172 | 173 | // (public) return string representation in given radix 174 | function bnToString(b) { 175 | if(this.s < 0) return "-"+this.negate().toString(b); 176 | var k; 177 | if(b == 16) k = 4; 178 | else if(b == 8) k = 3; 179 | else if(b == 2) k = 1; 180 | else if(b == 32) k = 5; 181 | else if(b == 4) k = 2; 182 | else return this.toRadix(b); 183 | var km = (1< 0) { 186 | if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); } 187 | while(i >= 0) { 188 | if(p < k) { 189 | d = (this[i]&((1<>(p+=this.DB-k); 191 | } 192 | else { 193 | d = (this[i]>>(p-=k))&km; 194 | if(p <= 0) { p += this.DB; --i; } 195 | } 196 | if(d > 0) m = true; 197 | if(m) r += int2char(d); 198 | } 199 | } 200 | return m?r:"0"; 201 | } 202 | 203 | // (public) -this 204 | function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } 205 | 206 | // (public) |this| 207 | function bnAbs() { return (this.s<0)?this.negate():this; } 208 | 209 | // (public) return + if this > a, - if this < a, 0 if equal 210 | function bnCompareTo(a) { 211 | var r = this.s-a.s; 212 | if(r != 0) return r; 213 | var i = this.t; 214 | r = i-a.t; 215 | if(r != 0) return (this.s<0)?-r:r; 216 | while(--i >= 0) if((r=this[i]-a[i]) != 0) return r; 217 | return 0; 218 | } 219 | 220 | // returns bit length of the integer x 221 | function nbits(x) { 222 | var r = 1, t; 223 | if((t=x>>>16) != 0) { x = t; r += 16; } 224 | if((t=x>>8) != 0) { x = t; r += 8; } 225 | if((t=x>>4) != 0) { x = t; r += 4; } 226 | if((t=x>>2) != 0) { x = t; r += 2; } 227 | if((t=x>>1) != 0) { x = t; r += 1; } 228 | return r; 229 | } 230 | 231 | // (public) return the number of bits in "this" 232 | function bnBitLength() { 233 | if(this.t <= 0) return 0; 234 | return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM)); 235 | } 236 | 237 | // (protected) r = this << n*DB 238 | function bnpDLShiftTo(n,r) { 239 | var i; 240 | for(i = this.t-1; i >= 0; --i) r[i+n] = this[i]; 241 | for(i = n-1; i >= 0; --i) r[i] = 0; 242 | r.t = this.t+n; 243 | r.s = this.s; 244 | } 245 | 246 | // (protected) r = this >> n*DB 247 | function bnpDRShiftTo(n,r) { 248 | for(var i = n; i < this.t; ++i) r[i-n] = this[i]; 249 | r.t = Math.max(this.t-n,0); 250 | r.s = this.s; 251 | } 252 | 253 | // (protected) r = this << n 254 | function bnpLShiftTo(n,r) { 255 | var bs = n%this.DB; 256 | var cbs = this.DB-bs; 257 | var bm = (1<= 0; --i) { 260 | r[i+ds+1] = (this[i]>>cbs)|c; 261 | c = (this[i]&bm)<= 0; --i) r[i] = 0; 264 | r[ds] = c; 265 | r.t = this.t+ds+1; 266 | r.s = this.s; 267 | r.clamp(); 268 | } 269 | 270 | // (protected) r = this >> n 271 | function bnpRShiftTo(n,r) { 272 | r.s = this.s; 273 | var ds = Math.floor(n/this.DB); 274 | if(ds >= this.t) { r.t = 0; return; } 275 | var bs = n%this.DB; 276 | var cbs = this.DB-bs; 277 | var bm = (1<>bs; 279 | for(var i = ds+1; i < this.t; ++i) { 280 | r[i-ds-1] |= (this[i]&bm)<>bs; 282 | } 283 | if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<>= this.DB; 295 | } 296 | if(a.t < this.t) { 297 | c -= a.s; 298 | while(i < this.t) { 299 | c += this[i]; 300 | r[i++] = c&this.DM; 301 | c >>= this.DB; 302 | } 303 | c += this.s; 304 | } 305 | else { 306 | c += this.s; 307 | while(i < a.t) { 308 | c -= a[i]; 309 | r[i++] = c&this.DM; 310 | c >>= this.DB; 311 | } 312 | c -= a.s; 313 | } 314 | r.s = (c<0)?-1:0; 315 | if(c < -1) r[i++] = this.DV+c; 316 | else if(c > 0) r[i++] = c; 317 | r.t = i; 318 | r.clamp(); 319 | } 320 | 321 | // (protected) r = this * a, r != this,a (HAC 14.12) 322 | // "this" should be the larger one if appropriate. 323 | function bnpMultiplyTo(a,r) { 324 | var x = this.abs(), y = a.abs(); 325 | var i = x.t; 326 | r.t = i+y.t; 327 | while(--i >= 0) r[i] = 0; 328 | for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t); 329 | r.s = 0; 330 | r.clamp(); 331 | if(this.s != a.s) BigInteger.ZERO.subTo(r,r); 332 | } 333 | 334 | // (protected) r = this^2, r != this (HAC 14.16) 335 | function bnpSquareTo(r) { 336 | var x = this.abs(); 337 | var i = r.t = 2*x.t; 338 | while(--i >= 0) r[i] = 0; 339 | for(i = 0; i < x.t-1; ++i) { 340 | var c = x.am(i,x[i],r,2*i,0,1); 341 | if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { 342 | r[i+x.t] -= x.DV; 343 | r[i+x.t+1] = 1; 344 | } 345 | } 346 | if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1); 347 | r.s = 0; 348 | r.clamp(); 349 | } 350 | 351 | // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) 352 | // r != q, this != m. q or r may be null. 353 | function bnpDivRemTo(m,q,r) { 354 | var pm = m.abs(); 355 | if(pm.t <= 0) return; 356 | var pt = this.abs(); 357 | if(pt.t < pm.t) { 358 | if(q != null) q.fromInt(0); 359 | if(r != null) this.copyTo(r); 360 | return; 361 | } 362 | if(r == null) r = nbi(); 363 | var y = nbi(), ts = this.s, ms = m.s; 364 | var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus 365 | if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } 366 | else { pm.copyTo(y); pt.copyTo(r); } 367 | var ys = y.t; 368 | var y0 = y[ys-1]; 369 | if(y0 == 0) return; 370 | var yt = y0*(1<1)?y[ys-2]>>this.F2:0); 371 | var d1 = this.FV/yt, d2 = (1<= 0) { 375 | r[r.t++] = 1; 376 | r.subTo(t,r); 377 | } 378 | BigInteger.ONE.dlShiftTo(ys,t); 379 | t.subTo(y,y); // "negative" y so we can replace sub with am later 380 | while(y.t < ys) y[y.t++] = 0; 381 | while(--j >= 0) { 382 | // Estimate quotient digit 383 | var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2); 384 | if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out 385 | y.dlShiftTo(j,t); 386 | r.subTo(t,r); 387 | while(r[i] < --qd) r.subTo(t,r); 388 | } 389 | } 390 | if(q != null) { 391 | r.drShiftTo(ys,q); 392 | if(ts != ms) BigInteger.ZERO.subTo(q,q); 393 | } 394 | r.t = ys; 395 | r.clamp(); 396 | if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder 397 | if(ts < 0) BigInteger.ZERO.subTo(r,r); 398 | } 399 | 400 | // (public) this mod a 401 | function bnMod(a) { 402 | var r = nbi(); 403 | this.abs().divRemTo(a,null,r); 404 | if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); 405 | return r; 406 | } 407 | 408 | // Modular reduction using "classic" algorithm 409 | function Classic(m) { this.m = m; } 410 | function cConvert(x) { 411 | if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); 412 | else return x; 413 | } 414 | function cRevert(x) { return x; } 415 | function cReduce(x) { x.divRemTo(this.m,null,x); } 416 | function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } 417 | function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } 418 | 419 | Classic.prototype.convert = cConvert; 420 | Classic.prototype.revert = cRevert; 421 | Classic.prototype.reduce = cReduce; 422 | Classic.prototype.mulTo = cMulTo; 423 | Classic.prototype.sqrTo = cSqrTo; 424 | 425 | // (protected) return "-1/this % 2^DB"; useful for Mont. reduction 426 | // justification: 427 | // xy == 1 (mod m) 428 | // xy = 1+km 429 | // xy(2-xy) = (1+km)(1-km) 430 | // x[y(2-xy)] = 1-k^2m^2 431 | // x[y(2-xy)] == 1 (mod m^2) 432 | // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 433 | // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. 434 | // JS multiply "overflows" differently from C/C++, so care is needed here. 435 | function bnpInvDigit() { 436 | if(this.t < 1) return 0; 437 | var x = this[0]; 438 | if((x&1) == 0) return 0; 439 | var y = x&3; // y == 1/x mod 2^2 440 | y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 441 | y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 442 | y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 443 | // last step - calculate inverse mod DV directly; 444 | // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints 445 | y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits 446 | // we really want the negative inverse, and -DV < y < DV 447 | return (y>0)?this.DV-y:-y; 448 | } 449 | 450 | // Montgomery reduction 451 | function Montgomery(m) { 452 | this.m = m; 453 | this.mp = m.invDigit(); 454 | this.mpl = this.mp&0x7fff; 455 | this.mph = this.mp>>15; 456 | this.um = (1<<(m.DB-15))-1; 457 | this.mt2 = 2*m.t; 458 | } 459 | 460 | // xR mod m 461 | function montConvert(x) { 462 | var r = nbi(); 463 | x.abs().dlShiftTo(this.m.t,r); 464 | r.divRemTo(this.m,null,r); 465 | if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); 466 | return r; 467 | } 468 | 469 | // x/R mod m 470 | function montRevert(x) { 471 | var r = nbi(); 472 | x.copyTo(r); 473 | this.reduce(r); 474 | return r; 475 | } 476 | 477 | // x = x/R mod m (HAC 14.32) 478 | function montReduce(x) { 479 | while(x.t <= this.mt2) // pad x so am has enough room later 480 | x[x.t++] = 0; 481 | for(var i = 0; i < this.m.t; ++i) { 482 | // faster way of calculating u0 = x[i]*mp mod DV 483 | var j = x[i]&0x7fff; 484 | var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM; 485 | // use am to combine the multiply-shift-add into one call 486 | j = i+this.m.t; 487 | x[j] += this.m.am(0,u0,x,i,0,this.m.t); 488 | // propagate carry 489 | while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; } 490 | } 491 | x.clamp(); 492 | x.drShiftTo(this.m.t,x); 493 | if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); 494 | } 495 | 496 | // r = "x^2/R mod m"; x != r 497 | function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } 498 | 499 | // r = "xy/R mod m"; x,y != r 500 | function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } 501 | 502 | Montgomery.prototype.convert = montConvert; 503 | Montgomery.prototype.revert = montRevert; 504 | Montgomery.prototype.reduce = montReduce; 505 | Montgomery.prototype.mulTo = montMulTo; 506 | Montgomery.prototype.sqrTo = montSqrTo; 507 | 508 | // (protected) true iff this is even 509 | function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; } 510 | 511 | // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) 512 | function bnpExp(e,z) { 513 | if(e > 0xffffffff || e < 1) return BigInteger.ONE; 514 | var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; 515 | g.copyTo(r); 516 | while(--i >= 0) { 517 | z.sqrTo(r,r2); 518 | if((e&(1< 0) z.mulTo(r2,g,r); 519 | else { var t = r; r = r2; r2 = t; } 520 | } 521 | return z.revert(r); 522 | } 523 | 524 | // (public) this^e % m, 0 <= e < 2^32 525 | function bnModPowInt(e,m) { 526 | var z; 527 | if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); 528 | return this.exp(e,z); 529 | } 530 | 531 | // protected 532 | BigInteger.prototype.copyTo = bnpCopyTo; 533 | BigInteger.prototype.fromInt = bnpFromInt; 534 | BigInteger.prototype.fromString = bnpFromString; 535 | BigInteger.prototype.clamp = bnpClamp; 536 | BigInteger.prototype.dlShiftTo = bnpDLShiftTo; 537 | BigInteger.prototype.drShiftTo = bnpDRShiftTo; 538 | BigInteger.prototype.lShiftTo = bnpLShiftTo; 539 | BigInteger.prototype.rShiftTo = bnpRShiftTo; 540 | BigInteger.prototype.subTo = bnpSubTo; 541 | BigInteger.prototype.multiplyTo = bnpMultiplyTo; 542 | BigInteger.prototype.squareTo = bnpSquareTo; 543 | BigInteger.prototype.divRemTo = bnpDivRemTo; 544 | BigInteger.prototype.invDigit = bnpInvDigit; 545 | BigInteger.prototype.isEven = bnpIsEven; 546 | BigInteger.prototype.exp = bnpExp; 547 | 548 | // public 549 | BigInteger.prototype.toString = bnToString; 550 | BigInteger.prototype.negate = bnNegate; 551 | BigInteger.prototype.abs = bnAbs; 552 | BigInteger.prototype.compareTo = bnCompareTo; 553 | BigInteger.prototype.bitLength = bnBitLength; 554 | BigInteger.prototype.mod = bnMod; 555 | BigInteger.prototype.modPowInt = bnModPowInt; 556 | 557 | // "constants" 558 | BigInteger.ZERO = nbv(0); 559 | BigInteger.ONE = nbv(1); 560 | -------------------------------------------------------------------------------- /admin/js/jsbn2.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005-2009 Tom Wu 2 | // All Rights Reserved. 3 | // See "LICENSE" for details. 4 | 5 | // Extended JavaScript BN functions, required for RSA private ops. 6 | 7 | // Version 1.1: new BigInteger("0", 10) returns "proper" zero 8 | // Version 1.2: square() API, isProbablePrime fix 9 | 10 | // (public) 11 | function bnClone() { var r = nbi(); this.copyTo(r); return r; } 12 | 13 | // (public) return value as integer 14 | function bnIntValue() { 15 | if(this.s < 0) { 16 | if(this.t == 1) return this[0]-this.DV; 17 | else if(this.t == 0) return -1; 18 | } 19 | else if(this.t == 1) return this[0]; 20 | else if(this.t == 0) return 0; 21 | // assumes 16 < DB < 32 22 | return ((this[1]&((1<<(32-this.DB))-1))<>24; } 27 | 28 | // (public) return value as short (assumes DB>=16) 29 | function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; } 30 | 31 | // (protected) return x s.t. r^x < DV 32 | function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); } 33 | 34 | // (public) 0 if this == 0, 1 if this > 0 35 | function bnSigNum() { 36 | if(this.s < 0) return -1; 37 | else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; 38 | else return 1; 39 | } 40 | 41 | // (protected) convert to radix string 42 | function bnpToRadix(b) { 43 | if(b == null) b = 10; 44 | if(this.signum() == 0 || b < 2 || b > 36) return "0"; 45 | var cs = this.chunkSize(b); 46 | var a = Math.pow(b,cs); 47 | var d = nbv(a), y = nbi(), z = nbi(), r = ""; 48 | this.divRemTo(d,y,z); 49 | while(y.signum() > 0) { 50 | r = (a+z.intValue()).toString(b).substr(1) + r; 51 | y.divRemTo(d,y,z); 52 | } 53 | return z.intValue().toString(b) + r; 54 | } 55 | 56 | // (protected) convert from radix string 57 | function bnpFromRadix(s,b) { 58 | this.fromInt(0); 59 | if(b == null) b = 10; 60 | var cs = this.chunkSize(b); 61 | var d = Math.pow(b,cs), mi = false, j = 0, w = 0; 62 | for(var i = 0; i < s.length; ++i) { 63 | var x = intAt(s,i); 64 | if(x < 0) { 65 | if(s.charAt(i) == "-" && this.signum() == 0) mi = true; 66 | continue; 67 | } 68 | w = b*w+x; 69 | if(++j >= cs) { 70 | this.dMultiply(d); 71 | this.dAddOffset(w,0); 72 | j = 0; 73 | w = 0; 74 | } 75 | } 76 | if(j > 0) { 77 | this.dMultiply(Math.pow(b,j)); 78 | this.dAddOffset(w,0); 79 | } 80 | if(mi) BigInteger.ZERO.subTo(this,this); 81 | } 82 | 83 | // (protected) alternate constructor 84 | function bnpFromNumber(a,b,c) { 85 | if("number" == typeof b) { 86 | // new BigInteger(int,int,RNG) 87 | if(a < 2) this.fromInt(1); 88 | else { 89 | this.fromNumber(a,c); 90 | if(!this.testBit(a-1)) // force MSB set 91 | this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); 92 | if(this.isEven()) this.dAddOffset(1,0); // force odd 93 | while(!this.isProbablePrime(b)) { 94 | this.dAddOffset(2,0); 95 | if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); 96 | } 97 | } 98 | } 99 | else { 100 | // new BigInteger(int,RNG) 101 | var x = new Array(), t = a&7; 102 | x.length = (a>>3)+1; 103 | b.nextBytes(x); 104 | if(t > 0) x[0] &= ((1< 0) { 115 | if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p) 116 | r[k++] = d|(this.s<<(this.DB-p)); 117 | while(i >= 0) { 118 | if(p < 8) { 119 | d = (this[i]&((1<>(p+=this.DB-8); 121 | } 122 | else { 123 | d = (this[i]>>(p-=8))&0xff; 124 | if(p <= 0) { p += this.DB; --i; } 125 | } 126 | if((d&0x80) != 0) d |= -256; 127 | if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; 128 | if(k > 0 || d != this.s) r[k++] = d; 129 | } 130 | } 131 | return r; 132 | } 133 | 134 | function bnEquals(a) { return(this.compareTo(a)==0); } 135 | function bnMin(a) { return(this.compareTo(a)<0)?this:a; } 136 | function bnMax(a) { return(this.compareTo(a)>0)?this:a; } 137 | 138 | // (protected) r = this op a (bitwise) 139 | function bnpBitwiseTo(a,op,r) { 140 | var i, f, m = Math.min(a.t,this.t); 141 | for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]); 142 | if(a.t < this.t) { 143 | f = a.s&this.DM; 144 | for(i = m; i < this.t; ++i) r[i] = op(this[i],f); 145 | r.t = this.t; 146 | } 147 | else { 148 | f = this.s&this.DM; 149 | for(i = m; i < a.t; ++i) r[i] = op(f,a[i]); 150 | r.t = a.t; 151 | } 152 | r.s = op(this.s,a.s); 153 | r.clamp(); 154 | } 155 | 156 | // (public) this & a 157 | function op_and(x,y) { return x&y; } 158 | function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } 159 | 160 | // (public) this | a 161 | function op_or(x,y) { return x|y; } 162 | function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } 163 | 164 | // (public) this ^ a 165 | function op_xor(x,y) { return x^y; } 166 | function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } 167 | 168 | // (public) this & ~a 169 | function op_andnot(x,y) { return x&~y; } 170 | function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } 171 | 172 | // (public) ~this 173 | function bnNot() { 174 | var r = nbi(); 175 | for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i]; 176 | r.t = this.t; 177 | r.s = ~this.s; 178 | return r; 179 | } 180 | 181 | // (public) this << n 182 | function bnShiftLeft(n) { 183 | var r = nbi(); 184 | if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); 185 | return r; 186 | } 187 | 188 | // (public) this >> n 189 | function bnShiftRight(n) { 190 | var r = nbi(); 191 | if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); 192 | return r; 193 | } 194 | 195 | // return index of lowest 1-bit in x, x < 2^31 196 | function lbit(x) { 197 | if(x == 0) return -1; 198 | var r = 0; 199 | if((x&0xffff) == 0) { x >>= 16; r += 16; } 200 | if((x&0xff) == 0) { x >>= 8; r += 8; } 201 | if((x&0xf) == 0) { x >>= 4; r += 4; } 202 | if((x&3) == 0) { x >>= 2; r += 2; } 203 | if((x&1) == 0) ++r; 204 | return r; 205 | } 206 | 207 | // (public) returns index of lowest 1-bit (or -1 if none) 208 | function bnGetLowestSetBit() { 209 | for(var i = 0; i < this.t; ++i) 210 | if(this[i] != 0) return i*this.DB+lbit(this[i]); 211 | if(this.s < 0) return this.t*this.DB; 212 | return -1; 213 | } 214 | 215 | // return number of 1 bits in x 216 | function cbit(x) { 217 | var r = 0; 218 | while(x != 0) { x &= x-1; ++r; } 219 | return r; 220 | } 221 | 222 | // (public) return number of set bits 223 | function bnBitCount() { 224 | var r = 0, x = this.s&this.DM; 225 | for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x); 226 | return r; 227 | } 228 | 229 | // (public) true iff nth bit is set 230 | function bnTestBit(n) { 231 | var j = Math.floor(n/this.DB); 232 | if(j >= this.t) return(this.s!=0); 233 | return((this[j]&(1<<(n%this.DB)))!=0); 234 | } 235 | 236 | // (protected) this op (1<>= this.DB; 259 | } 260 | if(a.t < this.t) { 261 | c += a.s; 262 | while(i < this.t) { 263 | c += this[i]; 264 | r[i++] = c&this.DM; 265 | c >>= this.DB; 266 | } 267 | c += this.s; 268 | } 269 | else { 270 | c += this.s; 271 | while(i < a.t) { 272 | c += a[i]; 273 | r[i++] = c&this.DM; 274 | c >>= this.DB; 275 | } 276 | c += a.s; 277 | } 278 | r.s = (c<0)?-1:0; 279 | if(c > 0) r[i++] = c; 280 | else if(c < -1) r[i++] = this.DV+c; 281 | r.t = i; 282 | r.clamp(); 283 | } 284 | 285 | // (public) this + a 286 | function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } 287 | 288 | // (public) this - a 289 | function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } 290 | 291 | // (public) this * a 292 | function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } 293 | 294 | // (public) this^2 295 | function bnSquare() { var r = nbi(); this.squareTo(r); return r; } 296 | 297 | // (public) this / a 298 | function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } 299 | 300 | // (public) this % a 301 | function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } 302 | 303 | // (public) [this/a,this%a] 304 | function bnDivideAndRemainder(a) { 305 | var q = nbi(), r = nbi(); 306 | this.divRemTo(a,q,r); 307 | return new Array(q,r); 308 | } 309 | 310 | // (protected) this *= n, this >= 0, 1 < n < DV 311 | function bnpDMultiply(n) { 312 | this[this.t] = this.am(0,n-1,this,0,0,this.t); 313 | ++this.t; 314 | this.clamp(); 315 | } 316 | 317 | // (protected) this += n << w words, this >= 0 318 | function bnpDAddOffset(n,w) { 319 | if(n == 0) return; 320 | while(this.t <= w) this[this.t++] = 0; 321 | this[w] += n; 322 | while(this[w] >= this.DV) { 323 | this[w] -= this.DV; 324 | if(++w >= this.t) this[this.t++] = 0; 325 | ++this[w]; 326 | } 327 | } 328 | 329 | // A "null" reducer 330 | function NullExp() {} 331 | function nNop(x) { return x; } 332 | function nMulTo(x,y,r) { x.multiplyTo(y,r); } 333 | function nSqrTo(x,r) { x.squareTo(r); } 334 | 335 | NullExp.prototype.convert = nNop; 336 | NullExp.prototype.revert = nNop; 337 | NullExp.prototype.mulTo = nMulTo; 338 | NullExp.prototype.sqrTo = nSqrTo; 339 | 340 | // (public) this^e 341 | function bnPow(e) { return this.exp(e,new NullExp()); } 342 | 343 | // (protected) r = lower n words of "this * a", a.t <= n 344 | // "this" should be the larger one if appropriate. 345 | function bnpMultiplyLowerTo(a,n,r) { 346 | var i = Math.min(this.t+a.t,n); 347 | r.s = 0; // assumes a,this >= 0 348 | r.t = i; 349 | while(i > 0) r[--i] = 0; 350 | var j; 351 | for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t); 352 | for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i); 353 | r.clamp(); 354 | } 355 | 356 | // (protected) r = "this * a" without lower n words, n > 0 357 | // "this" should be the larger one if appropriate. 358 | function bnpMultiplyUpperTo(a,n,r) { 359 | --n; 360 | var i = r.t = this.t+a.t-n; 361 | r.s = 0; // assumes a,this >= 0 362 | while(--i >= 0) r[i] = 0; 363 | for(i = Math.max(n-this.t,0); i < a.t; ++i) 364 | r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n); 365 | r.clamp(); 366 | r.drShiftTo(1,r); 367 | } 368 | 369 | // Barrett modular reduction 370 | function Barrett(m) { 371 | // setup Barrett 372 | this.r2 = nbi(); 373 | this.q3 = nbi(); 374 | BigInteger.ONE.dlShiftTo(2*m.t,this.r2); 375 | this.mu = this.r2.divide(m); 376 | this.m = m; 377 | } 378 | 379 | function barrettConvert(x) { 380 | if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); 381 | else if(x.compareTo(this.m) < 0) return x; 382 | else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } 383 | } 384 | 385 | function barrettRevert(x) { return x; } 386 | 387 | // x = x mod m (HAC 14.42) 388 | function barrettReduce(x) { 389 | x.drShiftTo(this.m.t-1,this.r2); 390 | if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } 391 | this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); 392 | this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); 393 | while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); 394 | x.subTo(this.r2,x); 395 | while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); 396 | } 397 | 398 | // r = x^2 mod m; x != r 399 | function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } 400 | 401 | // r = x*y mod m; x,y != r 402 | function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } 403 | 404 | Barrett.prototype.convert = barrettConvert; 405 | Barrett.prototype.revert = barrettRevert; 406 | Barrett.prototype.reduce = barrettReduce; 407 | Barrett.prototype.mulTo = barrettMulTo; 408 | Barrett.prototype.sqrTo = barrettSqrTo; 409 | 410 | // (public) this^e % m (HAC 14.85) 411 | function bnModPow(e,m) { 412 | var i = e.bitLength(), k, r = nbv(1), z; 413 | if(i <= 0) return r; 414 | else if(i < 18) k = 1; 415 | else if(i < 48) k = 3; 416 | else if(i < 144) k = 4; 417 | else if(i < 768) k = 5; 418 | else k = 6; 419 | if(i < 8) 420 | z = new Classic(m); 421 | else if(m.isEven()) 422 | z = new Barrett(m); 423 | else 424 | z = new Montgomery(m); 425 | 426 | // precomputation 427 | var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { 430 | var g2 = nbi(); 431 | z.sqrTo(g[1],g2); 432 | while(n <= km) { 433 | g[n] = nbi(); 434 | z.mulTo(g2,g[n-2],g[n]); 435 | n += 2; 436 | } 437 | } 438 | 439 | var j = e.t-1, w, is1 = true, r2 = nbi(), t; 440 | i = nbits(e[j])-1; 441 | while(j >= 0) { 442 | if(i >= k1) w = (e[j]>>(i-k1))&km; 443 | else { 444 | w = (e[j]&((1<<(i+1))-1))<<(k1-i); 445 | if(j > 0) w |= e[j-1]>>(this.DB+i-k1); 446 | } 447 | 448 | n = k; 449 | while((w&1) == 0) { w >>= 1; --n; } 450 | if((i -= n) < 0) { i += this.DB; --j; } 451 | if(is1) { // ret == 1, don't bother squaring or multiplying it 452 | g[w].copyTo(r); 453 | is1 = false; 454 | } 455 | else { 456 | while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } 457 | if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } 458 | z.mulTo(r2,g[w],r); 459 | } 460 | 461 | while(j >= 0 && (e[j]&(1< 0) { 478 | x.rShiftTo(g,x); 479 | y.rShiftTo(g,y); 480 | } 481 | while(x.signum() > 0) { 482 | if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); 483 | if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); 484 | if(x.compareTo(y) >= 0) { 485 | x.subTo(y,x); 486 | x.rShiftTo(1,x); 487 | } 488 | else { 489 | y.subTo(x,y); 490 | y.rShiftTo(1,y); 491 | } 492 | } 493 | if(g > 0) y.lShiftTo(g,y); 494 | return y; 495 | } 496 | 497 | // (protected) this % n, n < 2^26 498 | function bnpModInt(n) { 499 | if(n <= 0) return 0; 500 | var d = this.DV%n, r = (this.s<0)?n-1:0; 501 | if(this.t > 0) 502 | if(d == 0) r = this[0]%n; 503 | else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n; 504 | return r; 505 | } 506 | 507 | // (public) 1/this % m (HAC 14.61) 508 | function bnModInverse(m) { 509 | var ac = m.isEven(); 510 | if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; 511 | var u = m.clone(), v = this.clone(); 512 | var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); 513 | while(u.signum() != 0) { 514 | while(u.isEven()) { 515 | u.rShiftTo(1,u); 516 | if(ac) { 517 | if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } 518 | a.rShiftTo(1,a); 519 | } 520 | else if(!b.isEven()) b.subTo(m,b); 521 | b.rShiftTo(1,b); 522 | } 523 | while(v.isEven()) { 524 | v.rShiftTo(1,v); 525 | if(ac) { 526 | if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } 527 | c.rShiftTo(1,c); 528 | } 529 | else if(!d.isEven()) d.subTo(m,d); 530 | d.rShiftTo(1,d); 531 | } 532 | if(u.compareTo(v) >= 0) { 533 | u.subTo(v,u); 534 | if(ac) a.subTo(c,a); 535 | b.subTo(d,b); 536 | } 537 | else { 538 | v.subTo(u,v); 539 | if(ac) c.subTo(a,c); 540 | d.subTo(b,d); 541 | } 542 | } 543 | if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; 544 | if(d.compareTo(m) >= 0) return d.subtract(m); 545 | if(d.signum() < 0) d.addTo(m,d); else return d; 546 | if(d.signum() < 0) return d.add(m); else return d; 547 | } 548 | 549 | var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]; 550 | var lplim = (1<<26)/lowprimes[lowprimes.length-1]; 551 | 552 | // (public) test primality with certainty >= 1-.5^t 553 | function bnIsProbablePrime(t) { 554 | var i, x = this.abs(); 555 | if(x.t == 1 && x[0] <= lowprimes[lowprimes.length-1]) { 556 | for(i = 0; i < lowprimes.length; ++i) 557 | if(x[0] == lowprimes[i]) return true; 558 | return false; 559 | } 560 | if(x.isEven()) return false; 561 | i = 1; 562 | while(i < lowprimes.length) { 563 | var m = lowprimes[i], j = i+1; 564 | while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; 565 | m = x.modInt(m); 566 | while(i < j) if(m%lowprimes[i++] == 0) return false; 567 | } 568 | return x.millerRabin(t); 569 | } 570 | 571 | // (protected) true if probably prime (HAC 4.24, Miller-Rabin) 572 | function bnpMillerRabin(t) { 573 | var n1 = this.subtract(BigInteger.ONE); 574 | var k = n1.getLowestSetBit(); 575 | if(k <= 0) return false; 576 | var r = n1.shiftRight(k); 577 | t = (t+1)>>1; 578 | if(t > lowprimes.length) t = lowprimes.length; 579 | var a = nbi(); 580 | for(var i = 0; i < t; ++i) { 581 | //Pick bases at random, instead of starting at 2 582 | a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]); 583 | var y = a.modPow(r,this); 584 | if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { 585 | var j = 1; 586 | while(j++ < k && y.compareTo(n1) != 0) { 587 | y = y.modPowInt(2,this); 588 | if(y.compareTo(BigInteger.ONE) == 0) return false; 589 | } 590 | if(y.compareTo(n1) != 0) return false; 591 | } 592 | } 593 | return true; 594 | } 595 | 596 | // protected 597 | BigInteger.prototype.chunkSize = bnpChunkSize; 598 | BigInteger.prototype.toRadix = bnpToRadix; 599 | BigInteger.prototype.fromRadix = bnpFromRadix; 600 | BigInteger.prototype.fromNumber = bnpFromNumber; 601 | BigInteger.prototype.bitwiseTo = bnpBitwiseTo; 602 | BigInteger.prototype.changeBit = bnpChangeBit; 603 | BigInteger.prototype.addTo = bnpAddTo; 604 | BigInteger.prototype.dMultiply = bnpDMultiply; 605 | BigInteger.prototype.dAddOffset = bnpDAddOffset; 606 | BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; 607 | BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; 608 | BigInteger.prototype.modInt = bnpModInt; 609 | BigInteger.prototype.millerRabin = bnpMillerRabin; 610 | 611 | // public 612 | BigInteger.prototype.clone = bnClone; 613 | BigInteger.prototype.intValue = bnIntValue; 614 | BigInteger.prototype.byteValue = bnByteValue; 615 | BigInteger.prototype.shortValue = bnShortValue; 616 | BigInteger.prototype.signum = bnSigNum; 617 | BigInteger.prototype.toByteArray = bnToByteArray; 618 | BigInteger.prototype.equals = bnEquals; 619 | BigInteger.prototype.min = bnMin; 620 | BigInteger.prototype.max = bnMax; 621 | BigInteger.prototype.and = bnAnd; 622 | BigInteger.prototype.or = bnOr; 623 | BigInteger.prototype.xor = bnXor; 624 | BigInteger.prototype.andNot = bnAndNot; 625 | BigInteger.prototype.not = bnNot; 626 | BigInteger.prototype.shiftLeft = bnShiftLeft; 627 | BigInteger.prototype.shiftRight = bnShiftRight; 628 | BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; 629 | BigInteger.prototype.bitCount = bnBitCount; 630 | BigInteger.prototype.testBit = bnTestBit; 631 | BigInteger.prototype.setBit = bnSetBit; 632 | BigInteger.prototype.clearBit = bnClearBit; 633 | BigInteger.prototype.flipBit = bnFlipBit; 634 | BigInteger.prototype.add = bnAdd; 635 | BigInteger.prototype.subtract = bnSubtract; 636 | BigInteger.prototype.multiply = bnMultiply; 637 | BigInteger.prototype.divide = bnDivide; 638 | BigInteger.prototype.remainder = bnRemainder; 639 | BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; 640 | BigInteger.prototype.modPow = bnModPow; 641 | BigInteger.prototype.modInverse = bnModInverse; 642 | BigInteger.prototype.pow = bnPow; 643 | BigInteger.prototype.gcd = bnGCD; 644 | BigInteger.prototype.isProbablePrime = bnIsProbablePrime; 645 | 646 | // JSBN-specific extension 647 | BigInteger.prototype.square = bnSquare; 648 | 649 | // BigInteger interfaces not implemented in jsbn: 650 | 651 | // BigInteger(int signum, byte[] magnitude) 652 | // double doubleValue() 653 | // float floatValue() 654 | // int hashCode() 655 | // long longValue() 656 | // static BigInteger valueOf(long val) 657 | -------------------------------------------------------------------------------- /admin/js/jsrender.min.js: -------------------------------------------------------------------------------- 1 | /*! JsRender v0.9.83 (Beta): http://jsviews.com/#jsrender */ 2 | /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ 3 | !function(e,t){var n=t.jQuery;"object"==typeof exports?module.exports=n?e(t,n):function(n){if(n&&!n.fn)throw"Provide jQuery or null";return e(t,n)}:"function"==typeof define&&define.amd?define(function(){return e(t)}):e(t,!1)}(function(e,t){"use strict";function n(e,t){return function(){var n,r=this,i=r.base;return r.base=e,n=t.apply(r,arguments),r.base=i,n}}function r(e,t){return ee(t)&&(t=n(e?e._d?e:n(s,e):s,t),t._d=1),t}function i(e,t){for(var n in t.props)Ve.test(n)&&(e[n]=r(e[n],t.props[n]))}function o(e){return e}function s(){return""}function a(e){try{throw console.log("JsRender dbg breakpoint: "+e),"dbg breakpoint"}catch(t){}return this.base?this.baseApply(arguments):e}function d(e){this.name=(t.link?"JsViews":"JsRender")+" Error",this.message=e||this.name}function u(e,t){for(var n in t)e[n]=t[n];return e}function l(e,t,n){return e?te(e)?l.apply(X,e):(ae.delimiters=[e,t,ge=n?n.charAt(0):ge],le=e.charAt(0),pe=e.charAt(1),ce=t.charAt(0),fe=t.charAt(1),e="\\"+le+"(\\"+ge+")?\\"+pe,t="\\"+ce+"\\"+fe,G="(?:(\\w+(?=[\\/\\s\\"+ce+"]))|(\\w+)?(:)|(>)|(\\*))\\s*((?:[^\\"+ce+"]|\\"+ce+"(?!\\"+fe+"))*?)",se.rTag="(?:"+G+")",G=new RegExp("(?:"+e+G+"(\\/)?|\\"+le+"(\\"+ge+")?\\"+pe+"(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))"+t,"g"),se.rTmpl=new RegExp("<.*>|([^\\\\]|^)[{}]|"+e+".*"+t),ue):ae.delimiters}function p(e,t){t||e===!0||(t=e,e=void 0);var n,r,i,o,s=this,a=!t||"root"===t;if(e){if(o=t&&s.type===t&&s,!o)if(n=s.views,s._.useKey){for(r in n)if(o=t?n[r].get(e,t):n[r])break}else for(r=0,i=n.length;!o&&r0&&(s=n)){if(!s)if(/^\.\/[^\\:*?"<>]*$/.test(n))(a=ne[e=e||n])?n=a:s=document.getElementById(n);else if(t.fn&&!se.rTmpl.test(n))try{s=t(document).find(n)[0]}catch(d){}s&&(i?n=s.innerHTML:(o=s.getAttribute(Se),o?o!==Ie?(n=ne[o],delete ne[o]):t.fn&&(n=t.data(s)[Ie]):(e=e||(t.fn?Ie:n),n=j(e,s.innerHTML,r,i)),n.tmplName=e=e||o,e!==Ie&&(ne[e]=n),s.setAttribute(Se,e),t.fn&&t.data(s,Ie,n))),s=void 0}else n.fn||(n=void 0);return n}var s,a,d=n=n||"";if(0===i&&(i=void 0,d=o(d)),i=i||(n.markup?n:{}),i.tmplName=e,r&&(i._parentTmpl=r),!d&&n.markup&&(d=o(n.markup))&&d.fn&&(d=d.markup),void 0!==d)return d.fn||n.fn?d.fn&&(a=d):(n=V(d,i),O(d.replace(ye,"\\$&"),n)),a||(a=u(function(){return a.render.apply(a,arguments)},n),b(a)),e&&!r&&e!==Ie&&(Ue[e]=a),a}function C(e,n){return t.isFunction(e)?e.call(n):e}function T(e){var t,n=[],r=e.length;for(t=0;tF-(q||0))){if(q=S.slice(q,F+r.length),J!==!0)if(K=o||p[g-1].bd,P=K[K.length-1],P&&P.prm){for(;P.sb&&P.sb.prm;)P=P.sb;B=P.sb={path:P.sb,bnd:P.bnd}}else K.push(B={path:K.pop()});M=pe+":"+q+" onerror=''"+ce,J=f[M],J||(f[M]=!0,f[M]=J=O(M,n,!0)),J!==!0&&B&&(B._jsv=J,B.prm=l.bd,B.bnd=B.bnd||B.path&&B.path.indexOf("^")>=0)}return d?(d=!V,d?r:A+'"'):a?(a=!R,a?r:A+'"'):(w?(h[g]=F++,l=p[++g]={bd:[]},w):"")+(N?g?"":(c=S.slice(c,F),(i?(i=s=o=!1,"\b"):"\b,")+c+(c=F+r.length,u&&t.push(l.bd=[]),"\b")):k?(g&&I(e),u&&t.pop(),i=_,s=x,c=F+r.length,u&&(u=l.bd=t[i]=[],u.skp=!x),_+":"):_?_.split("^").join(".").replace(we,U)+(C?(l=p[++g]={bd:[]},v[g]=L,C):b):b?b:$?($=v[g]||$,v[g]=!1,l=p[--g],$+(C?(l=p[++g],v[g]=L,C):"")):T?(v[g]||I(e),","):m?"":(d=V,a=R,'"'))}I(e)}var i,o,s,a,d,u=t&&t[0],l={bd:u},p={0:l},c=0,f=(n?n.links:u&&(u.links=u.links||{}))||W.tmpl.links,g=0,v={},h={},m=(e+(n?" ":"")).replace(xe,r);return!g&&m||I(e)}function P(e,t,n){var r,i,o,s,a,d,u,l,p,c,f,g,v,h,m,w,x,_,b,y,k,j,C,T,A,R,$,M,E,N,F=0,S=de.useViews||t.useViews||t.tags||t.templates||t.helpers||t.converters,O="",q={},K=e.length;for(""+t===t?(_=n?'data-link="'+t.replace(_e," ").slice(1,-1)+'"':t,t=0):(_=t.tmplName||"unnamed",t.allowCode&&(q.allowCode=!0),t.debug&&(q.debug=!0),f=t.bnds,x=t.tmpls),r=0;r":s+o):(k&&(b=V(j,q),b.tmplName=_+"/"+o,b.useViews=b.useViews||S,P(k,b),S=b.useViews,x.push(b)),A||(y=o,S=S||o&&(!oe[o]||!oe[o].flow),T=O,O=""),C=e[r+1],C=C&&"else"===C[0]),E=M?";\ntry{\nret+=":"\n+",h="",m="",R&&(g||N||s&&s!==Ne)){if($=new Function("data,view,j,u"," // "+_+" "+F+" "+o+"\nreturn {"+a+"};"),$._er=M,$._tag=o,n)return $;U($,g),w='c("'+s+'",view,',c=!0,h=w+F+",",m=")"}if(O+=R?(n?(M?"try{\n":"")+"return ":E)+(c?(c=void 0,S=p=!0,w+(g?(f[F-1]=$,F):"{"+a+"}")+")"):">"===o?(u=!0,"h("+v[0]+")"):(l=!0,"((v="+v[0]+")!=null?v:"+(n?"null)":'"")'))):(d=!0,"\n{view:view,tmpl:"+(k?x.length:"0")+","+a+"},"),y&&!C){if(O="["+O.slice(0,-1)+"]",w='t("'+y+'",view,this,',n||g){if(O=new Function("data,view,j,u"," // "+_+" "+F+" "+y+"\nreturn "+O+";"),O._er=M,O._tag=y,g&&U(f[F-1]=O,g),n)return O;h=w+F+",undefined,",m=")"}O=T+E+w+(F||O)+")",g=0,y=0}M&&(S=!0,O+=";\n}catch(e){ret"+(n?"urn ":"+=")+h+"j._err(e,view,"+M+")"+m+";}"+(n?"":"ret=ret"))}O="// "+_+"\nvar v"+(d?",t=j._tag":"")+(p?",c=j._cnvt":"")+(u?",h=j._html":"")+(n?";\n":',ret=""\n')+(q.debug?"debugger;":"")+O+(n?"\n":";\nreturn ret;"),ae.debugMode!==!1&&(O="try {\n"+O+"\n}catch(e){\nreturn j._err(e, view);\n}");try{O=new Function("data,view,j,u",O)}catch(B){I("Compiled template code:\n\n"+O+'\n: "'+B.message+'"')}return t&&(t.fn=O,t.useViews=!!S),O}function B(e,t){return e&&e!==t?t?u(u({},t),e):e:t&&u({},t)}function L(e){return Ee[e]||(Ee[e]="&#"+e.charCodeAt(0)+";")}function Q(e){var t,n,r=[];if(typeof e===Fe)for(t in e)n=e[t],t!==Y&&e.hasOwnProperty(t)&&!ee(n)&&r.push({key:t,prop:n});return r}function H(e,n,r){var i=this.jquery&&(this[0]||S("Unknown template")),o=i.getAttribute(Se);return E.call(o?t.data(i)[Ie]:ne(i),e,n,r)}function D(e){return void 0!=e?Ae.test(e)&&(""+e).replace($e,L)||e:""}var Z=t===!1;t=t&&t.fn?t:e.jQuery;var z,G,W,X,Y,ee,te,ne,re,ie,oe,se,ae,de,ue,le,pe,ce,fe,ge,ve,he,me="v0.9.83",we=/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,xe=/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(!*?[#~]?[\w$.^]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?[#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*(([)\]])(?=\s*[.^]|\s*$|[^([])|[)\]])([([]?))|(\s+)/g,_e=/[ \t]*(\r\n|\n|\r)/g,be=/\\(['"])/g,ye=/['"\\]/g,ke=/(?:\x08|^)(onerror:)?(?:(~?)(([\w$_\.]+):)?([^\x08]+))\x08(,)?([^\x08]+)/gi,je=/^if\s/,Ce=/<(\w+)[>\s]/,Te=/[\x00`><"'&=]/g,Ae=/[\x00`><\"'&=]/,Ve=/^on[A-Z]|^convert(Back)?$/,Re=/^\#\d+_`[\s\S]*\/\d+_`$/,$e=Te,Me=0,Ee={"&":"&","<":"<",">":">","\0":"�","'":"'",'"':""","`":"`","=":"="},Ne="html",Fe="object",Se="data-jsv-tmpl",Ie="jsvTmpl",Oe="For #index in nested block use #getIndex().",Ue={},qe=e.jsrender,Je=qe&&t&&!t.render,Ke={template:{compile:j},tag:{compile:y},viewModel:{compile:A},helper:{},converter:{}};if(X={jsviews:me,sub:{View:_,Err:d,tmplFn:O,parse:K,extend:u,extendCtx:B,syntaxErr:I,onStore:{},addSetting:$,settings:{allowCode:!1},advSet:s,_ths:i,_tg:function(){},_cnvt:h,_tag:x,_er:S,_err:F,_html:D,_cp:o,_sq:function(e){return"constructor"===e&&I(""),e}},settings:{delimiters:l,advanced:function(e){return e?(u(de,e),se.advSet(),ue):de}},getCtx:o,map:M},(d.prototype=new Error).constructor=d,c.depends=function(){return[this.get("item"),"index"]},f.depends="index",_.prototype={get:p,getIndex:f,getRsc:w,getTmpl:v,hlp:g,_is:"view"},se=X.sub,ue=X.settings,!(qe||t&&t.render)){for(z in Ke)R(z,Ke[z]);re=X.converters,ie=X.helpers,oe=X.tags,se._tg.prototype={baseApply:k,cvtArgs:m},W=se.topView=new _,t?(t.fn.render=H,Y=t.expando,t.observable&&(u(se,t.views.sub),X.map=t.views.map)):(t={},Z&&(e.jsrender=t),t.renderFile=t.__express=t.compile=function(){throw"Node.js: use npm jsrender, or jsrender-node.js"},t.isFunction=function(e){return"function"==typeof e},t.isArray=Array.isArray||function(e){return"[object Array]"==={}.toString.call(e)},se._jq=function(e){e!==t&&(u(e,t),t=e,t.fn.render=H,delete t.jsrender,Y=t.expando)},t.jsrender=me),ae=se.settings,ae.allowCode=!1,ee=t.isFunction,t.render=Ue,t.views=X,t.templates=ne=X.templates;for(ve in ae)$(ve);(ue.debugMode=function(e){return void 0===e?ae.debugMode:(ae.debugMode=e,ae.onError=e+""===e?new Function("","return '"+e+"';"):ee(e)?e:void 0,ue)})(!1),de=ae.advanced={useViews:!1,_jsv:!1},oe({"if":{render:function(e){var t=this,n=t.tagCtx,r=t.rendering.done||!e&&(arguments.length||!n.index)?"":(t.rendering.done=!0,t.selected=n.index,n.render(n.view,!0));return r},flow:!0},"for":{render:function(e){var t,n=!arguments.length,r=this,i=r.tagCtx,o="",s=0;return r.rendering.done||(t=n?i.view.data:e,void 0!==t&&(o+=i.render(t,n),s+=te(t)?t.length:1),(r.rendering.done=s)&&(r.selected=i.index)),o},flow:!0},props:{baseTag:"for",dataMap:M(Q),flow:!0},include:{flow:!0},"*":{render:o,flow:!0},":*":{render:o,flow:!0},dbg:ie.dbg=re.dbg=a}),re({html:D,attr:D,url:function(e){return void 0!=e?encodeURI(""+e):null===e?e:""}})}return ae=se.settings,te=(t||qe).isArray,ue.delimiters("{{","}}","^"),Je&&qe.views.sub._jq(t),t||qe},window); 4 | //# sourceMappingURL=jsrender.min.js.map 5 | -------------------------------------------------------------------------------- /admin/js/sjcl.js: -------------------------------------------------------------------------------- 1 | "use strict";var sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(a){this.toString=function(){return"CORRUPT: "+this.message};this.message=a},invalid:function(a){this.toString=function(){return"INVALID: "+this.message};this.message=a},bug:function(a){this.toString=function(){return"BUG: "+this.message};this.message=a},notReady:function(a){this.toString=function(){return"NOT READY: "+this.message};this.message=a}}}; 2 | sjcl.cipher.aes=function(a){this.s[0][0][0]||this.O();var b,c,d,e,f=this.s[0][4],g=this.s[1];b=a.length;var h=1;if(4!==b&&6!==b&&8!==b)throw new sjcl.exception.invalid("invalid aes key size");this.b=[d=a.slice(0),e=[]];for(a=b;a<4*b+28;a++){c=d[a-1];if(0===a%b||8===b&&4===a%b)c=f[c>>>24]<<24^f[c>>16&255]<<16^f[c>>8&255]<<8^f[c&255],0===a%b&&(c=c<<8^c>>>24^h<<24,h=h<<1^283*(h>>7));d[a]=d[a-b]^c}for(b=0;a;b++,a--)c=d[b&3?a:a-4],e[b]=4>=a||4>b?c:g[0][f[c>>>24]]^g[1][f[c>>16&255]]^g[2][f[c>>8&255]]^g[3][f[c& 3 | 255]]}; 4 | sjcl.cipher.aes.prototype={encrypt:function(a){return t(this,a,0)},decrypt:function(a){return t(this,a,1)},s:[[[],[],[],[],[]],[[],[],[],[],[]]],O:function(){var a=this.s[0],b=this.s[1],c=a[4],d=b[4],e,f,g,h=[],k=[],l,n,m,p;for(e=0;0x100>e;e++)k[(h[e]=e<<1^283*(e>>7))^e]=e;for(f=g=0;!c[f];f^=l||1,g=k[g]||1)for(m=g^g<<1^g<<2^g<<3^g<<4,m=m>>8^m&255^99,c[f]=m,d[m]=f,n=h[e=h[l=h[f]]],p=0x1010101*n^0x10001*e^0x101*l^0x1010100*f,n=0x101*h[m]^0x1010100*m,e=0;4>e;e++)a[e][f]=n=n<<24^n>>>8,b[e][m]=p=p<<24^p>>>8;for(e= 5 | 0;5>e;e++)a[e]=a[e].slice(0),b[e]=b[e].slice(0)}}; 6 | function t(a,b,c){if(4!==b.length)throw new sjcl.exception.invalid("invalid aes block size");var d=a.b[c],e=b[0]^d[0],f=b[c?3:1]^d[1],g=b[2]^d[2];b=b[c?1:3]^d[3];var h,k,l,n=d.length/4-2,m,p=4,r=[0,0,0,0];h=a.s[c];a=h[0];var q=h[1],v=h[2],w=h[3],x=h[4];for(m=0;m>>24]^q[f>>16&255]^v[g>>8&255]^w[b&255]^d[p],k=a[f>>>24]^q[g>>16&255]^v[b>>8&255]^w[e&255]^d[p+1],l=a[g>>>24]^q[b>>16&255]^v[e>>8&255]^w[f&255]^d[p+2],b=a[b>>>24]^q[e>>16&255]^v[f>>8&255]^w[g&255]^d[p+3],p+=4,e=h,f=k,g=l;for(m= 7 | 0;4>m;m++)r[c?3&-m:m]=x[e>>>24]<<24^x[f>>16&255]<<16^x[g>>8&255]<<8^x[b&255]^d[p++],h=e,e=f,f=g,g=b,b=h;return r} 8 | sjcl.bitArray={bitSlice:function(a,b,c){a=sjcl.bitArray.$(a.slice(b/32),32-(b&31)).slice(1);return void 0===c?a:sjcl.bitArray.clamp(a,c-b)},extract:function(a,b,c){var d=Math.floor(-b-c&31);return((b+c-1^b)&-32?a[b/32|0]<<32-d^a[b/32+1|0]>>>d:a[b/32|0]>>>d)&(1<>b-1,1));return a},partial:function(a,b,c){return 32===a?b:(c?b|0:b<<32-a)+0x10000000000*a},getPartial:function(a){return Math.round(a/0x10000000000)||32},equal:function(a,b){if(sjcl.bitArray.bitLength(a)!==sjcl.bitArray.bitLength(b))return!1;var c=0,d;for(d=0;d>>b),c=a[e]<<32-b;e=a.length?a[a.length-1]:0;a=sjcl.bitArray.getPartial(e);d.push(sjcl.bitArray.partial(b+a&31,32>>24|c>>>8&0xff00|(c&0xff00)<<8|c<<24;return a}}; 11 | sjcl.codec.utf8String={fromBits:function(a){var b="",c=sjcl.bitArray.bitLength(a),d,e;for(d=0;d>>24),e<<=8;return decodeURIComponent(escape(b))},toBits:function(a){a=unescape(encodeURIComponent(a));var b=[],c,d=0;for(c=0;c>>g)>>>e),gn){if(!b)try{return sjcl.codec.base32hex.toBits(a)}catch(p){}throw new sjcl.exception.invalid("this isn't "+m+"!");}h>e?(h-=e,f.push(l^n>>>h),l=n<>>e)>>>26),6>e?(g=a[c]<<6-e,e+=26,c++):(g<<=6,e-=6);for(;d.length&3&&!b;)d+="=";return d},toBits:function(a,b){a=a.replace(/\s|=/g,"");var c=[],d,e=0,f=sjcl.codec.base64.B,g=0,h;b&&(f=f.substr(0,62)+"-_");for(d=0;dh)throw new sjcl.exception.invalid("this isn't base64!");26>>e),g=h<<32-e):(e+=6,g^=h<<32-e)}e&56&&c.push(sjcl.bitArray.partial(e&56,g,1));return c}};sjcl.codec.base64url={fromBits:function(a){return sjcl.codec.base64.fromBits(a,1,1)},toBits:function(a){return sjcl.codec.base64.toBits(a,1)}};sjcl.hash.sha256=function(a){this.b[0]||this.O();a?(this.F=a.F.slice(0),this.A=a.A.slice(0),this.l=a.l):this.reset()};sjcl.hash.sha256.hash=function(a){return(new sjcl.hash.sha256).update(a).finalize()}; 18 | sjcl.hash.sha256.prototype={blockSize:512,reset:function(){this.F=this.Y.slice(0);this.A=[];this.l=0;return this},update:function(a){"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));var b,c=this.A=sjcl.bitArray.concat(this.A,a);b=this.l;a=this.l=b+sjcl.bitArray.bitLength(a);if(0x1fffffffffffffb;c++){e=!0;for(d=2;d*d<=c;d++)if(0===c%d){e= 20 | !1;break}e&&(8>b&&(this.Y[b]=a(Math.pow(c,.5))),this.b[b]=a(Math.pow(c,1/3)),b++)}}}; 21 | function u(a,b){var c,d,e,f=a.F,g=a.b,h=f[0],k=f[1],l=f[2],n=f[3],m=f[4],p=f[5],r=f[6],q=f[7];for(c=0;64>c;c++)16>c?d=b[c]:(d=b[c+1&15],e=b[c+14&15],d=b[c&15]=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+b[c&15]+b[c+9&15]|0),d=d+q+(m>>>6^m>>>11^m>>>25^m<<26^m<<21^m<<7)+(r^m&(p^r))+g[c],q=r,r=p,p=m,m=n+d|0,n=l,l=k,k=h,h=d+(k&l^n&(k^l))+(k>>>2^k>>>13^k>>>22^k<<30^k<<19^k<<10)|0;f[0]=f[0]+h|0;f[1]=f[1]+k|0;f[2]=f[2]+l|0;f[3]=f[3]+n|0;f[4]=f[4]+m|0;f[5]=f[5]+p|0;f[6]=f[6]+r|0;f[7]= 22 | f[7]+q|0} 23 | sjcl.mode.ccm={name:"ccm",G:[],listenProgress:function(a){sjcl.mode.ccm.G.push(a)},unListenProgress:function(a){a=sjcl.mode.ccm.G.indexOf(a);-1k)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(f=2;4>f&&l>>>8*f;f++);f<15-k&&(f=15-k);c=h.clamp(c, 24 | 8*(15-f));b=sjcl.mode.ccm.V(a,b,c,d,e,f);g=sjcl.mode.ccm.C(a,g,c,b,e,f);return h.concat(g.data,g.tag)},decrypt:function(a,b,c,d,e){e=e||64;d=d||[];var f=sjcl.bitArray,g=f.bitLength(c)/8,h=f.bitLength(b),k=f.clamp(b,h-e),l=f.bitSlice(b,h-e),h=(h-e)/8;if(7>g)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(b=2;4>b&&h>>>8*b;b++);b<15-g&&(b=15-g);c=f.clamp(c,8*(15-b));k=sjcl.mode.ccm.C(a,k,c,l,e,b);a=sjcl.mode.ccm.V(a,k.data,c,d,e,b);if(!f.equal(k.tag,a))throw new sjcl.exception.corrupt("ccm: tag doesn't match"); 25 | return k.data},na:function(a,b,c,d,e,f){var g=[],h=sjcl.bitArray,k=h.i;d=[h.partial(8,(b.length?64:0)|d-2<<2|f-1)];d=h.concat(d,c);d[3]|=e;d=a.encrypt(d);if(b.length)for(c=h.bitLength(b)/8,65279>=c?g=[h.partial(16,c)]:0xffffffff>=c&&(g=h.concat([h.partial(16,65534)],[c])),g=h.concat(g,b),b=0;be||16n&&(sjcl.mode.ccm.fa(g/ 27 | k),n+=m),c[3]++,e=a.encrypt(c),b[g]^=e[0],b[g+1]^=e[1],b[g+2]^=e[2],b[g+3]^=e[3];return{tag:d,data:h.clamp(b,l)}}}; 28 | sjcl.mode.ocb2={name:"ocb2",encrypt:function(a,b,c,d,e,f){if(128!==sjcl.bitArray.bitLength(c))throw new sjcl.exception.invalid("ocb iv must be 128 bits");var g,h=sjcl.mode.ocb2.S,k=sjcl.bitArray,l=k.i,n=[0,0,0,0];c=h(a.encrypt(c));var m,p=[];d=d||[];e=e||64;for(g=0;g+4e.bitLength(c)&&(h=f(h,d(h)),c=e.concat(c,[-2147483648,0,0,0]));g=f(g,c); 31 | return a.encrypt(f(d(f(h,d(h))),g))},S:function(a){return[a[0]<<1^a[1]>>>31,a[1]<<1^a[2]>>>31,a[2]<<1^a[3]>>>31,a[3]<<1^135*(a[0]>>>31)]}}; 32 | sjcl.mode.gcm={name:"gcm",encrypt:function(a,b,c,d,e){var f=b.slice(0);b=sjcl.bitArray;d=d||[];a=sjcl.mode.gcm.C(!0,a,f,d,c,e||128);return b.concat(a.data,a.tag)},decrypt:function(a,b,c,d,e){var f=b.slice(0),g=sjcl.bitArray,h=g.bitLength(f);e=e||128;d=d||[];e<=h?(b=g.bitSlice(f,h-e),f=g.bitSlice(f,0,h-e)):(b=f,f=[]);a=sjcl.mode.gcm.C(!1,a,f,d,c,e);if(!g.equal(a.tag,b))throw new sjcl.exception.corrupt("gcm: tag doesn't match");return a.data},ka:function(a,b){var c,d,e,f,g,h=sjcl.bitArray.i;e=[0,0, 33 | 0,0];f=b.slice(0);for(c=0;128>c;c++){(d=0!==(a[Math.floor(c/32)]&1<<31-c%32))&&(e=h(e,f));g=0!==(f[3]&1);for(d=3;0>>1|(f[d-1]&1)<<31;f[0]>>>=1;g&&(f[0]^=-0x1f000000)}return e},j:function(a,b,c){var d,e=c.length;b=b.slice(0);for(d=0;de&&(a=b.hash(a));for(d=0;dd||0>c)throw new sjcl.exception.invalid("invalid params to pbkdf2");"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));"string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));e=e||sjcl.misc.hmac;a=new e(a);var f,g,h,k,l=[],n=sjcl.bitArray;for(k=1;32*l.length<(d||1);k++){e=f=a.encrypt(n.concat(b,[k]));for(g=1;gg;g++)e.push(0x100000000*Math.random()|0);for(g=0;g=1<this.o&&(this.o= 40 | f);this.P++;this.b=sjcl.hash.sha256.hash(this.b.concat(e));this.L=new sjcl.cipher.aes(this.b);for(d=0;4>d&&(this.h[d]=this.h[d]+1|0,!this.h[d]);d++);}for(d=0;d>>1;this.c[g].update([d,this.N++,2,b,f,a.length].concat(a))}break;case "string":void 0===b&&(b=a.length);this.c[g].update([d,this.N++,3,b,f,a.length]);this.c[g].update(a);break;default:k=1}if(k)throw new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string");this.m[g]+=b;this.f+=b;h===this.u&&(this.isReady()!==this.u&&A("seeded",Math.max(this.o,this.f)),A("progress",this.getProgress()))}, 43 | isReady:function(a){a=this.T[void 0!==a?a:this.M];return this.o&&this.o>=a?this.m[0]>this.ba&&(new Date).valueOf()>this.Z?this.J|this.I:this.I:this.f>=a?this.J|this.u:this.u},getProgress:function(a){a=this.T[a?a:this.M];return this.o>=a?1:this.f>a?1:this.f/a},startCollectors:function(){if(!this.D){this.a={loadTimeCollector:B(this,this.ma),mouseCollector:B(this,this.oa),keyboardCollector:B(this,this.la),accelerometerCollector:B(this,this.ea),touchCollector:B(this,this.qa)};if(window.addEventListener)window.addEventListener("load", 44 | this.a.loadTimeCollector,!1),window.addEventListener("mousemove",this.a.mouseCollector,!1),window.addEventListener("keypress",this.a.keyboardCollector,!1),window.addEventListener("devicemotion",this.a.accelerometerCollector,!1),window.addEventListener("touchmove",this.a.touchCollector,!1);else if(document.attachEvent)document.attachEvent("onload",this.a.loadTimeCollector),document.attachEvent("onmousemove",this.a.mouseCollector),document.attachEvent("keypress",this.a.keyboardCollector);else throw new sjcl.exception.bug("can't attach event"); 45 | this.D=!0}},stopCollectors:function(){this.D&&(window.removeEventListener?(window.removeEventListener("load",this.a.loadTimeCollector,!1),window.removeEventListener("mousemove",this.a.mouseCollector,!1),window.removeEventListener("keypress",this.a.keyboardCollector,!1),window.removeEventListener("devicemotion",this.a.accelerometerCollector,!1),window.removeEventListener("touchmove",this.a.touchCollector,!1)):document.detachEvent&&(document.detachEvent("onload",this.a.loadTimeCollector),document.detachEvent("onmousemove", 46 | this.a.mouseCollector),document.detachEvent("keypress",this.a.keyboardCollector)),this.D=!1)},addEventListener:function(a,b){this.K[a][this.ga++]=b},removeEventListener:function(a,b){var c,d,e=this.K[a],f=[];for(d in e)e.hasOwnProperty(d)&&e[d]===b&&f.push(d);for(c=0;cb&&(a.h[b]=a.h[b]+1|0,!a.h[b]);b++);return a.L.encrypt(a.h)} 49 | function B(a,b){return function(){b.apply(a,arguments)}}sjcl.random=new sjcl.prng(6); 50 | a:try{var D,E,F,G;if(G="undefined"!==typeof module&&module.exports){var H;try{H=require("crypto")}catch(a){H=null}G=E=H}if(G&&E.randomBytes)D=E.randomBytes(128),D=new Uint32Array((new Uint8Array(D)).buffer),sjcl.random.addEntropy(D,1024,"crypto['randomBytes']");else if("undefined"!==typeof window&&"undefined"!==typeof Uint32Array){F=new Uint32Array(32);if(window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(F);else if(window.msCrypto&&window.msCrypto.getRandomValues)window.msCrypto.getRandomValues(F); 51 | else break a;sjcl.random.addEntropy(F,1024,"crypto['getRandomValues']")}}catch(a){"undefined"!==typeof window&&window.console&&(console.log("There was an error collecting entropy from the browser:"),console.log(a))} 52 | sjcl.json={defaults:{v:1,iter:1E4,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},ja:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json,f=e.g({iv:sjcl.random.randomWords(4,0)},e.defaults),g;e.g(f,c);c=f.adata;"string"===typeof f.salt&&(f.salt=sjcl.codec.base64.toBits(f.salt));"string"===typeof f.iv&&(f.iv=sjcl.codec.base64.toBits(f.iv));if(!sjcl.mode[f.mode]||!sjcl.cipher[f.cipher]||"string"===typeof a&&100>=f.iter||64!==f.ts&&96!==f.ts&&128!==f.ts||128!==f.ks&&192!==f.ks&&0x100!==f.ks||2>f.iv.length|| 53 | 4=b.iter||64!==b.ts&&96!==b.ts&&128!==b.ts||128!==b.ks&&192!==b.ks&&0x100!==b.ks||!b.iv||2>b.iv.length||4 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Jumbotron Template for Bootstrap 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 36 | 37 | 38 |
39 |
40 |

Hello, world!

41 |

This is a template for a simple marketing or informational website. It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point to create something more unique.

42 |

Learn more »

43 |
44 |
45 | 46 |
47 | 48 |
49 |
50 |

Heading

51 |

Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.

52 |

View details »

53 |
54 |
55 |

Heading

56 |

Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.

57 |

View details »

58 |
59 |
60 |

Heading

61 |

Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.

62 |

View details »

63 |
64 |
65 | 66 |
67 | 68 |
69 |

© Company 2016

70 |
71 |
72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /screenshots/CreateIdentityPool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnpolacek/serverless-cms/b3e1d96853cf280e97b019ff8b57339a312e8980/screenshots/CreateIdentityPool.png -------------------------------------------------------------------------------- /screenshots/IAM-Policy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnpolacek/serverless-cms/b3e1d96853cf280e97b019ff8b57339a312e8980/screenshots/IAM-Policy.png -------------------------------------------------------------------------------- /screenshots/IAM-Role-ManagedPolicies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnpolacek/serverless-cms/b3e1d96853cf280e97b019ff8b57339a312e8980/screenshots/IAM-Role-ManagedPolicies.png -------------------------------------------------------------------------------- /screenshots/IAM-RoleAccess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnpolacek/serverless-cms/b3e1d96853cf280e97b019ff8b57339a312e8980/screenshots/IAM-RoleAccess.png -------------------------------------------------------------------------------- /screenshots/IAM-RoleName.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnpolacek/serverless-cms/b3e1d96853cf280e97b019ff8b57339a312e8980/screenshots/IAM-RoleName.png -------------------------------------------------------------------------------- /screenshots/ServerlessCMS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnpolacek/serverless-cms/b3e1d96853cf280e97b019ff8b57339a312e8980/screenshots/ServerlessCMS.png -------------------------------------------------------------------------------- /screenshots/UserPool-CreateUser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnpolacek/serverless-cms/b3e1d96853cf280e97b019ff8b57339a312e8980/screenshots/UserPool-CreateUser.png -------------------------------------------------------------------------------- /screenshots/UserPools-AppAccess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnpolacek/serverless-cms/b3e1d96853cf280e97b019ff8b57339a312e8980/screenshots/UserPools-AppAccess.png --------------------------------------------------------------------------------