diff --git a/Cargo.lock b/Cargo.lock
index e2767d5..7ae749f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -12,15 +12,6 @@ dependencies = [
"psl-types",
]
-[[package]]
-name = "addr2line"
-version = "0.21.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
-dependencies = [
- "gimli",
-]
-
[[package]]
name = "adler"
version = "1.0.2"
@@ -493,21 +484,6 @@ dependencies = [
"uuid",
]
-[[package]]
-name = "backtrace"
-version = "0.3.69"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
-dependencies = [
- "addr2line",
- "cc",
- "cfg-if",
- "libc",
- "miniz_oxide",
- "object",
- "rustc-demangle",
-]
-
[[package]]
name = "base64"
version = "0.13.1"
@@ -1683,28 +1659,6 @@ dependencies = [
"zune-inflate",
]
-[[package]]
-name = "failure"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
-dependencies = [
- "backtrace",
- "failure_derive",
-]
-
-[[package]]
-name = "failure_derive"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
- "synstructure",
-]
-
[[package]]
name = "fastrand"
version = "1.9.0"
@@ -2143,12 +2097,6 @@ dependencies = [
"weezl",
]
-[[package]]
-name = "gimli"
-version = "0.28.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
-
[[package]]
name = "gio"
version = "0.16.7"
@@ -3854,15 +3802,6 @@ dependencies = [
"objc",
]
-[[package]]
-name = "object"
-version = "0.32.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
-dependencies = [
- "memchr",
-]
-
[[package]]
name = "once_cell"
version = "1.18.0"
@@ -4817,12 +4756,6 @@ dependencies = [
"num-traits",
]
-[[package]]
-name = "rustc-demangle"
-version = "0.1.23"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
-
[[package]]
name = "rustc-hash"
version = "1.1.0"
@@ -5481,18 +5414,6 @@ dependencies = [
"unicode-ident",
]
-[[package]]
-name = "synstructure"
-version = "0.12.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
- "unicode-xid",
-]
-
[[package]]
name = "sys-locale"
version = "0.3.1"
@@ -5893,11 +5814,9 @@ dependencies = [
[[package]]
name = "threshold_crypto"
version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f708705bce37e765c37a95a8e0221a327c880d5a5a148d522552e8daa85787a"
+source = "git+https://github.com/nextgraph-org/threshold_crypto.git?branch=master#b60552e4d42f67058455779eed476a76986b5478"
dependencies = [
"byteorder",
- "failure",
"ff",
"group",
"hex_fmt",
@@ -5906,6 +5825,7 @@ dependencies = [
"rand 0.7.3",
"rand_chacha 0.2.2",
"serde",
+ "thiserror",
"tiny-keccak",
"zeroize",
]
@@ -6287,12 +6207,6 @@ version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
-[[package]]
-name = "unicode-xid"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
-
[[package]]
name = "unique_id"
version = "0.1.5"
diff --git a/nextgraph/src/local_broker.rs b/nextgraph/src/local_broker.rs
index 4f6678b..8203c7d 100644
--- a/nextgraph/src/local_broker.rs
+++ b/nextgraph/src/local_broker.rs
@@ -1312,6 +1312,11 @@ impl LocalBroker {
// user_id.to_hash_string(),
// key
// );
+
+ let site = opened_wallet.wallet.site(&user_id)?;
+ let core = site.cores[0]; //TODO: cycle the other cores if failure to connect (failover)
+ let brokers = opened_wallet.wallet.broker(core.0)?;
+
key_material.zeroize();
let mut verifier = Verifier::new(
VerifierConfig {
@@ -1325,6 +1330,7 @@ impl LocalBroker {
private_store_id: credentials.2,
protected_store_id: credentials.3,
public_store_id: credentials.4,
+ locator: BrokerInfoV0::vec_into_locator(brokers),
},
block_storage,
)?;
diff --git a/ng-app/index-web.html b/ng-app/index-web.html
index 80f69de..893e71f 100644
--- a/ng-app/index-web.html
+++ b/ng-app/index-web.html
@@ -102,7 +102,7 @@
Your browser is too old and does not support NextGraph.
Please upgrade to a newer version of this browser,
try with another browser,
or
install our native apps on
- Linux, macOS, Windows desktops and laptops, and iOS, Android mobiles.
+ Linux, macOS, Windows desktops and laptops,
and iOS, Android mobiles.
If you are using jshelter or another javascript protection mechanism, please deactivate it as we need access to the WebWorker facility of your browser.
NextGraph cannot load as Javascript is deactivated.
diff --git a/ng-app/src-tauri/src/lib.rs b/ng-app/src-tauri/src/lib.rs
index 3d0db86..b066de1 100644
--- a/ng-app/src-tauri/src/lib.rs
+++ b/ng-app/src-tauri/src/lib.rs
@@ -641,6 +641,94 @@ async fn app_request(request: AppRequest) -> Result {
.map_err(|e| e.to_string())
}
+#[tauri::command(rename_all = "snake_case")]
+async fn signature_status(
+ session_id: u64,
+ nuri: Option,
+) -> Result, bool)>, String> {
+ let nuri = if nuri.is_some() {
+ NuriV0::new_from(&nuri.unwrap()).map_err(|e| e.to_string())?
+ } else {
+ NuriV0::new_private_store_target()
+ };
+
+ let request = AppRequest::V0(AppRequestV0 {
+ command: AppRequestCommandV0::new_signature_status(),
+ nuri,
+ payload: None,
+ session_id,
+ });
+
+ let res = nextgraph::local_broker::app_request(request)
+ .await
+ .map_err(|e: NgError| e.to_string())?;
+
+ let AppResponse::V0(res) = res;
+ //log_debug!("{:?}", res);
+ match res {
+ AppResponseV0::SignatureStatus(s) => Ok(s),
+ _ => Err("invalid response".to_string()),
+ }
+}
+
+#[tauri::command(rename_all = "snake_case")]
+async fn signed_snapshot_request(session_id: u64, nuri: Option) -> Result {
+ let nuri = if nuri.is_some() {
+ NuriV0::new_from(&nuri.unwrap()).map_err(|e| e.to_string())?
+ } else {
+ NuriV0::new_private_store_target()
+ };
+
+ let request = AppRequest::V0(AppRequestV0 {
+ command: AppRequestCommandV0::new_signed_snapshot_request(),
+ nuri,
+ payload: None,
+ session_id,
+ });
+
+ let res = nextgraph::local_broker::app_request(request)
+ .await
+ .map_err(|e: NgError| e.to_string())?;
+
+ let AppResponse::V0(res) = res;
+ //log_debug!("{:?}", res);
+ match res {
+ AppResponseV0::True => Ok(true),
+ AppResponseV0::False => Ok(false),
+ AppResponseV0::Error(e) => Err(e),
+ _ => Err("invalid response".to_string()),
+ }
+}
+
+#[tauri::command(rename_all = "snake_case")]
+async fn signature_request(session_id: u64, nuri: Option) -> Result {
+ let nuri = if nuri.is_some() {
+ NuriV0::new_from(&nuri.unwrap()).map_err(|e| e.to_string())?
+ } else {
+ NuriV0::new_private_store_target()
+ };
+
+ let request = AppRequest::V0(AppRequestV0 {
+ command: AppRequestCommandV0::new_signature_request(),
+ nuri,
+ payload: None,
+ session_id,
+ });
+
+ let res = nextgraph::local_broker::app_request(request)
+ .await
+ .map_err(|e: NgError| e.to_string())?;
+
+ let AppResponse::V0(res) = res;
+ //log_debug!("{:?}", res);
+ match res {
+ AppResponseV0::True => Ok(true),
+ AppResponseV0::False => Ok(false),
+ AppResponseV0::Error(e) => Err(e),
+ _ => Err("invalid response".to_string()),
+ }
+}
+
#[tauri::command(rename_all = "snake_case")]
async fn doc_create(
session_id: u64,
@@ -932,6 +1020,9 @@ impl AppBuilder {
sparql_query,
sparql_update,
branch_history,
+ signature_status,
+ signature_request,
+ signed_snapshot_request,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
diff --git a/ng-app/src/api.ts b/ng-app/src/api.ts
index 618031d..30269a1 100644
--- a/ng-app/src/api.ts
+++ b/ng-app/src/api.ts
@@ -50,6 +50,9 @@ const mapping = {
"doc_fetch_repo_subscribe": ["repo_o"],
"branch_history": ["session_id", "nuri"],
"file_save_to_downloads": ["session_id", "reference", "filename", "branch_nuri"],
+ "signature_status": ["session_id", "nuri"],
+ "signed_snapshot_request": ["session_id", "nuri"],
+ "signature_request": ["session_id", "nuri"],
}
diff --git a/ng-app/src/apps/ContainerView.svelte b/ng-app/src/apps/ContainerView.svelte
index d006393..21e1b9f 100644
--- a/ng-app/src/apps/ContainerView.svelte
+++ b/ng-app/src/apps/ContainerView.svelte
@@ -15,7 +15,7 @@
} from "../store";
import { link } from "svelte-spa-router";
import { Button, Progressbar, Spinner, Alert } from "flowbite-svelte";
- import{ PencilSquare } from "svelte-heros-v2";
+ import{ PlusCircle } from "svelte-heros-v2";
import { t } from "svelte-i18n";
import {
in_memory_discrete, open_viewer, set_viewer, set_editor, set_view_or_edit, cur_tab_branch_class, cur_tab_doc_can_edit, cur_tab
@@ -56,7 +56,7 @@
on:keypress={create}
class="select-none ml-0 mt-2 mb-10 text-white bg-primary-700 hover:bg-primary-700/90 focus:ring-4 focus:ring-primary-500/50 rounded-lg text-base p-2 text-center inline-flex items-center dark:focus:ring-primary-700/55"
>
-
+
{$t("doc.create")}
{/if}
diff --git a/ng-app/src/lib/FullLayout.svelte b/ng-app/src/lib/FullLayout.svelte
index 2affb04..b34f3e4 100644
--- a/ng-app/src/lib/FullLayout.svelte
+++ b/ng-app/src/lib/FullLayout.svelte
@@ -33,6 +33,9 @@
import PaneHeader from "./components/PaneHeader.svelte";
import BranchIcon from "./icons/BranchIcon.svelte";
import Message from "./components/Message.svelte";
+
+ import Signature from "./popups/Signature.svelte";
+
// @ts-ignore
import { t } from "svelte-i18n";
import { onMount, onDestroy, tick } from "svelte";
@@ -40,7 +43,8 @@
available_editors, available_viewers, set_editor, set_viewer, set_view_or_edit, toggle_live_edit,
has_editor_chat, all_files_count, all_comments_count, hideMenu, show_modal_menu, show_modal_create,
cur_tab_branch_nuri, cur_tab_doc_can_edit, cur_tab_doc_is_member, cur_tab_right_pane, cur_tab_folders_pane,
- cur_tab_toc_pane, cur_tab_show_menu, cur_tab_branch_has_discrete, cur_tab_graph_or_discrete, cur_tab_view_or_edit, show_spinner } from "../tab";
+ cur_tab_toc_pane, cur_tab_show_menu, cur_tab_branch_has_discrete, cur_tab_graph_or_discrete, cur_tab_view_or_edit, show_spinner,
+ in_private_store, show_doc_popup, cur_doc_popup, open_doc_popup } from "../tab";
import {
active_session, redirect_after_login, toasts, check_has_camera, toast_error,
reset_toasts,
@@ -390,6 +394,8 @@
}
return ct;
});
+ } else {
+ reset_toasts();
}
});
});
@@ -414,8 +420,8 @@
};
const openAction = (action:string) => {
- // TODO
hideMenu();
+ if (doc_popups[action]) open_doc_popup(action);
}
const openPane = (pane:string) => {
@@ -551,6 +557,10 @@
"mc":Sparkles,
};
+ const doc_popups = {
+ "signature": Signature,
+ }
+
let destination = "store";
$: destination = $cur_tab_branch_nuri === "" ? "mc" : destination == "mc" ? "store" : destination;
@@ -766,21 +776,28 @@
{$t("doc.menu.items.files.label")} {$all_files_count}
-
- { open_share = !open_share; scrollToMenuShare(); } }>
-
- {$t("doc.menu.items.share.label")}
-
- {#if open_share }
- {#each share_items as share}
- openShare(share.n) }>
-
- {$t(`doc.menu.items.${share.n}.label`)}
-
- {/each}
+ {#if !$in_private_store}
+
+ { open_share = !open_share; scrollToMenuShare(); } }>
+
+ {$t("doc.menu.items.share.label")}
+
+ {#if open_share }
+ {#each share_items as share}
+ openShare(share.n) }>
+
+ {$t(`doc.menu.items.${share.n}.label`)}
+
+ {/each}
+ {/if}
+ {:else}
+ openShare("download") }>
+
+ {$t(`doc.menu.items.download.label`)}
+
{/if}
openPane("comments") }>
@@ -836,7 +853,7 @@
/>
{$t("doc.menu.items.notifs.label")}
- {#if $cur_tab_doc_is_member}
+ {#if $cur_tab_doc_is_member && !$in_private_store}
openAction("permissions") }>
{#if open_tools }
{#each tools_items as tool}
- openAction(tool.n) }>
-
- {$t(`doc.menu.items.${tool.n}.label`)}
-
+ {#if !$in_private_store || tool.n !== "signature" }
+ openAction(tool.n) }>
+
+ {$t(`doc.menu.items.${tool.n}.label`)}
+
+ {/if}
{/each}
{/if}
{/if}
@@ -916,6 +935,16 @@
+