Skip to content

Commit

Permalink
[feat] Expose API
Browse files Browse the repository at this point in the history
  • Loading branch information
ppodolsky committed Jul 8, 2024
1 parent fb13885 commit 86e492b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions iroh/src/client/docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use iroh_blobs::{export::ExportProgress, store::ExportMode, Hash};
use iroh_docs::{
actor::OpenState,
store::{DownloadPolicy, Query},
AuthorId, Capability, CapabilityKind, ContentStatus, DocTicket, NamespaceId, PeerIdBytes,
RecordIdentifier,
AuthorId, Capability, CapabilityKind, ContentStatus, DocTicket, NamespaceId, NamespaceSecret,
PeerIdBytes, RecordIdentifier,
};
use iroh_net::NodeAddr;
use portable_atomic::{AtomicBool, Ordering};
Expand Down Expand Up @@ -65,9 +65,9 @@ impl Client {
}

/// Export secret key
pub async fn export_secret_key(&self, doc_id: NamespaceId) -> Result<()> {
self.rpc.rpc(ExportSecretKeyRequest { doc_id }).await??;
Ok(())
pub async fn export_secret_key(&self, doc_id: NamespaceId) -> Result<NamespaceSecret> {
let response = self.rpc.rpc(ExportSecretKeyRequest { doc_id }).await??;
Ok(response.secret)
}

/// Import a document from a namespace capability.
Expand Down
2 changes: 1 addition & 1 deletion iroh/src/rpc_protocol/docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub enum Response {
SetDownloadPolicy(RpcResult<SetDownloadPolicyResponse>),
GetSyncPeers(RpcResult<GetSyncPeersResponse>),
StreamCreated(RpcResult<StreamCreated>),
ExportSecretKey(RpcResult<ExportSecretKeyResponse>)
ExportSecretKey(RpcResult<ExportSecretKeyResponse>),
}

/// Subscribe to events for a document.
Expand Down

0 comments on commit 86e492b

Please sign in to comment.