%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /www/varak.net/nextcloud.varak.net/apps_old/apps/passwords/js/Static/
Upload File :
Create Path :
Current File : //www/varak.net/nextcloud.varak.net/apps_old/apps/passwords/js/Static/8498.9739cd97902a327c3f02.js

/*! For license information please see 8498.9739cd97902a327c3f02.js.LICENSE.txt */
"use strict";(self.webpackChunkncpasswords=self.webpackChunkncpasswords||[]).push([[8498],{62319:(s,t,e)=>{e.d(t,{A:()=>d});var a=e(33277),r=e(80444),n=e(89843),o=e(18221),i=e(92457),l=e(69159);class d{static isWebauthnPasswordAvailable(){return!!window.PasswordCredential}async run(s=null){if(d.isWebauthnPasswordAvailable()){null===s&&(s=(await this._showSetupDialog()).password);try{await this._storeEncryptionPassphrase(s),n.A.set("client.encryption.webauthn.enabled",!0),o.A.success("WebauthnLoginSetupSuccess")}catch(s){l.A.error(s)}}}async _storeEncryptionPassphrase(s){let t=r.A.translate("Passwords App Encryption Passphrase"),e=`${(0,i.HW)().uid}.passwordsapp@${location.host}`,a=n.A.get("server.theme.app.icon");const o=new PasswordCredential({id:e,password:s,name:t,iconURL:a});await navigator.credentials.store(o)}_showSetupDialog(){return a.A.form({password:{label:"WebauthnEncryptionPassphrase",type:"password",button:"toggle",minlength:12,required:!0,validator:(s,t)=>s!==t.oldPassword&&s.length>=12},repeatPassword:{label:"WebauthnEncryptionPassphraseRepeat",type:"password",button:"toggle",required:!0,validator:(s,t)=>s===t.password}},"WebauthnEncryptionSetupTitle","WebauthnEncryptionPassphraseText")}}},98498:(s,t,e)=>{e.d(t,{A:()=>g});var a=e(56423),r=e(5460),n=e(41603),o=e(34413),i=e(90512),l=e(33277),d=e(69159),c=e(89843),u=e(80444),h=e(38613),p=e(61338),w=e(62319);const g=new class{constructor(){this._statusFunc=null,this.status=null}async install(s,t=!1,e=!1,a=null){if(await this.isPassphraseSecure(s)){if(this._resetStatus(a),await this._updateKeychain(s),!1!==e){let s={},t={};await Promise.all([this._encryptTags(s),this._encryptFolders(t)]),await this._encryptPasswords(t,s),await this._cleanDatabase(s,t)}t&&await this._saveMasterPassword(s),r.A.loginRequired=!0,(0,p.Ic)("passwords:encryption:installed",{})}}async update(s,t){try{if(!await this.isPassphraseSecure(s))return;await a.A.setAccountChallenge(s,t),await this._updateWebAuthn(s)}catch(s){throw s}}async updateGui(){let s;try{s=await l.A.form({password:{label:"New password",type:"password",button:"toggle",minlength:12,required:!0,title:"Your password must be longer than 12 characters and not the old password",validator:(s,t)=>s!==t.oldPassword&&s.length>=12},repeatPassword:{label:"Repeat password",type:"password",button:"toggle",required:!0,title:"Please confirm your new password",validator:(s,t)=>s===t.password},oldPassword:{label:"Old password",type:"password",button:"toggle",title:"You must enter your old password",required:!0,validator:s=>s.length>=12}},"Change Password","You can use this dialog to change your master password.")}catch(s){return!1}try{i.A.lockApp(),await this.update(s.password,s.oldPassword),i.A.unlockApp(),l.A.alert("Your password has been changed successfully.","Password changed")}catch(s){return i.A.unlockApp(),d.A.error(s),l.A.alert(s.message,"Changing password failed"),!1}return!0}async isPassphraseSecure(s){let t=!0;if(s.length<12)t=!1;else{let e=await o.A.getClient().getInstance("service.hash"),a=await e.getHash(s);t=-1===(await e.getBreachedHashes(a.substring(0,5))).indexOf(a)}return t||l.A.alert("CSENewPassphraseInsecureText","CSEPassphraseInsecureTitle").catch(d.A.catch),t}async _updateKeychain(s){this._sendStatus("keychain","processing",1);try{await a.A.setAccountChallenge(s),await Promise.all([await c.A.reset("user.encryption.cse"),await c.A.reset("user.encryption.sse")]),this._sendStatus("keychain","done")}catch(s){throw this._sendStatus("keychain","error",s),s}}async _encryptPasswords(s,t){this._sendStatus("passwords","loading");let e=await a.A.listPasswords("model+tags"),r=[];this._sendStatus("passwords","processing",Object.keys(e).length);for(let a in e){if(!e.hasOwnProperty(a))continue;let n=e[a];r.push(this._encryptPassword(n,s,t))}0!==r.length&&await Promise.all(r),this._sendStatus("passwords","done")}async _encryptPassword(s,t,e,r,n){s.folder=t[s.folder];let o=[];for(let t in s.tags)s.tags.hasOwnProperty(t)&&o.push(e[t]);if(s.tags=o,s.shared||null!==s.share)try{await a.A.updatePassword(s),d.A.success(`Updated password ${s.id}`),this._sendStatus("passwords")}catch(s){throw this._sendStatus("passwords","error",s),s}else{await this._deleteObject(s.id,"password"),s.cseType="CSEv1r1";try{await a.A.createPassword(s),d.A.success(`Encrypted password ${s.id}`),this._sendStatus("passwords")}catch(s){throw this._sendStatus("passwords","error",s),s}}}async _encryptTags(s){this._sendStatus("tags","loading");let t=await a.A.listTags(),e=[];this._sendStatus("tags","processing",Object.keys(t).length);for(let a in t)t.hasOwnProperty(a)&&(e.push(this._encryptTag(t[a],s)),e.length>10&&(await Promise.all(e),e=[]));return 0!==e.length&&await Promise.all(e),this._sendStatus("tags","done"),s}async _encryptTag(s,t){try{s.cseType="CSEv1r1";let e=await a.A.createTag(s);t[s.id]=e.id,this._sendStatus("tags"),d.A.success(`Encrypted tag ${s.id}`)}catch(s){throw this._sendStatus("tags","error",s),s}}async _encryptFolders(s){this._sendStatus("folders","loading");let t=await a.A.listFolders(),e=[];s["00000000-0000-0000-0000-000000000000"]="00000000-0000-0000-0000-000000000000",t=this._sortFoldersForUpgrade(t),this._sendStatus("folders","processing",Object.keys(t).length);for(let a of t)"00000000-0000-0000-0000-000000000000"!==a.id&&((!s.hasOwnProperty(a.parent)||e.length>10)&&(await Promise.all(e),e=[]),e.push(this._encryptFolder(a,s)));return await Promise.all(e),this._sendStatus("folders","done"),s}async _encryptFolder(s,t){try{s.parent=t[s.parent],s.cseType="CSEv1r1";let e=await a.A.createFolder(s);t[s.id]=e.id,this._sendStatus("folders"),d.A.success(`Encrypted folder ${s.id}`)}catch(s){throw this._sendStatus("folders","error",s),s}}_sortFoldersForUpgrade(s){let t=[],e=["00000000-0000-0000-0000-000000000000"];for(s=i.A.objectToArray(s);0!==s.length;)for(let a=0;a<s.length;a++){let r=s[a];-1!==e.indexOf(r.parent)&&(e.push(r.id),t.push(r),s.splice(a,1),a--)}return t}async _cleanDatabase(s,t){let e=Object.keys(s).length+Object.keys(t).length;this._sendStatus("cleanup","processing",e),n.A.ignoreApiErrors=!0,await Promise.all([this._deleteObjects(s,"tag"),this._deleteObjects(t,"folder")]),n.A.ignoreApiErrors=!1,this._sendStatus("cleanup","done")}async _deleteObjects(s,t){let e=[];for(let a in s)s.hasOwnProperty(a)&&"00000000-0000-0000-0000-000000000000"!==a&&(e.push(this._deleteObject(a,t)),e.length>10&&(await Promise.all(e),e=[]));0!==e.length&&await Promise.all(e)}async _deleteObject(s,t){let e="delete"+t.capitalize();try{await a.A[e](s),await a.A[e](s)}catch(s){s.hasOwnProperty("id")&&404===s.id||this._sendStatus("cleanup","error",s)}"password"!==t&&this._sendStatus("cleanup","processing")}async _saveMasterPassword(s){this._sendStatus("password","processing",1);let t=(0,h.C)("passwords","api-user",null),e=u.A.translate("Passwords App Encryption Passphrase"),r=u.A.translate("This is a copy of the passphrase you chose for encryption. Changing or deleting this entry does not affect the encryption. The passphrase can only be changed in the settings. More information can be found in the handbook."),n=location.href;try{await a.A.createPassword({username:t,password:s,label:e,url:n,notes:r}),this._sendStatus("password","done")}catch(s){this._sendStatus("password","error",s)}}_resetStatus(s){this._statusFunc=s,this.status={passwords:{status:"waiting",total:0,current:0,errors:[]},keychain:{status:"waiting",total:0,current:0,errors:[]},folders:{status:"waiting",total:0,current:0,errors:[]},cleanup:{status:"waiting",total:0,current:0,errors:[]},tags:{status:"waiting",total:0,current:0,errors:[]},save:{status:"waiting",total:0,current:0,errors:[]}}}_sendStatus(s,t="processing",e=null){if(null===this._statusFunc||!this.status.hasOwnProperty(s))return;let a=this.status[s];"processing"===t?(a.status="processing",null!==e?(a.total=e,a.current=0):a.current++):"loading"===t?a.status="loading":"done"===t?(a.status=0===a.errors.length?"success":"failed","success"===a.status&&(a.current=a.total)):"error"===t&&(d.A.error(e),a.errors.push(e),"cleanup"!==s&&(a.status="failed")),this._statusFunc(this.status)}async _updateWebAuthn(s){if(c.A.get("client.encryption.webauthn.enabled"))try{await w.A.run(s)}catch(s){d.A.error(s)}}}},92457:(s,t,e)=>{e.d(t,{HW:()=>c,do:()=>o,zo:()=>i});var a=e(61338);let r;const n=[];function o(){if(void 0===r){const s=document?.getElementsByTagName("head")[0];r=s?s.getAttribute("data-requesttoken"):null}return r}function i(s){n.push(s)}(0,a.B1)("csrf-token-update",(s=>{r=s.token,n.forEach((t=>{try{t(s.token)}catch(s){console.error("error updating CSRF token observer",s)}}))}));const l=(s,t)=>s?s.getAttribute(t):null;let d;function c(){if(void 0!==d)return d;const s=document?.getElementsByTagName("head")[0];if(!s)return null;const t=l(s,"data-user");return null===t?(d=null,d):(d={uid:t,displayName:l(s,"data-user-displayname"),isAdmin:!!window._oc_isadmin},d)}}}]);

Zerion Mini Shell 1.0