trusted-setup-server/_nuxt/e33d27e735b8d7ed81d1.js
2020-05-14 07:03:36 +03:00

1 line
15 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{370:function(t,e,n){"use strict";n(89),n(27),n(28),n(16),n(64),n(40),n(116),n(22);var o=n(48),r=n(65);function c(object,t){var e=Object.keys(object);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(object);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(object,t).enumerable}))),e.push.apply(e,n)}return e}function l(t){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?c(Object(source),!0).forEach((function(e){Object(o.a)(t,e,source[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(source)):c(Object(source)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(source,e))}))}return t}var m={computed:l(l({},Object(r.c)("user",["isLoggedIn","hasErrorName"])),{},{userName:{get:function(){return this.$store.state.user.name},set:function(t){this.$store.commit("user/SET_NAME",t)}},userCompany:{get:function(){return this.$store.state.user.company},set:function(t){this.$store.commit("user/SET_COMPANY",t)}}}),methods:l(l({},Object(r.b)("user",["makeTweet","logInVia","logOut"])),{},{restrictSymbols:function(t){var e=new RegExp("[^0-9a-zA-Z\\x20]","g");this[t]=this[t].replace(e,"")}})},d=n(10),component=Object(d.a)(m,(function(){var t,e=this,n=e.$createElement,o=e._self._c||n;return o("div",{staticClass:"form"},[e.isLoggedIn?o("div",{staticClass:"fields"},[o("button",{staticClass:"button is-icon logout",on:{click:e.logOut}},[o("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"}},[o("path",{attrs:{fill:"#94febf",d:"M14.08,15.59L16.67,13H7V11H16.67L14.08,8.41L15.5,7L20.5,12L15.5,17L14.08,15.59M19,3A2,2 0 0,1 21,5V9.67L19,7.67V5H5V19H19V16.33L21,14.33V19A2,2 0 0,1 19,21H5C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H19Z"}})])]),e._v(" "),o("b-field",{attrs:{type:{"is-danger":e.hasErrorName.invalid},message:(t={},t[e.hasErrorName.msg]=e.hasErrorName.invalid,t),label:"Name"}},[o("b-input",{attrs:{maxlength:"35"},on:{blur:function(t){return e.restrictSymbols("userName")}},model:{value:e.userName,callback:function(t){e.userName=t},expression:"userName"}})],1),e._v(" "),o("b-field",{attrs:{label:"Project"}},[o("b-input",{attrs:{maxlength:"35"},on:{blur:function(t){return e.restrictSymbols("userCompany")}},model:{value:e.userCompany,callback:function(t){e.userCompany=t},expression:"userCompany"}})],1)],1):o("div",{staticClass:"buttons"},[o("b-button",{attrs:{type:"is-primary",outlined:"",expanded:""},on:{click:function(t){return e.logInVia("twitter")}}},[e._v("\n Sign in with Twitter\n ")]),e._v(" "),o("b-button",{attrs:{type:"is-primary",outlined:"",expanded:""},on:{click:function(t){return e.logInVia("github")}}},[e._v("\n Sign in with Github\n ")])],1)])}),[],!1,null,null,null);e.a=component.exports},372:function(t,e,n){"use strict";n.r(e);n(89),n(27),n(28),n(64),n(23);var o=n(3),r=(n(22),n(48)),c=(n(29),n(30),n(117),n(16),n(65)),l=n(10),m=Object(l.a)({},(function(){var t=this.$createElement,e=this._self._c||t;return e("svg",{staticClass:"cloak",attrs:{xmlns:"http://www.w3.org/2000/svg",width:"147",height:"147"}},[e("path",{attrs:{fill:"#FFF","fill-opacity":".051","fill-rule":"evenodd",stroke:"#393939",d:"M121.872 93.745c-12.959 4.013-30.138 6.224-48.372 6.224-18.234 0-35.413-2.211-48.372-6.224C10.978 89.363 3.5 83.367 3.5 76.404c0-6.941 7.379-12.887 21.365-17.255V18.618c0-4.51 1.993-8.749 5.466-11.631a15.118 15.118 0 0 1 12.453-3.233c.055.01.109.022.162.035.23.057 23.042 5.727 30.554 5.727 7.515 0 30.324-5.67 30.553-5.727.054-.013.108-.025.162-.035a15.12 15.12 0 0 1 12.453 3.234 15.065 15.065 0 0 1 5.466 11.63v40.531C136.12 63.517 143.5 69.463 143.5 76.404c0 6.963-7.479 12.959-21.628 17.341zm-5.215-75.127a9.619 9.619 0 0 0-3.489-7.424 9.65 9.65 0 0 0-7.873-2.078c-1.801.448-23.78 5.869-31.795 5.869S43.505 9.564 41.704 9.116a9.644 9.644 0 0 0-7.872 2.078 9.615 9.615 0 0 0-3.489 7.424v21.033c11.728 2.946 26.415 4.56 41.652 4.56 8.92 0 17.57-.538 25.712-1.599a2.735 2.735 0 0 1 .709 5.423c-8.376 1.091-17.265 1.645-26.421 1.645-15.102 0-29.727-1.553-41.652-4.398v4.231c11.727 2.946 26.414 4.56 41.652 4.56 16.722 0 32.476-1.9 44.662-5.363V18.618zm0 45.659c-12.132 3.026-27.225 4.683-42.827 4.683-9.158 0-18.048-.553-26.421-1.645a2.734 2.734 0 1 1 .709-5.423c8.139 1.061 16.79 1.599 25.712 1.599 15.751 0 30.913-1.724 42.827-4.862v-4.243c-12.442 3.335-28.124 5.156-44.662 5.156-15.103 0-29.728-1.552-41.652-4.397v13.398c11.727 2.946 26.414 4.559 41.652 4.559 16.721 0 32.477-1.898 44.662-5.361v-3.464zm5.477.623v4.883a2.737 2.737 0 0 1-1.932 2.613c-12.935 3.982-30.055 6.175-48.207 6.175a217.716 217.716 0 0 1-15.302-.539c-.996-.071-1.987-.149-2.972-.234-9.843-.848-19.03-2.379-26.838-4.507a2.735 2.735 0 0 1-2.018-2.638V64.9c-9.891 3.34-15.888 7.63-15.888 11.504 0 4.079 6.811 8.722 17.773 12.117 12.449 3.855 29.051 5.978 46.75 5.978 17.698 0 34.301-2.122 46.749-5.978 10.963-3.395 17.773-8.038 17.773-12.117 0-3.874-5.997-8.164-15.888-11.504zm-83.699.183a2.724 2.724 0 0 1-.985.407 2.666 2.666 0 0 1-1.581-.156 2.742 2.742 0 0 1-.89-.59 2.755 2.755 0 0 1-.802-1.933c0-.178.019-.359.055-.534a2.67 2.67 0 0 1 .156-.511c.068-.167.153-.325.252-.473a2.61 2.61 0 0 1 .755-.755c.148-.101.307-.183.474-.251a2.72 2.72 0 0 1 2.095 0c.165.068.323.15.471.251a2.754 2.754 0 0 1 1.168 1.739 2.755 2.755 0 0 1-.751 2.467c-.126.126-.266.24-.417.339zm67.946-22.6a2.838 2.838 0 0 1 .591-.887 2.764 2.764 0 0 1 2.471-.746c.175.033.347.087.512.156.167.068.326.153.473.251a2.685 2.685 0 0 1 1.009 1.226 2.793 2.793 0 0 1 .21 1.047 2.74 2.74 0 0 1-1.219 2.275 2.796 2.796 0 0 1-.985.404 2.674 2.674 0 0 1-1.583-.156 2.895 2.895 0 0 1-.471-.248 2.824 2.824 0 0 1-.417-.342 2.742 2.742 0 0 1-.591-.889 2.829 2.829 0 0 1-.159-.511 2.736 2.736 0 0 1 .159-1.58zm-73.369 64.922h80.976c6.569 0 11.913 5.336 11.914 11.895v11.758c0 6.861-5.59 12.442-12.461 12.442h-17.75c-11.008 0-19.963-8.942-19.963-19.932v-10.694h-4.455v10.694c0 10.991-8.956 19.932-19.964 19.932H33.56c-6.871 0-12.461-5.581-12.461-12.442V119.3c0-6.559 5.344-11.895 11.913-11.895zm48.192 16.163c0 7.975 6.499 14.463 14.486 14.463h17.75c3.851 0 6.984-3.128 6.983-6.973V119.3c0-3.544-2.887-6.426-6.436-6.426H81.204v10.694zm-54.628 7.49c0 3.845 3.133 6.973 6.983 6.973h17.75c7.988 0 14.486-6.488 14.486-14.463h-.001v-10.694H33.012c-3.549 0-6.436 2.882-6.436 6.426v11.758zm12.839-15.392a2.742 2.742 0 0 1 3.872 0 2.733 2.733 0 0 1 .001 3.868l-8.856 8.841a2.73 2.73 0 0 1-1.936.801 2.733 2.733 0 0 1-1.937-4.668l8.856-8.842zm50.445 12.709a2.73 2.73 0 0 1-1.936.801 2.733 2.733 0 0 1-1.937-4.668l8.855-8.842a2.743 2.743 0 0 1 3.873 0 2.732 2.732 0 0 1 0 3.868l-8.855 8.841z"}})])}),[],!1,null,null,null).exports,d=n(370);function h(object,t){var e=Object.keys(object);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(object);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(object,t).enumerable}))),e.push.apply(e,n)}return e}function v(t){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?h(Object(source),!0).forEach((function(e){Object(r.a)(t,e,source[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(source)):h(Object(source)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(source,e))}))}return t}var y=function(t){return new Promise((function(e){return setTimeout(e,t)}))};function f(t){return Array.prototype.map.call(new Uint8Array(t),(function(t){return("00"+t.toString(16)).slice(-2)})).join("")}var w={components:{Cloak:m,Form:d.a},data:function(){return{isContributeBtnSnown:!1,status:{type:"",msg:""},contributionHash:null,authorizeLink:null}},computed:v(v({},Object(c.c)("user",["isLoggedIn","hasErrorName"])),{},{userName:{get:function(){return this.$store.state.user.name},set:function(t){this.$store.commit("user/SET_NAME",t)}},userHandle:{get:function(){return this.$store.state.user.handle},set:function(t){this.$store.commit("user/SET_HANDLE",t)}},userCompany:{get:function(){return this.$store.state.user.company},set:function(t){this.$store.commit("user/SET_COMPANY",t)}},contributionType:{get:function(){return this.$store.state.user.contributionType},set:function(t){this.$store.commit("user/SET_CONTRIBUTION_TYPE",t)}},isContributeBtnDisabled:function(){return!this.contributionType||!this.isLoggedIn&&"anonymous"!==this.contributionType||this.hasErrorName.invalid}}),mounted:function(){var t=this;return Object(o.a)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.$root.$emit("enableLoading"),e.next=3,t.getUserData();case 3:setTimeout((function(){t.$root.$emit("disableLoading")}),800);case 4:case"end":return e.stop()}}),e)})))()},methods:v(v({},Object(c.b)("user",["makeTweet","logOut","getUserData"])),{},{getUserRandom:function(){var t=this;this.$buefy.dialog.prompt({title:"Contribution",message:"Please provide your random input that will be used as a source of entropy for your contribution along with browser's RNG.",inputAttrs:{maxlength:300},confirmText:"Contribute",trapFocus:!0,onConfirm:function(e){t.makeContribution({userInput:e})}})},makeContribution:function(){var t=arguments,e=this;return Object(o.a)(regeneratorRuntime.mark((function n(){var o,r,c,l,m,data,d,h,v,w,C,i,O,_,k,x,j,T;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o=t.length>0&&void 0!==t[0]?t[0]:{},r=o.userInput,c=o.retry,l=void 0===c?0:c,n.prev=1,n.next=4,e.$contribute();case 4:return m=n.sent,e.isContributeBtnSnown=!0,e.status.msg="",e.status.type="",e.$root.$emit("enableLoading","Downloading last contribution"),n.next=11,fetch("api/challenge");case 11:return data=n.sent,n.t0=Uint8Array,n.next=15,data.arrayBuffer();case 15:return n.t1=n.sent,data=new n.t0(n.t1),e.$root.$emit("enableLoading","Generating random contribution. Your browser may appear unresponsive. It can take a minute or so to complete"),n.next=20,y(100);case 20:return console.log("Source params",data),d=new TextEncoder("utf-8").encode(r),n.next=24,window.crypto.subtle.digest("SHA-256",d);case 24:for(h=n.sent,v=new Uint8Array(h),w=window.crypto.getRandomValues(new Uint8Array(32)),C=new Uint8Array(w.length),i=0;i<w.length;i++)C[i]=w[i]+v[i];return n.next=31,e.sleep(100);case 31:return O=m(data,C),console.log("Updated params",O),_="0x"+f(O.slice(0,64)),k=O.slice(64),console.log("hash",_),console.log("contribution",k),e.$root.$emit("enableLoading","Uploading and verifying your contribution"),(x=new FormData).append("response",new Blob([k],{type:"application/octet-stream"})),"anonymous"!==e.contributionType&&(x.append("name",e.userName),x.append("company",e.userCompany)),n.next=43,fetch("api/response",{method:"POST",body:x});case 43:if(!(j=n.sent).ok){n.next=55;break}return n.next=47,j.json();case 47:T=n.sent,e.$store.commit("user/SET_CONTRIBUTION_INDEX",T.contributionIndex),e.status.msg="Your contribution has been verified and recorded.",e.status.type="is-success",e.contributionHash=_,"anonymous"===e.contributionType&&(e.authorizeLink="".concat(window.location.origin,"/authorize-contribution?token=").concat(T.token)),n.next=70;break;case 55:if(422!==j.status){n.next=67;break}if(!(l<3)){n.next=62;break}return console.log("Looks like someone else uploaded contribution ahead of us, retrying"),n.next=60,e.makeContribution({userInput:r,retry:l++});case 60:n.next=65;break;case 62:e.status.msg="Failed to upload your contribution after ".concat(l," attempts"),e.status.type="is-danger",e.isContributeBtnSnown=!1;case 65:n.next=70;break;case 67:e.status.msg="Error uploading your contribution",e.status.type="is-danger",e.isContributeBtnSnown=!1;case 70:n.next=78;break;case 72:n.prev=72,n.t2=n.catch(1),console.error(n.t2),e.status.msg=n.t2.message,e.status.type="is-danger",e.isContributeBtnSnown=!1;case 78:return n.prev=78,e.$root.$emit("disableLoading"),n.finish(78);case 81:case"end":return n.stop()}}),n,null,[[1,72,78,81]])})))()},onAnonymousHandler:function(){this.logOut(),this.contributionType="anonymous"},copyContributionHash:function(){var t=this;navigator.clipboard.writeText(this.contributionHash).then((function(){t.$buefy.toast.open({message:"Copied!",type:"is-primary"})}))},sleep:function(t){return new Promise((function(e){return setTimeout(e,t)}))}})},C=Object(l.a)(w,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"ceremony"},[n("h1",{staticClass:"title is-size-1 is-size-2-mobile is-spaced"},[t._v("\n Hello, "),n("span",[t._v("@"+t._s(t.userHandle))])]),t._v(" "),n("h2",{staticClass:"subtitle"},[t._v("\n How would you like to contribute to the Tornado.cash Trusted Setup Ceremony?\n ")]),t._v(" "),n("fieldset",{attrs:{disabled:"is-success"===t.status.type}},[n("div",{staticClass:"columns is-centered"},[n("div",{staticClass:"column is-one-third"},[n("button",{staticClass:"box box-anonymous",class:{"is-hovered":"anonymous"===t.contributionType},on:{click:t.onAnonymousHandler}},[n("div",{staticClass:"title is-5"},[t._v("Anonymously")]),t._v(" "),n("Cloak")],1)]),t._v(" "),n("div",{staticClass:"column is-one-third"},[n("div",{staticClass:"box",class:{"is-hovered":t.isLoggedIn}},[n("div",{staticClass:"title is-5"},[t._v("By using social account")]),t._v(" "),n("Form")],1)])])]),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.contributionHash,expression:"contributionHash"}],staticClass:"status"},[n("div",{staticClass:"label"},[t._v("Your contribution hash (Blake2b)")]),t._v(" "),n("b-field",{staticClass:"has-addons contribution-hash",attrs:{position:"is-centered"}},[n("b-input",{attrs:{value:t.contributionHash,icon:"copy",readonly:""},nativeOn:{click:function(e){return t.copyContributionHash(e)}}})],1)],1),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:""!==t.status.type,expression:"status.type !== ''"}],staticClass:"status"},[n("div",{staticClass:"status-message",class:t.status.type},[t._v(t._s(t.status.msg))]),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:"is-success"===t.status.type&&"anonymous"!==t.contributionType,expression:"status.type === 'is-success' && contributionType !== 'anonymous'"}],staticClass:"status-message is-success"},[t._v("\n And now you can post your attestation to Twitter.\n "),n("div",{staticClass:"buttons is-centered"},[n("b-button",{attrs:{type:"is-primary",tag:"a",target:"_blank",outlined:""},on:{click:t.makeTweet}},[t._v("\n Post attestation\n ")])],1)])]),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.authorizeLink,expression:"authorizeLink"}],staticClass:"status"},[t._v("\n You can still provide identity for your contribution by following\n "),n("a",{staticClass:"has-text-primary",attrs:{href:t.authorizeLink}},[t._v("this link")]),t._v(".\n ")]),t._v(" "),n("div",{staticClass:"buttons is-centered"},[t.isContributeBtnSnown?t._e():n("b-button",{attrs:{disabled:t.isContributeBtnDisabled,type:"is-primary",outlined:""},on:{click:t.getUserRandom}},[t._v("\n Contribute\n ")])],1),t._v(" "),n("p",{staticClass:"p"},[t._v("\n If you dont trust binaries, we encorage you to follow these\n "),n("router-link",{attrs:{to:"/instructions"}},[t._v("instructions")]),t._v(" to contribute by compiling from the\n source code. It is fairly easy!\n ")],1)])}),[],!1,null,null,null);e.default=C.exports}}]);