You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
43 KiB

  1. (()=>{var e,n,r,i={74308:(e,n,r)=>{"use strict";var i=r(85471),a=r(32981);function o(t){const e=new Uint8Array(t);let n="";for(const t of e)n+=String.fromCharCode(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function s(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),n=(4-e.length%4)%4,r=e.padEnd(e.length+n,"="),i=atob(r),a=new ArrayBuffer(i.length),o=new Uint8Array(a);for(let t=0;t<i.length;t++)o[t]=i.charCodeAt(t);return a}function c(){return l.stubThis(void 0!==globalThis?.PublicKeyCredential&&"function"==typeof globalThis.PublicKeyCredential)}const l={stubThis:t=>t};function u(t){const{id:e}=t;return{...t,id:s(e),transports:t.transports}}class d extends Error{constructor({message:t,code:e,cause:n,name:r}){super(t,{cause:n}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=r??n.name,this.code=e}}const p=new class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){const t=new Error("Cancelling existing WebAuthn API call for new one");t.name="AbortError",this.controller.abort(t)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}},h=["cross-platform","platform"];function f(t){if(t&&!(h.indexOf(t)<0))return t}function v(t,e){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${t}. You should report this error to them.\n`,e)}var g=r(56760),m=r(40083),A=r(10854),y=r.n(A),b=r(85168),w=r(70995),_=r(82182);const x=(0,r(35947).YK)().setApp("settings").detectUser().build();var R=r(53334),E=r(63814),C=r(65043);r(51257);const I=t=>e=>(x.debug(t),e),O=Object.freeze({READY:1,REGISTRATION:2,NAMING:3,PERSIST:4}),W={name:"AddDevice",components:{NcButton:w.A,NcTextField:_.A},props:{httpWarning:Boolean,isHttps:{type:Boolean,default:!1},isLocalhost:{type:Boolean,default:!1}},setup:()=>({RegistrationSteps:O}),data:()=>({name:"",credential:{},step:O.READY}),watch:{step(){this.step===O.NAMING&&this.$nextTick((()=>this.$refs.nameInput?.focus()))}},methods:{async start(){this.step=O.REGISTRATION,console.debug("Starting WebAuthn registration");try{await(0,g.C5)(),this.credential=await async function(){const t=(0,E.Jv)("/settings/api/personal/webauthn/registration");try{x.debug("Fetching webauthn registration data");const{data:e}=await C.Ay.get(t);return x.debug("Start webauthn registration"),await async function(t){const{optionsJSON:e,useAutoRegister:n=!1}=t;if(!c())throw new Error("WebAuthn is not supported in this browser");const r={...e,challenge:s(e.challenge),user:{...e.user,id:s(e.user.id)},excludeCredentials:e.excludeCredentials?.map(u)},i={};let a;n&&(i.mediation="conditional"),i.publicKey=r,i.signal=p.createNewAbortSignal();try{a=await navigator.credentials.create(i)}catch(t){throw function({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if("AbortError"===t.name){if(e.signal instanceof AbortSignal)return new d({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if("ConstraintError"===t.name){if(!0===n.authenticatorSelection?.requireResidentKey)return new d({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if("conditional"===e.mediation&&"required"===n.authenticatorSelection?.userVerification)return new d({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if("required"===n.authenticatorSelection?.userVerification)return new d({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}e
  2. //# sourceMappingURL=settings-vue-settings-personal-webauthn.js.map?v=eea1028688807c16c480