You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud/dist/settings-vue-settings-perso...

3 lines
22 KiB
JavaScript

/*! For license information please see settings-vue-settings-personal-webauthn.js.LICENSE.txt */
!function(){"use strict";var e,n={98044:function(e,n,r){var i=r(20144),a=r(79954),o=r(10128),s=(r(65509),r(66415)),c=r.n(s),u=(0,r(17499).IY)().setApp("settings").detectUser().build(),d=r(4820),l=r(79753);function p(t,e,n,r,i,a,o){try{var s=t[a](o),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(r,i)}function h(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(t){p(a,r,i,o,s,"next",t)}function s(t){p(a,r,i,o,s,"throw",t)}o(void 0)}))}}function g(){return(g=h(regeneratorRuntime.mark((function t(){var e,n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=(0,l.generateUrl)("/settings/api/personal/webauthn/registration"),t.next=3,d.default.get(e);case 3:return n=t.sent,t.abrupt("return",n.data);case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function v(t,e){return f.apply(this,arguments)}function f(){return(f=h(regeneratorRuntime.mark((function t(e,n){var r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=(0,l.generateUrl)("/settings/api/personal/webauthn/registration"),t.next=3,d.default.post(r,{name:e,data:n});case 3:return i=t.sent,t.abrupt("return",i.data);case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function A(t){return m.apply(this,arguments)}function m(){return(m=h(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=(0,l.generateUrl)("/settings/api/personal/webauthn/registration/".concat(e)),t.next=3,d.default.delete(n);case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function b(t,e,n,r,i,a,o){try{var s=t[a](o),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(r,i)}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var y=function(t){return function(e){return u.debug(t),e}},R=Object.freeze({READY:1,REGISTRATION:2,NAMING:3,PERSIST:4}),S={name:"AddDevice",props:{httpWarning:Boolean,isHttps:{type:Boolean,default:!1},isLocalhost:{type:Boolean,default:!1}},data:function(){return{name:"",credential:{},RegistrationSteps:R,step:R.READY}},methods:{arrayToBase64String:function(t){return btoa(String.fromCharCode.apply(String,function(t){if(Array.isArray(t))return w(t)}(e=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return w(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()));var e},start:function(){var t=this;return this.step=R.REGISTRATION,console.debug("Starting WebAuthn registration"),(0,o.confirmPassword)().then(this.getRegistrationData).then(this.register.bind(this)).then((function(){t.step=R.NAMING})).catch((function(e){console.error(e.name,e.message),t.step=R.READY}))},getRegistrationData:function(){return console.debug("Fetching webauthn registration data"),function(){return g.apply(this,arguments)}().then((function(t){return console.debug(t),t.challenge=Uint8Array.from(function(t){var e=(t=t.replace(/-/g,"+").replace(/_/g,"/")).length%4;if(e){if(1===e)throw new Error("InvalidLengthError: Input base64url string is the wrong length to determine padding");t+=new Array(5-e).join("=")}return window.atob(t)}(t.challenge),(function(t){return t.charCodeAt(0)})),t.user.id=Uint8Array.from(t.user.id,(function(t){return t.charCodeAt(0)})),t})).catch((function(e){throw console.error("Error getting webauthn registration data from server",e),new Error(t("settings","Server error while trying to add WebAuthn device"))}))},register:function(t){var e=this;return console.debug("starting webauthn regist
//# sourceMappingURL=settings-vue-settings-personal-webauthn.js.map?v=57ddd8c71ddf60951140