Skip to content

Commit

Permalink
fix: safe pass links
Browse files Browse the repository at this point in the history
  • Loading branch information
davay42 committed Apr 21, 2023
1 parent a40af71 commit bfe1d23
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 102 deletions.
32 changes: 16 additions & 16 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,27 @@
"tb": "tauri build"
},
"dependencies": {
"@capacitor/android": "^4.7.3",
"@capacitor/core": "^4.7.3",
"@capacitor/ios": "^4.7.3",
"@capacitor/android": "4.7.3",
"@capacitor/core": "4.7.3",
"@capacitor/ios": "4.7.3",
"@unocss/reset": "0.51.5",
"@vueuse/core": "10.0.2",
"ola": "^1.2.1",
"vue": "^3.2.47",
"vue-router": "^4.1.6"
"ola": "1.2.1",
"vue": "3.2.47",
"vue-router": "4.1.6"
},
"devDependencies": {
"@capacitor/cli": "^4.7.3",
"@iconify/json": "^2.2.52",
"@tauri-apps/cli": "^1.2.3",
"@capacitor/cli": "4.7.3",
"@iconify/json": "2.2.52",
"@tauri-apps/cli": "1.2.3",
"@unocss/extractor-pug": "0.51.5",
"@vitejs/plugin-vue": "^4.1.0",
"@vitejs/plugin-vue": "4.1.0",
"pug": "3.0.2",
"unocss": "^0.51.5",
"vite": "^4.3.1",
"vite-plugin-pages": "^0.29.0",
"vite-plugin-pages-sitemap": "^1.4.5",
"vite-plugin-pwa": "^0.14.7",
"vite-plugin-singlefile": "^0.13.5"
"unocss": "0.51.5",
"vite": "4.3.1",
"vite-plugin-pages": "0.29.0",
"vite-plugin-pages-sitemap": "1.4.5",
"vite-plugin-pwa": "0.14.7",
"vite-plugin-singlefile": "0.13.5"
}
}
4 changes: 2 additions & 2 deletions app/public-lib/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<script type="importmap">
{
"imports": {
"@gun-vue/app": "https://unpkg.com/@gun-vue/app"
"app": "https://unpkg.com/@gun-vue/app"
}
}
</script>
<script type="module">
import {createGunVueApp} from '@gun-vue/app'
import {createGunVueApp} from 'app'
createGunVueApp('#app')
</script>

Expand Down
1 change: 0 additions & 1 deletion composables/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"@vueuse/core": "10.0.2",
"@vueuse/integrations": "^10.0.2",
"@vueuse/math": "^10.0.2",
"base32": "^0.0.7",
"buffer": "^6.0.3",
"color-hash": "^2.0.2",
"curved-arrows": "^0.1.0",
Expand Down
4 changes: 2 additions & 2 deletions docs/public/examples/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<script type="importmap">
{
"imports": {
"@gun-vue/app": "https://unpkg.com/@gun-vue/app"
"app": "https://unpkg.com/@gun-vue/app"
}
}
</script>
<script type="module">
import {createGunVueApp} from '@gun-vue/app'
import {createGunVueApp} from 'app'
createGunVueApp('#app')
</script>

Expand Down
101 changes: 25 additions & 76 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions src/user/usePass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import { computed, reactive, watchEffect } from "vue";
import type { ComputedRef, } from 'vue'
import { gun, useGun, SEA, auth, isPair, user } from "../composables";
//@ts-ignore no types
import base32 from "base32";
import { ISEAPair } from "gun";

/**
Expand Down Expand Up @@ -63,14 +61,14 @@ export const pass: Pass = reactive({
});

function genLink(text = "", auth_url = "#/auth/"): string {
let base = base32.encode(text);
let base = encodeURIComponent(text);
return window.location.origin + window.location.pathname + auth_url + base;
}

export function parseLink(link: string, auth_url = "#/auth/"): string {
let index = link.indexOf(auth_url);
let base = link.substring(index + auth_url.length);
return base32.decode(base);
return decodeURIComponent(base)
}

let initiated = false;
Expand Down Expand Up @@ -136,7 +134,8 @@ async function setPass(text: string) {

export function usePassLink(data: string, passPhrase: string) {
if (!data) return;
const decoded = base32.decode(data);
const decoded = decodeURIComponent(data)
console.log('dec', decoded)
if (decoded.substring(0, 3) == "SEA") {
if (passPhrase) {
logEncPass(decoded, passPhrase);
Expand Down

0 comments on commit bfe1d23

Please sign in to comment.