Add the new account into the local storage

This commit is contained in:
Rodolphe Bréard 2023-07-30 16:40:10 +02:00
parent b968a43391
commit 0e394cccd8
3 changed files with 95 additions and 2 deletions

89
package-lock.json generated
View file

@ -10,6 +10,7 @@
"license": "(MIT OR Apache-2.0)",
"dependencies": {
"@noble/hashes": "^1.3.1",
"@vueuse/core": "^10.2.1",
"base32-encode": "^2.0.0",
"bulma": "^0.9.4",
"vue": "^3.3.4",
@ -400,6 +401,11 @@
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@types/web-bluetooth": {
"version": "0.0.17",
"resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.17.tgz",
"integrity": "sha512-4p9vcSmxAayx72yn70joFoL44c9MO/0+iVEBIQXe3v2h2SiAsEIo/G5v6ObFWvNKRFjbrVadNf9LqEEZeQPzdA=="
},
"node_modules/@vitejs/plugin-vue": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-4.2.3.tgz",
@ -520,6 +526,89 @@
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.3.4.tgz",
"integrity": "sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ=="
},
"node_modules/@vueuse/core": {
"version": "10.2.1",
"resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.2.1.tgz",
"integrity": "sha512-c441bfMbkAwTNwVRHQ0zdYZNETK//P84rC01aP2Uy/aRFCiie9NE/k9KdIXbno0eDYP5NPUuWv0aA/I4Unr/7w==",
"dependencies": {
"@types/web-bluetooth": "^0.0.17",
"@vueuse/metadata": "10.2.1",
"@vueuse/shared": "10.2.1",
"vue-demi": ">=0.14.5"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vueuse/core/node_modules/vue-demi": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.5.tgz",
"integrity": "sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==",
"hasInstallScript": true,
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/@vueuse/metadata": {
"version": "10.2.1",
"resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.2.1.tgz",
"integrity": "sha512-3Gt68mY/i6bQvFqx7cuGBzrCCQu17OBaGWS5JdwISpMsHnMKKjC2FeB5OAfMcCQ0oINfADP3i9A4PPRo0peHdQ==",
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vueuse/shared": {
"version": "10.2.1",
"resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-10.2.1.tgz",
"integrity": "sha512-QWHq2bSuGptkcxx4f4M/fBYC3Y8d3M2UYyLsyzoPgEoVzJURQ0oJeWXu79OiLlBb8gTKkqe4mO85T/sf39mmiw==",
"dependencies": {
"vue-demi": ">=0.14.5"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vueuse/shared/node_modules/vue-demi": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.5.tgz",
"integrity": "sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==",
"hasInstallScript": true,
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/anymatch": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",

View file

@ -15,6 +15,7 @@
},
"dependencies": {
"@noble/hashes": "^1.3.1",
"@vueuse/core": "^10.2.1",
"base32-encode": "^2.0.0",
"bulma": "^0.9.4",
"vue": "^3.3.4",

View file

@ -1,9 +1,11 @@
<script setup>
import { ref, computed } from 'vue';
import { useRouter } from 'vue-router';
import { useStorage } from '@vueuse/core'
import { sha256 } from '@noble/hashes/sha256';
import base32Encode from 'base32-encode';
const accounts = useStorage('sake-accounts', []);
const router = useRouter();
const localPart = ref('');
const separator = ref('+');
@ -17,7 +19,7 @@ const base64Decode = (str_b64) => {
for (var i = 0; i < length; i++) {
b.push(raw_str.charCodeAt(i));
}
return Uint8Array.from(b);
return b;
};
// Add account button
@ -42,7 +44,8 @@ const addAccount = () => {
domain: domainName.value,
key: key,
};
console.log(newAccount);
accounts.value.push(newAccount);
return router.push('/');
} catch (e) {
console.log(e);
}