rename client id -> client key

This commit is contained in:
Dustin J. Mitchell
2020-12-28 21:31:02 +00:00
parent e555af8895
commit 92d629522b
11 changed files with 124 additions and 122 deletions

View File

@@ -8,7 +8,7 @@ use crypto::{HistoryCiphertext, HistoryCleartext, Secret};
pub struct RemoteServer {
origin: String,
client_id: Uuid,
client_key: Uuid,
encryption_secret: Secret,
agent: ureq::Agent,
}
@@ -17,13 +17,13 @@ pub struct RemoteServer {
/// taskchampion-sync-server).
impl RemoteServer {
/// Construct a new RemoteServer. The `origin` is the sync server's protocol and hostname
/// without a trailing slash, such as `https://tcsync.example.com`. Pass a client_id to
/// without a trailing slash, such as `https://tcsync.example.com`. Pass a client_key to
/// identify this client to the server. Multiple replicas synchronizing the same task history
/// should use the same client_id.
pub fn new(origin: String, client_id: Uuid, encryption_secret: Vec<u8>) -> RemoteServer {
/// should use the same client_key.
pub fn new(origin: String, client_key: Uuid, encryption_secret: Vec<u8>) -> RemoteServer {
RemoteServer {
origin,
client_id,
client_key,
encryption_secret: encryption_secret.into(),
agent: ureq::agent(),
}
@@ -58,7 +58,7 @@ impl Server for RemoteServer {
) -> Fallible<AddVersionResult> {
let url = format!(
"{}/client/{}/add-version/{}",
self.origin, self.client_id, parent_version_id
self.origin, self.client_key, parent_version_id
);
let history_cleartext = HistoryCleartext {
parent_version_id,
@@ -89,7 +89,7 @@ impl Server for RemoteServer {
fn get_child_version(&mut self, parent_version_id: VersionId) -> Fallible<GetVersionResult> {
let url = format!(
"{}/client/{}/get-child-version/{}",
self.origin, self.client_id, parent_version_id
self.origin, self.client_key, parent_version_id
);
let resp = self
.agent