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.
nextcloud-server/dist/settings-vue-settings-perso...

2 lines
42 KiB

(()=>{var e,n,r,i={96846:(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 void 0!==window?.PublicKeyCredential&&"function"==typeof window.PublicKeyCredential}function l(t){const{id:e}=t;return{...t,id:s(e),transports:t.transports}}class u extends Error{constructor({message:t,code:e,cause:n,name:r}){super(t,{cause:n}),this.name=r??n.name,this.code=e}}const d=new class{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}}},p=["cross-platform","platform"];function h(t){if(t&&!(p.indexOf(t)<0))return t}function f(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 v=r(56760),g=r(80910),m=r(10854),y=r.n(m),A=r(85168),b=r(18740),w=r(82182);const _=(0,r(35947).YK)().setApp("settings").detectUser().build();var x=r(53334),R=r(63814),E=r(65043);r(51257);const C=t=>e=>(_.debug(t),e),I=Object.freeze({READY:1,REGISTRATION:2,NAMING:3,PERSIST:4}),W={name:"AddDevice",components:{NcButton:b.A,NcTextField:w.A},props:{httpWarning:Boolean,isHttps:{type:Boolean,default:!1},isLocalhost:{type:Boolean,default:!1}},setup:()=>({RegistrationSteps:I}),data:()=>({name:"",credential:{},step:I.READY}),watch:{step(){this.step===I.NAMING&&this.$nextTick((()=>this.$refs.nameInput?.focus()))}},methods:{async start(){this.step=I.REGISTRATION,console.debug("Starting WebAuthn registration");try{await(0,v.C)(),this.credential=await async function(){const t=(0,R.Jv)("/settings/api/personal/webauthn/registration");try{_.debug("Fetching webauthn registration data");const{data:e}=await E.Ay.get(t);return _.debug("Start webauthn registration"),await async function(t){if(!c())throw new Error("WebAuthn is not supported in this browser");const e={publicKey:{...t,challenge:s(t.challenge),user:{...t.user,id:s(t.user.id)},excludeCredentials:t.excludeCredentials?.map(l)}};let n;e.signal=d.createNewAbortSignal();try{n=await navigator.credentials.create(e)}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 u({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 u({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if("required"===n.authenticatorSelection?.userVerification)return new u({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if("InvalidStateError"===t.name)return new u({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if("NotAllowedError"===t.name)return new u({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if("NotSupportedError"===t.name)return 0===n.pubKeyCredParams.filter((t=>"public-key"===t.type)).length?new u({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new u({message:"No available authenticator supported any of the specified pubKeyCredParams al
//# sourceMappingURL=settings-vue-settings-personal-webauthn.js.map?v=a4e0db75160e3b3308a8