Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f16684b authored by Akhil's avatar Akhil 🙂
Browse files

feat: try to setup encryption at creation

parent 876d80e7
Loading
Loading
Loading
Loading
Loading

.codex

0 → 100644
+0 −0

Empty file added.

+36 −4
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
				"@nextcloud/l10n": "^3.1.0",
				"@nextcloud/router": "^3.0.1",
				"@nextcloud/vue": "^8.16.0",
				"passwords-client": "1.0.0-alpha.5731",
				"vue": "^2.7.0",
				"vue-password-strength-meter": "^1.7.2"
			},
@@ -9325,6 +9326,21 @@
				"node": ">= 0.8.0"
			}
		},
		"node_modules/libsodium": {
			"version": "0.7.10",
			"resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.10.tgz",
			"integrity": "sha512-eY+z7hDrDKxkAK+QKZVNv92A5KYkxfvIshtBJkmg5TSiCnYqZP3i9OO9whE79Pwgm4jGaoHgkM4ao/b9Cyu4zQ==",
			"license": "ISC"
		},
		"node_modules/libsodium-wrappers": {
			"version": "0.7.10",
			"resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.10.tgz",
			"integrity": "sha512-pO3F1Q9NPLB/MWIhehim42b/Fwb30JNScCNh8TcQ/kIc+qGLQch8ag8wb0keK3EP5kbGakk1H8Wwo7v+36rNQg==",
			"license": "ISC",
			"dependencies": {
				"libsodium": "^0.7.0"
			}
		},
		"node_modules/lines-and-columns": {
			"version": "1.2.4",
			"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
@@ -11130,6 +11146,26 @@
				"node": ">= 0.8"
			}
		},
		"node_modules/passwords-client": {
			"version": "1.0.0-alpha.5731",
			"resolved": "https://registry.npmjs.org/passwords-client/-/passwords-client-1.0.0-alpha.5731.tgz",
			"integrity": "sha512-Pl36mcHhUlbN9IjJAkPmcunXPvC5Rz/hVZZgUDKM+GOUIzVSsH8ltPliUJCN+2tugc0x/aINmO987CXNptWcYw==",
			"license": "ISC",
			"dependencies": {
				"eventemitter3": "^3.1.2",
				"libsodium": "0.7.10",
				"libsodium-wrappers": "0.7.10",
				"process": "^0.11.10",
				"url-parse": "^1.5.3",
				"uuid": "^8.3.2"
			}
		},
		"node_modules/passwords-client/node_modules/eventemitter3": {
			"version": "3.1.2",
			"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz",
			"integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==",
			"license": "MIT"
		},
		"node_modules/path-browserify": {
			"version": "1.0.1",
			"resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz",
@@ -11566,8 +11602,6 @@
			"version": "0.11.10",
			"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
			"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
			"dev": true,
			"peer": true,
			"engines": {
				"node": ">= 0.6.0"
			}
@@ -14418,8 +14452,6 @@
			"version": "8.3.2",
			"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
			"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
			"dev": true,
			"peer": true,
			"bin": {
				"uuid": "dist/bin/uuid"
			}
+2 −1
Original line number Diff line number Diff line
@@ -26,7 +26,8 @@
		"@nextcloud/router": "^3.0.1",
		"@nextcloud/vue": "^8.16.0",
		"vue": "^2.7.0",
		"vue-password-strength-meter": "^1.7.2"
		"vue-password-strength-meter": "^1.7.2",
		"passwords-client": "1.0.0-alpha.5731"
	},
	"browserslist": [
		"extends @nextcloud/browserslist-config"
+19 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ import HCaptchaForm from './signup/HCaptchaForm.vue'
import CaptchaForm from './signup/CaptchaForm.vue'
import RecoveryEmailForm from './signup/RecoveryEmailForm.vue'
import SuccessSection from './signup/SuccessSection.vue'
import PasswordsClient from "passwords-client";
import {EnhancedApi} from 'passwords-client/legacy';

const APPLICATION_NAME = 'ecloud-accounts'

@@ -107,6 +109,8 @@ export default {
				const url = generateUrl(`/apps/${this.appName}/accounts/create`)
				this.processingCreation = true
				await Axios.post(url, data)
				await this.setupEncryption()

				
				// If the execution reaches here, the response status is in the 2xx range
				this.showRegistrationForm = false
@@ -125,6 +129,21 @@ export default {
				this.showMessage(errorMessage, 'error')
			}
		},
		async setupEncryption() {
			const token = this.formData.password
			const user = this.formData.username
			let baseUrl = generateUrl('', [], {})
			if (baseUrl.indexOf(location.origin) === -1) {
				baseUrl = new URL(location.origin + baseUrl).href
			}

			const server = { baseUrl, user, token }
			const client = new PasswordsClient(server, { baseUrl, user, token })
			const api = new EnhancedApi()
			api.initialize(client, { cseMode: 'CSEv1r1' })

			await api.setAccountChallenge(this.formData.password)
		},
		showMessage(message, type) {
			type === 'success' ? showSuccess(message) : showError(message)
		},