Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Commit

Permalink
feat(auth): Remove auth message types.
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Auth message types removed as this is now managed via standard data types
  • Loading branch information
joshuef committed Dec 30, 2020
1 parent 5e06f5d commit 70ab97e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 174 deletions.
18 changes: 9 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ pub use map::{
UnseqEntryActions as MapUnseqEntryActions, Value as MapValue, Values as MapValues,
};
pub use messaging::{
Account, AccountRead, AccountWrite, Address, AdultDuties, AuthCmd, AuthQuery,
AuthorisationKind, BlobRead, BlobWrite, Cmd, CmdError, DataAuthKind, DataCmd, DataQuery, Duty,
ElderDuties, Event, MapRead, MapWrite, Message, MessageId, MiscAuthKind, MoneyAuthKind,
MsgEnvelope, MsgSender, NodeCmd, NodeCmdError, NodeDataCmd, NodeDataError, NodeDataQuery,
NodeDataQueryResponse, NodeDuties, NodeEvent, NodeQuery, NodeQueryResponse, NodeRewardError,
NodeRewardQuery, NodeRewardQueryResponse, NodeSystemCmd, NodeTransferCmd, NodeTransferError,
NodeTransferQuery, NodeTransferQueryResponse, Query, QueryResponse, SequenceRead,
SequenceWrite, TransferCmd, TransferError, TransferQuery, TransientElderKey,
TransientSectionKey, TryFromError, MAX_LOGIN_PACKET_BYTES,
Account, AccountRead, AccountWrite, Address, AdultDuties, AuthorisationKind, BlobRead,
BlobWrite, Cmd, CmdError, DataAuthKind, DataCmd, DataQuery, Duty, ElderDuties, Event, MapRead,
MapWrite, Message, MessageId, MiscAuthKind, MoneyAuthKind, MsgEnvelope, MsgSender, NodeCmd,
NodeCmdError, NodeDataCmd, NodeDataError, NodeDataQuery, NodeDataQueryResponse, NodeDuties,
NodeEvent, NodeQuery, NodeQueryResponse, NodeRewardError, NodeRewardQuery,
NodeRewardQueryResponse, NodeSystemCmd, NodeTransferCmd, NodeTransferError, NodeTransferQuery,
NodeTransferQueryResponse, Query, QueryResponse, SequenceRead, SequenceWrite, TransferCmd,
TransferError, TransferQuery, TransientElderKey, TransientSectionKey, TryFromError,
MAX_LOGIN_PACKET_BYTES,
};
pub use money::Money;

Expand Down
144 changes: 0 additions & 144 deletions src/messaging/auth.rs

This file was deleted.

14 changes: 5 additions & 9 deletions src/messaging/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,22 @@
// Software.

use super::super::transfer::TransferAgreementProof;
use super::{auth::AuthCmd, data::DataCmd, transfer::TransferCmd, AuthorisationKind};
use super::{data::DataCmd, transfer::TransferCmd, AuthorisationKind};
use crate::XorName;
use serde::{Deserialize, Serialize};

/// TODO: docs
#[allow(clippy::large_enum_variant)]
#[derive(Eq, PartialEq, Debug, Clone, Serialize, Deserialize)]
pub enum Cmd {
///
Auth(AuthCmd),
///
/// Commands for manipulating data
Data {
///
/// The data command struct itself
cmd: DataCmd,
///
/// Proof of payment for the data command
payment: TransferAgreementProof,
},
///
/// Command for transfering safe network tokens
Transfer(TransferCmd),
}

Expand All @@ -34,7 +32,6 @@ impl Cmd {
pub fn authorisation_kind(&self) -> AuthorisationKind {
use Cmd::*;
match self {
Auth(c) => c.authorisation_kind(),
Data { cmd, .. } => cmd.authorisation_kind(),
Transfer(c) => c.authorisation_kind(),
}
Expand All @@ -44,7 +41,6 @@ impl Cmd {
pub fn dst_address(&self) -> XorName {
use Cmd::*;
match self {
Auth(c) => c.dst_address(),
Data { cmd, .. } => cmd.dst_address(),
Transfer(c) => c.dst_address(),
}
Expand Down
4 changes: 0 additions & 4 deletions src/messaging/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// Software.

mod account;
mod auth;
mod blob;
mod cmd;
mod data;
Expand All @@ -22,7 +21,6 @@ mod transfer;

pub use self::{
account::{Account, AccountRead, AccountWrite, MAX_LOGIN_PACKET_BYTES},
auth::{AuthCmd, AuthQuery},
blob::{BlobRead, BlobWrite},
cmd::Cmd,
data::{DataCmd, DataQuery},
Expand Down Expand Up @@ -125,8 +123,6 @@ impl MsgEnvelope {
use Address::*;
use Cmd::*;
match cmd {
// temporary case, while not impl at `Authenticator`
Auth(_) => Ok(Section(self.origin.address().xorname())),
// always to `Payment` section
Transfer(c) => Ok(Section(c.dst_address())),
// Data dst (after reaching `Gateway`)
Expand Down
9 changes: 1 addition & 8 deletions src/messaging/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,14 @@
// specific language governing permissions and limitations relating to use of the SAFE Network
// Software.

use super::{
auth::AuthQuery, data::DataQuery, transfer::TransferQuery, AuthorisationKind, QueryResponse,
};
use super::{data::DataQuery, transfer::TransferQuery, AuthorisationKind, QueryResponse};
use crate::{Error, XorName};
use serde::{Deserialize, Serialize};

/// TODO: docs
#[allow(clippy::large_enum_variant)]
#[derive(Hash, Eq, PartialEq, Debug, Clone, Serialize, Deserialize)]
pub enum Query {
///
Auth(AuthQuery),
///
Data(DataQuery),
///
Expand All @@ -30,7 +26,6 @@ impl Query {
pub fn authorisation_kind(&self) -> AuthorisationKind {
use Query::*;
match self {
Auth(q) => q.authorisation_kind(),
Data(q) => q.authorisation_kind(),
Transfer(q) => q.authorisation_kind(),
}
Expand All @@ -41,7 +36,6 @@ impl Query {
pub fn error(&self, error: Error) -> QueryResponse {
use Query::*;
match self {
Auth(q) => q.error(error),
Data(q) => q.error(error),
Transfer(q) => q.error(error),
}
Expand All @@ -51,7 +45,6 @@ impl Query {
pub fn dst_address(&self) -> XorName {
use Query::*;
match self {
Auth(q) => q.dst_address(),
Data(q) => q.dst_address(),
Transfer(q) => q.dst_address(),
}
Expand Down

0 comments on commit 70ab97e

Please sign in to comment.