@abraca/nuxt 2.41.0 → 2.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/runtime/components/ADocumentTree.d.vue.ts +13 -0
- package/dist/runtime/components/ADocumentTree.vue +9 -3
- package/dist/runtime/components/ADocumentTree.vue.d.ts +13 -0
- package/dist/runtime/components/AEditor.d.vue.ts +2 -2
- package/dist/runtime/components/AEditor.vue.d.ts +2 -2
- package/dist/runtime/components/AEmailVerifyConfirmModal.d.vue.ts +1 -1
- package/dist/runtime/components/AEmailVerifyConfirmModal.vue.d.ts +1 -1
- package/dist/runtime/components/AKeypairLoginModal.d.vue.ts +30 -0
- package/dist/runtime/components/AKeypairLoginModal.vue +111 -0
- package/dist/runtime/components/AKeypairLoginModal.vue.d.ts +30 -0
- package/dist/runtime/components/ASetPasswordCard.d.vue.ts +1 -1
- package/dist/runtime/components/ASetPasswordCard.vue.d.ts +1 -1
- package/dist/runtime/components/aware/AMedia.d.vue.ts +1 -1
- package/dist/runtime/components/aware/AMedia.vue.d.ts +1 -1
- package/dist/runtime/components/renderers/AProseRenderer.d.vue.ts +2 -2
- package/dist/runtime/components/renderers/AProseRenderer.vue.d.ts +2 -2
- package/dist/runtime/composables/useAbracadabraAuth.d.ts +1 -0
- package/dist/runtime/composables/useAbracadabraAuth.js +1 -0
- package/dist/runtime/composables/useConnectionStatus.d.ts +1 -1
- package/dist/runtime/middleware/abracadabra-auth.d.ts +1 -1
- package/dist/runtime/plugin-abracadabra.client.d.ts +1 -1
- package/dist/runtime/plugin-abracadabra.client.js +61 -0
- package/dist/runtime/plugin-abracadabra.server.d.ts +1 -1
- package/dist/runtime/plugin-abracadabra.server.js +2 -0
- package/dist/runtime/plugin-shared-globals.client.d.ts +1 -1
- package/dist/runtime/types.d.ts +19 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as Y from 'yjs';
|
|
1
2
|
type __VLS_Props = {
|
|
2
3
|
collapsed?: boolean;
|
|
3
4
|
editable?: boolean;
|
|
@@ -8,6 +9,17 @@ type __VLS_Props = {
|
|
|
8
9
|
* root as before — so this is a purely additive opt-in filter.
|
|
9
10
|
*/
|
|
10
11
|
rootId?: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Render the tree from an explicitly supplied Y.Doc — typically a sibling
|
|
14
|
+
* space's child doc loaded via `provider.loadChild(spaceId)` — instead of
|
|
15
|
+
* the active entry doc. The supplied doc's OWN `doc-tree` map is used; its
|
|
16
|
+
* `parentId == null` entries (plus anything parented to `rootId`) become
|
|
17
|
+
* the roots, and the doc's self-entry (`rootId`) is hidden. This lets an
|
|
18
|
+
* admin browse another space's subtree without re-pointing the whole
|
|
19
|
+
* provider. When null (default) the tree reads the active entry doc as
|
|
20
|
+
* before, so this is purely additive.
|
|
21
|
+
*/
|
|
22
|
+
sourceDoc?: Y.Doc | null;
|
|
11
23
|
};
|
|
12
24
|
declare var __VLS_39: {};
|
|
13
25
|
type __VLS_Slots = {} & {
|
|
@@ -24,6 +36,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
|
24
36
|
}>, {
|
|
25
37
|
editable: boolean;
|
|
26
38
|
rootId: string | null;
|
|
39
|
+
sourceDoc: Y.Doc | null;
|
|
27
40
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
41
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
42
|
declare const _default: typeof __VLS_export;
|
|
@@ -11,7 +11,8 @@ const props = defineProps({
|
|
|
11
11
|
collapsed: { type: Boolean, required: false },
|
|
12
12
|
editable: { type: Boolean, required: false, default: true },
|
|
13
13
|
selectedId: { type: [String, null], required: false },
|
|
14
|
-
rootId: { type: [String, null], required: false, default: null }
|
|
14
|
+
rootId: { type: [String, null], required: false, default: null },
|
|
15
|
+
sourceDoc: { type: null, required: false, default: null }
|
|
15
16
|
});
|
|
16
17
|
const emit = defineEmits(["navigate", "create"]);
|
|
17
18
|
const { doc, spaceDocId, isReady, provider, client, userName } = useAbracadabra();
|
|
@@ -30,7 +31,11 @@ function leaveRoom() {
|
|
|
30
31
|
const toast = useToast();
|
|
31
32
|
const appConfig = useAppConfig();
|
|
32
33
|
const presenceNeutral = computed(() => appConfig.ui?.colors?.neutral ?? "zinc");
|
|
33
|
-
const
|
|
34
|
+
const treeSourceDoc = shallowRef(props.sourceDoc ?? doc.value);
|
|
35
|
+
watch([() => props.sourceDoc, doc], ([src, d]) => {
|
|
36
|
+
treeSourceDoc.value = src ?? d;
|
|
37
|
+
}, { immediate: true });
|
|
38
|
+
const treeMap = useSyncedMap(treeSourceDoc, "doc-tree");
|
|
34
39
|
const structureHash = computed(() => {
|
|
35
40
|
let h = 0;
|
|
36
41
|
const data = treeMap.data;
|
|
@@ -54,7 +59,8 @@ const treeItems = computed(() => {
|
|
|
54
59
|
const raw = toRaw(treeMap.data);
|
|
55
60
|
const ROOT = "@root";
|
|
56
61
|
const scopeRoot = props.rootId ?? null;
|
|
57
|
-
const
|
|
62
|
+
const usingSource = props.sourceDoc != null;
|
|
63
|
+
const isTopLevel = (p) => usingSource ? p == null || p === scopeRoot : scopeRoot != null ? p === scopeRoot : p == null || p === sid;
|
|
58
64
|
const childrenByParent = /* @__PURE__ */ new Map();
|
|
59
65
|
for (const id in raw) {
|
|
60
66
|
if (id === sid || id === scopeRoot) continue;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as Y from 'yjs';
|
|
1
2
|
type __VLS_Props = {
|
|
2
3
|
collapsed?: boolean;
|
|
3
4
|
editable?: boolean;
|
|
@@ -8,6 +9,17 @@ type __VLS_Props = {
|
|
|
8
9
|
* root as before — so this is a purely additive opt-in filter.
|
|
9
10
|
*/
|
|
10
11
|
rootId?: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Render the tree from an explicitly supplied Y.Doc — typically a sibling
|
|
14
|
+
* space's child doc loaded via `provider.loadChild(spaceId)` — instead of
|
|
15
|
+
* the active entry doc. The supplied doc's OWN `doc-tree` map is used; its
|
|
16
|
+
* `parentId == null` entries (plus anything parented to `rootId`) become
|
|
17
|
+
* the roots, and the doc's self-entry (`rootId`) is hidden. This lets an
|
|
18
|
+
* admin browse another space's subtree without re-pointing the whole
|
|
19
|
+
* provider. When null (default) the tree reads the active entry doc as
|
|
20
|
+
* before, so this is purely additive.
|
|
21
|
+
*/
|
|
22
|
+
sourceDoc?: Y.Doc | null;
|
|
11
23
|
};
|
|
12
24
|
declare var __VLS_39: {};
|
|
13
25
|
type __VLS_Slots = {} & {
|
|
@@ -24,6 +36,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
|
24
36
|
}>, {
|
|
25
37
|
editable: boolean;
|
|
26
38
|
rootId: string | null;
|
|
39
|
+
sourceDoc: Y.Doc | null;
|
|
27
40
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
41
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
42
|
declare const _default: typeof __VLS_export;
|
|
@@ -94,16 +94,16 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
94
94
|
editor: import("vue").ComputedRef<any>;
|
|
95
95
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
96
96
|
rename: (label: string) => any;
|
|
97
|
-
ready: () => any;
|
|
98
97
|
"update:modelValue": (value: any) => any;
|
|
99
98
|
updateMeta: (patch: Partial<DocPageMeta>) => any;
|
|
100
99
|
update: (content: any) => any;
|
|
100
|
+
ready: () => any;
|
|
101
101
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
102
102
|
onRename?: ((label: string) => any) | undefined;
|
|
103
|
-
onReady?: (() => any) | undefined;
|
|
104
103
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
105
104
|
onUpdateMeta?: ((patch: Partial<DocPageMeta>) => any) | undefined;
|
|
106
105
|
onUpdate?: ((content: any) => any) | undefined;
|
|
106
|
+
onReady?: (() => any) | undefined;
|
|
107
107
|
}>, {
|
|
108
108
|
contentType: "json" | "html" | "markdown";
|
|
109
109
|
editable: boolean;
|
|
@@ -94,16 +94,16 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
94
94
|
editor: import("vue").ComputedRef<any>;
|
|
95
95
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
96
96
|
rename: (label: string) => any;
|
|
97
|
-
ready: () => any;
|
|
98
97
|
"update:modelValue": (value: any) => any;
|
|
99
98
|
updateMeta: (patch: Partial<DocPageMeta>) => any;
|
|
100
99
|
update: (content: any) => any;
|
|
100
|
+
ready: () => any;
|
|
101
101
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
102
102
|
onRename?: ((label: string) => any) | undefined;
|
|
103
|
-
onReady?: (() => any) | undefined;
|
|
104
103
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
105
104
|
onUpdateMeta?: ((patch: Partial<DocPageMeta>) => any) | undefined;
|
|
106
105
|
onUpdate?: ((content: any) => any) | undefined;
|
|
106
|
+
onReady?: (() => any) | undefined;
|
|
107
107
|
}>, {
|
|
108
108
|
contentType: "json" | "html" | "markdown";
|
|
109
109
|
editable: boolean;
|
|
@@ -22,8 +22,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
22
22
|
}>, {
|
|
23
23
|
subtitle: string;
|
|
24
24
|
title: string;
|
|
25
|
-
success: boolean;
|
|
26
25
|
loading: boolean;
|
|
26
|
+
success: boolean;
|
|
27
27
|
initialToken: string;
|
|
28
28
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
29
|
declare const _default: typeof __VLS_export;
|
|
@@ -22,8 +22,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
22
22
|
}>, {
|
|
23
23
|
subtitle: string;
|
|
24
24
|
title: string;
|
|
25
|
-
success: boolean;
|
|
26
25
|
loading: boolean;
|
|
26
|
+
success: boolean;
|
|
27
27
|
initialToken: string;
|
|
28
28
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
29
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
open?: boolean;
|
|
3
|
+
/** Inline error string from the consumer's submit handler. */
|
|
4
|
+
error?: string | null;
|
|
5
|
+
/** Loading flag while consumer handles submit. */
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
/** Title text. */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Subtitle text. */
|
|
10
|
+
subtitle?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
submit: (payload: {
|
|
14
|
+
privateKey: string;
|
|
15
|
+
ephemeral: boolean;
|
|
16
|
+
}) => any;
|
|
17
|
+
"update:open": (open: boolean) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
19
|
+
onSubmit?: ((payload: {
|
|
20
|
+
privateKey: string;
|
|
21
|
+
ephemeral: boolean;
|
|
22
|
+
}) => any) | undefined;
|
|
23
|
+
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
24
|
+
}>, {
|
|
25
|
+
subtitle: string;
|
|
26
|
+
title: string;
|
|
27
|
+
loading: boolean;
|
|
28
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, watch } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
open: { type: Boolean, required: false },
|
|
5
|
+
error: { type: [String, null], required: false },
|
|
6
|
+
loading: { type: Boolean, required: false, default: false },
|
|
7
|
+
title: { type: String, required: false, default: "Sign in with a private key" },
|
|
8
|
+
subtitle: { type: String, required: false, default: "Paste a 32-byte Ed25519 private key (base64url) to sign in as the matching identity." }
|
|
9
|
+
});
|
|
10
|
+
const emit = defineEmits(["update:open", "submit"]);
|
|
11
|
+
const open = computed({
|
|
12
|
+
get: () => !!props.open,
|
|
13
|
+
set: (v) => emit("update:open", v)
|
|
14
|
+
});
|
|
15
|
+
const privateKey = ref("");
|
|
16
|
+
const ephemeral = ref(false);
|
|
17
|
+
watch(() => props.open, (v) => {
|
|
18
|
+
if (!v) return;
|
|
19
|
+
privateKey.value = "";
|
|
20
|
+
ephemeral.value = false;
|
|
21
|
+
});
|
|
22
|
+
const SEED_RE = /^[\w-]{43}=?$/;
|
|
23
|
+
const trimmed = computed(() => privateKey.value.trim());
|
|
24
|
+
const looksValid = computed(() => SEED_RE.test(trimmed.value));
|
|
25
|
+
const showError = computed(() => trimmed.value.length > 0 && !looksValid.value);
|
|
26
|
+
const canSubmit = computed(() => looksValid.value && !props.loading);
|
|
27
|
+
function submit() {
|
|
28
|
+
if (!canSubmit.value) return;
|
|
29
|
+
emit("submit", { privateKey: trimmed.value, ephemeral: ephemeral.value });
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<UModal
|
|
35
|
+
v-model:open="open"
|
|
36
|
+
:title="title"
|
|
37
|
+
:ui="{ content: 'sm:max-w-lg' }"
|
|
38
|
+
>
|
|
39
|
+
<template #body>
|
|
40
|
+
<div class="flex flex-col gap-5">
|
|
41
|
+
<p class="text-sm text-(--ui-text-muted) text-center">
|
|
42
|
+
{{ subtitle }}
|
|
43
|
+
</p>
|
|
44
|
+
|
|
45
|
+
<UAlert
|
|
46
|
+
v-if="error"
|
|
47
|
+
color="error"
|
|
48
|
+
variant="soft"
|
|
49
|
+
icon="i-lucide-triangle-alert"
|
|
50
|
+
:description="error"
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
<UAlert
|
|
54
|
+
v-else-if="showError"
|
|
55
|
+
color="warning"
|
|
56
|
+
variant="soft"
|
|
57
|
+
icon="i-lucide-triangle-alert"
|
|
58
|
+
description="That doesn't look like a 32-byte base64url private key."
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<div class="flex flex-col gap-1">
|
|
62
|
+
<label class="text-xs font-medium text-(--ui-text-muted)">PRIVATE KEY</label>
|
|
63
|
+
<UInput
|
|
64
|
+
v-model="privateKey"
|
|
65
|
+
type="password"
|
|
66
|
+
size="md"
|
|
67
|
+
autofocus
|
|
68
|
+
autocapitalize="off"
|
|
69
|
+
autocomplete="off"
|
|
70
|
+
spellcheck="false"
|
|
71
|
+
placeholder="base64url 32-byte seed"
|
|
72
|
+
icon="i-lucide-key-round"
|
|
73
|
+
class="font-mono"
|
|
74
|
+
:ui="{ base: 'rounded-sm' }"
|
|
75
|
+
@keydown.enter="submit"
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<label class="flex items-center gap-2 cursor-pointer text-sm px-1">
|
|
80
|
+
<USwitch
|
|
81
|
+
v-model="ephemeral"
|
|
82
|
+
size="sm"
|
|
83
|
+
/>
|
|
84
|
+
<span>Don't store on this device (ephemeral session)</span>
|
|
85
|
+
</label>
|
|
86
|
+
</div>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<template #footer>
|
|
90
|
+
<div class="flex items-center justify-end gap-2 w-full">
|
|
91
|
+
<UButton
|
|
92
|
+
variant="ghost"
|
|
93
|
+
color="neutral"
|
|
94
|
+
size="sm"
|
|
95
|
+
label="Cancel"
|
|
96
|
+
@click="open = false"
|
|
97
|
+
/>
|
|
98
|
+
<UButton
|
|
99
|
+
variant="solid"
|
|
100
|
+
color="primary"
|
|
101
|
+
size="sm"
|
|
102
|
+
icon="i-lucide-log-in"
|
|
103
|
+
label="Sign in"
|
|
104
|
+
:loading="loading"
|
|
105
|
+
:disabled="!canSubmit"
|
|
106
|
+
@click="submit"
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
|
110
|
+
</UModal>
|
|
111
|
+
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
open?: boolean;
|
|
3
|
+
/** Inline error string from the consumer's submit handler. */
|
|
4
|
+
error?: string | null;
|
|
5
|
+
/** Loading flag while consumer handles submit. */
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
/** Title text. */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Subtitle text. */
|
|
10
|
+
subtitle?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
submit: (payload: {
|
|
14
|
+
privateKey: string;
|
|
15
|
+
ephemeral: boolean;
|
|
16
|
+
}) => any;
|
|
17
|
+
"update:open": (open: boolean) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
19
|
+
onSubmit?: ((payload: {
|
|
20
|
+
privateKey: string;
|
|
21
|
+
ephemeral: boolean;
|
|
22
|
+
}) => any) | undefined;
|
|
23
|
+
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
24
|
+
}>, {
|
|
25
|
+
subtitle: string;
|
|
26
|
+
title: string;
|
|
27
|
+
loading: boolean;
|
|
28
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
@@ -18,9 +18,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
18
18
|
}>, {
|
|
19
19
|
subtitle: string;
|
|
20
20
|
title: string;
|
|
21
|
-
success: boolean;
|
|
22
21
|
minLength: number;
|
|
23
22
|
loading: boolean;
|
|
23
|
+
success: boolean;
|
|
24
24
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
25
|
declare const _default: typeof __VLS_export;
|
|
26
26
|
export default _default;
|
|
@@ -18,9 +18,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
18
18
|
}>, {
|
|
19
19
|
subtitle: string;
|
|
20
20
|
title: string;
|
|
21
|
-
success: boolean;
|
|
22
21
|
minLength: number;
|
|
23
22
|
loading: boolean;
|
|
23
|
+
success: boolean;
|
|
24
24
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
25
|
declare const _default: typeof __VLS_export;
|
|
26
26
|
export default _default;
|
|
@@ -12,8 +12,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
12
12
|
awareness: boolean;
|
|
13
13
|
tag: "video" | "audio";
|
|
14
14
|
live: boolean;
|
|
15
|
-
controls: boolean;
|
|
16
15
|
total: boolean;
|
|
16
|
+
controls: boolean;
|
|
17
17
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
19
19
|
export default _default;
|
|
@@ -12,8 +12,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
12
12
|
awareness: boolean;
|
|
13
13
|
tag: "video" | "audio";
|
|
14
14
|
live: boolean;
|
|
15
|
-
controls: boolean;
|
|
16
15
|
total: boolean;
|
|
16
|
+
controls: boolean;
|
|
17
17
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
19
19
|
export default _default;
|
|
@@ -10,14 +10,14 @@ type __VLS_Props = {
|
|
|
10
10
|
};
|
|
11
11
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, Record<PropertyKey, unknown>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
12
|
rename: (label: string) => any;
|
|
13
|
-
ready: () => any;
|
|
14
13
|
updateMeta: (patch: Partial<DocPageMeta>) => any;
|
|
15
14
|
update: (content: any) => any;
|
|
15
|
+
ready: () => any;
|
|
16
16
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
17
|
onRename?: ((label: string) => any) | undefined;
|
|
18
|
-
onReady?: (() => any) | undefined;
|
|
19
18
|
onUpdateMeta?: ((patch: Partial<DocPageMeta>) => any) | undefined;
|
|
20
19
|
onUpdate?: ((content: any) => any) | undefined;
|
|
20
|
+
onReady?: (() => any) | undefined;
|
|
21
21
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const _default: typeof __VLS_export;
|
|
23
23
|
export default _default;
|
|
@@ -10,14 +10,14 @@ type __VLS_Props = {
|
|
|
10
10
|
};
|
|
11
11
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, Record<PropertyKey, unknown>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
12
|
rename: (label: string) => any;
|
|
13
|
-
ready: () => any;
|
|
14
13
|
updateMeta: (patch: Partial<DocPageMeta>) => any;
|
|
15
14
|
update: (content: any) => any;
|
|
15
|
+
ready: () => any;
|
|
16
16
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
17
|
onRename?: ((label: string) => any) | undefined;
|
|
18
|
-
onReady?: (() => any) | undefined;
|
|
19
18
|
onUpdateMeta?: ((patch: Partial<DocPageMeta>) => any) | undefined;
|
|
20
19
|
onUpdate?: ((content: any) => any) | undefined;
|
|
20
|
+
onReady?: (() => any) | undefined;
|
|
21
21
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const _default: typeof __VLS_export;
|
|
23
23
|
export default _default;
|
|
@@ -18,6 +18,7 @@ export function useAbracadabraAuth() {
|
|
|
18
18
|
loginWithPassword: abra.loginWithPassword,
|
|
19
19
|
registerWithPassword: abra.registerWithPassword,
|
|
20
20
|
loginWithMnemonic: abra.loginWithMnemonic,
|
|
21
|
+
loginWithKeypair: abra.loginWithKeypair,
|
|
21
22
|
logout: abra.logout,
|
|
22
23
|
logoutServer: abra.logoutServer,
|
|
23
24
|
logoutAll: abra.logoutAll,
|
|
@@ -15,7 +15,7 @@ type ConnectionStatusValue = 'disconnected' | 'connecting' | 'connected' | 'offl
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function useConnectionStatus(status?: MaybeRef<ConnectionStatusValue | string | undefined>, synced?: MaybeRef<boolean | undefined>): {
|
|
17
17
|
label: import("vue").ComputedRef<string>;
|
|
18
|
-
color: import("vue").ComputedRef<"error" | "
|
|
18
|
+
color: import("vue").ComputedRef<"error" | "warning" | "success">;
|
|
19
19
|
icon: import("vue").ComputedRef<"i-lucide-cloud-off" | "i-lucide-cloud-check" | "i-lucide-cloud">;
|
|
20
20
|
};
|
|
21
21
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: any;
|
|
2
2
|
export default _default;
|
|
@@ -884,6 +884,66 @@ export default defineNuxtPlugin({
|
|
|
884
884
|
await _initPromise;
|
|
885
885
|
}
|
|
886
886
|
}
|
|
887
|
+
async function loginWithKeypair(opts) {
|
|
888
|
+
const raw = (opts.privateKey ?? "").trim();
|
|
889
|
+
if (!raw) throw new Error("Private key is required");
|
|
890
|
+
let seed;
|
|
891
|
+
try {
|
|
892
|
+
seed = fromBase64Url(raw);
|
|
893
|
+
} catch {
|
|
894
|
+
throw new Error("Private key must be base64url-encoded");
|
|
895
|
+
}
|
|
896
|
+
if (seed.length !== 32) {
|
|
897
|
+
seed.fill(0);
|
|
898
|
+
throw new Error("Private key must decode to a 32-byte Ed25519 seed");
|
|
899
|
+
}
|
|
900
|
+
const [edModule, { sha512 }] = await Promise.all([
|
|
901
|
+
import("@noble/ed25519"),
|
|
902
|
+
import("@noble/hashes/sha2.js")
|
|
903
|
+
]);
|
|
904
|
+
const ed = edModule.default ?? edModule;
|
|
905
|
+
if (ed.hashes) {
|
|
906
|
+
ed.hashes.sha512 = sha512;
|
|
907
|
+
ed.hashes.sha512Async = (m) => Promise.resolve(sha512(m));
|
|
908
|
+
}
|
|
909
|
+
const pubKey = toBase64Url(ed.getPublicKey(seed));
|
|
910
|
+
if (opts.ephemeral) {
|
|
911
|
+
_wipeEphemeralSeed();
|
|
912
|
+
_ephemeralSeed = seed;
|
|
913
|
+
localStorage.removeItem("abracadabra_privkey");
|
|
914
|
+
if (typeof window !== "undefined") {
|
|
915
|
+
window.addEventListener("beforeunload", _wipeEphemeralSeed);
|
|
916
|
+
}
|
|
917
|
+
publicKeyB64.value = pubKey;
|
|
918
|
+
identityState.value = "claimed";
|
|
919
|
+
addLog("Ephemeral keypair session", "auth");
|
|
920
|
+
} else {
|
|
921
|
+
_wipeEphemeralSeed();
|
|
922
|
+
try {
|
|
923
|
+
const { softKeystoreAvailable, importSoftKeyFromSeed } = await import("./utils/softKeystore.js");
|
|
924
|
+
if (softKeystoreAvailable()) {
|
|
925
|
+
await importSoftKeyFromSeed(seed);
|
|
926
|
+
} else {
|
|
927
|
+
localStorage.setItem("abracadabra_privkey", toBase64Url(seed));
|
|
928
|
+
}
|
|
929
|
+
} finally {
|
|
930
|
+
seed.fill(0);
|
|
931
|
+
}
|
|
932
|
+
localStorage.setItem(CLAIMED_FLAG_KEY, "1");
|
|
933
|
+
localStorage.setItem(PUBKEY_KEY, pubKey);
|
|
934
|
+
localStorage.removeItem(REQUIRE_PASSKEY_KEY);
|
|
935
|
+
publicKeyB64.value = pubKey;
|
|
936
|
+
identityState.value = "claimed";
|
|
937
|
+
addLog("Authenticated via keypair", "auth");
|
|
938
|
+
}
|
|
939
|
+
const serverUrl = currentServerUrl.value;
|
|
940
|
+
if (client.value || serverUrl) {
|
|
941
|
+
_teardown();
|
|
942
|
+
_initPromise = null;
|
|
943
|
+
_initPromise = init(serverUrl);
|
|
944
|
+
await _initPromise;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
887
947
|
async function confirmPasswordReset(opts) {
|
|
888
948
|
if (!client.value) throw new Error("Not connected");
|
|
889
949
|
await client.value.confirmPasswordReset(opts);
|
|
@@ -1521,6 +1581,7 @@ export default defineNuxtPlugin({
|
|
|
1521
1581
|
loginWithPassword,
|
|
1522
1582
|
registerWithPassword,
|
|
1523
1583
|
loginWithMnemonic,
|
|
1584
|
+
loginWithKeypair,
|
|
1524
1585
|
logout,
|
|
1525
1586
|
reconnect,
|
|
1526
1587
|
logoutServer,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: any;
|
|
2
2
|
export default _default;
|
|
@@ -68,6 +68,8 @@ export default defineNuxtPlugin({
|
|
|
68
68
|
loginWithHardware: noopAsync,
|
|
69
69
|
loginWithPassword: noopAsync,
|
|
70
70
|
registerWithPassword: noopAsync,
|
|
71
|
+
loginWithMnemonic: noopAsync,
|
|
72
|
+
loginWithKeypair: noopAsync,
|
|
71
73
|
logout: noopAsync,
|
|
72
74
|
logoutServer: noopAsync,
|
|
73
75
|
logoutAll: noopAsync,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: any;
|
|
2
2
|
export default _default;
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -506,6 +506,25 @@ export interface AbracadabraState {
|
|
|
506
506
|
displayName?: string;
|
|
507
507
|
inviteCode?: string;
|
|
508
508
|
}) => Promise<void>;
|
|
509
|
+
/**
|
|
510
|
+
* Log in with a BIP-39 recovery phrase. Derives the Ed25519 seed, persists it
|
|
511
|
+
* (unless `ephemeral`), marks the identity 'claimed', and re-inits so the WS
|
|
512
|
+
* re-authenticates via challenge-response.
|
|
513
|
+
*/
|
|
514
|
+
loginWithMnemonic: (opts: {
|
|
515
|
+
mnemonic: string;
|
|
516
|
+
passphrase?: string;
|
|
517
|
+
ephemeral?: boolean;
|
|
518
|
+
}) => Promise<void>;
|
|
519
|
+
/**
|
|
520
|
+
* Log in with a raw Ed25519 private key (32-byte base64url seed — the
|
|
521
|
+
* `NUXT_ABRACADABRA_SERVICE_PRIVATE_KEY` shape). Same persistence + re-init
|
|
522
|
+
* path as `loginWithMnemonic`; `ephemeral` keeps the seed in memory only.
|
|
523
|
+
*/
|
|
524
|
+
loginWithKeypair: (opts: {
|
|
525
|
+
privateKey: string;
|
|
526
|
+
ephemeral?: boolean;
|
|
527
|
+
}) => Promise<void>;
|
|
509
528
|
logout: () => Promise<void>;
|
|
510
529
|
/** Revoke the current JWT server-side, then clear local identity. */
|
|
511
530
|
logoutServer: () => Promise<void>;
|