Skip to content

Commit

Permalink
Doc fix
Browse files Browse the repository at this point in the history
Add missing doc strings, and fix bare URLs in existing docs.

Signed-off-by: setrofim <setrofim@gmail.com>
  • Loading branch information
setrofim committed Jun 21, 2023
1 parent 1ce28ff commit 5b41088
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub fn decode_str(v: &str) -> Result<Vec<u8>, Error> {
.map_err(|e| Error::ParseError(e.to_string()))
}

/// a `Vec<u8>` encoded as base64 in human readable serialization
#[derive(Debug, PartialEq)]
pub struct Bytes(Vec<u8>);

Expand Down
6 changes: 3 additions & 3 deletions src/ear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ enum KeyFormat {
pub struct Ear {
/// The EAT profile of the associated claim-set
///
/// See https://datatracker.ietf.org/doc/html/draft-ietf-rats-eat-19#name-eat_profile-eat-profile-cla
/// See <https://datatracker.ietf.org/doc/html/draft-ietf-rats-eat-19#name-eat_profile-eat-profile-cla>
pub profile: String,
/// "Issued At" -- the time at which the EAR is issued
///
/// See:
/// - https://datatracker.ietf.org/doc/html/draft-ietf-rats-eat-19#section-4.3.1
/// - https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6
/// - <https://datatracker.ietf.org/doc/html/draft-ietf-rats-eat-19#section-4.3.1>
/// - <https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6>
pub iat: i64,
/// Identifier of the verifier that created the EAR
pub vid: VerifierID,
Expand Down
10 changes: 10 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,34 @@

use thiserror::Error;

/// EAR errors
#[derive(Error, Debug)]
pub enum Error {
/// an error occured while parsing serialized structures
#[error("parse error: {0}")]
ParseError(String),
/// an error occured while formatting structures
#[error("format error: {0}")]
FormatError(String),
/// an error occured during signing
#[error("sign error: {0}")]
SignError(String),
/// an error occured during verification
#[error("verify error: {0}")]
VerifyError(String),
/// an error occured while processing cryptographic keys
#[error("key error: {0}")]
KeyError(String),
/// an error occured during validation of the internal integrity of structures
#[error("validation error: {0}")]
ValidationError(String),
// invalid claim value
#[error("invalid value: {0}")]
InvalidValue(i8),
// invalid string name
#[error("invalid name: {0}")]
InvalidName(String),
// invalid integer key
#[error("invalid key: {0}")]
InvalidKey(i32),
}
3 changes: 3 additions & 0 deletions src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ use serde::{

use crate::error::Error;

/// identifies the verifier that produced the EAR
#[derive(Debug, PartialEq)]
pub struct VerifierID {
/// uniquely identifies the software build running the verifier
pub build: String,
/// uniquely identifies the organizational unit responsible for this build
pub developer: String,
}

Expand Down
1 change: 1 addition & 0 deletions src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use serde::{
ser::{Serialize, SerializeMap},
};

/// public key that is being attested
#[derive(Debug, PartialEq)]
pub struct KeyAttestation {
pub pub_key: Bytes,
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ pub use self::trust::claim::TrustClaim;
pub use self::trust::tier::TrustTier;
pub use self::trust::vector::TrustVector;

/// trustworthiness claims
pub mod claim {
pub use super::trust::claim::CRYPTO_VALIDATION_FAILED;
pub use super::trust::claim::NO_CLAIM;
Expand Down
1 change: 1 addition & 0 deletions src/nonce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ impl<'de> Visitor<'de> for OneNonceVisitor {
}
}

/// echoed back by the verifier to provide freshness
#[derive(Debug, PartialEq)]
pub struct Nonce(Vec<OneNonce>);

Expand Down
1 change: 1 addition & 0 deletions src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use serde::ser::{SerializeMap as _, SerializeSeq as _, SerializeTupleVariant as

use crate::base64::Bytes;

/// deserialized raw JSON object or CBOR map
#[derive(Debug, PartialEq)]
pub enum RawValue {
Integer(i64),
Expand Down
2 changes: 1 addition & 1 deletion src/trust/claim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ pub static SOURCED_DATA_CLAIM_MAP: &Map<i8, ValueDescription<'static>> = &phf_ma
///
/// This is a claim regarding the trustworthiness of one aspect of the attested environment, as
/// defined in
/// https://datatracker.ietf.org/doc/html/draft-ietf-rats-ar4si-04#name-trustworthiness-claims
/// <https://datatracker.ietf.org/doc/html/draft-ietf-rats-ar4si-04#name-trustworthiness-claims>
#[derive(Debug, Clone, Copy)]
pub struct TrustClaim {
/// Claim value
Expand Down

0 comments on commit 5b41088

Please sign in to comment.