-
-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Bump version to v0.1.0 2. Improve documentation 3. Add Cargo.lock 4. Improve std, no-std and no-std with alloc handling 5. Add tests Co-authored-by: Jared Stanbrough <[email protected]>
- Loading branch information
1 parent
6ad67d9
commit dc0441b
Showing
12 changed files
with
371 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,32 @@ | ||
[package] | ||
name = "ockam_credential" | ||
version = "0.1.0" | ||
authors = ["Ockam Developers"] | ||
categories = [] | ||
description = "" | ||
documentation = "https://docs.rs/ockam_credentials" | ||
edition = "2018" | ||
exclude = [ | ||
"tests/**" | ||
] | ||
homepage = "https://ockam.io" | ||
keywords = [] | ||
license = "Apache-2.0" | ||
name = "ockam_credential" | ||
homepage = "https://github.com/ockam-network/ockam" | ||
repository = "https://github.com/ockam-network/ockam/tree/develop/implementations/rust/ockam/ockam_credential" | ||
readme = "README.md" | ||
repository = "https://github.com/ockam-network/ockam/tree/develop/implementations/rust/ockam/ockam_credentials" | ||
version = "0.0.0" | ||
keywords = ["ockam", "authorization", "anonymous", "zero-knowledge", "credential"] | ||
categories = ["cryptography", "no-std"] | ||
description = """ | ||
Attribute based, privacy preserving, anonymous credentials. | ||
""" | ||
exclude = [ | ||
"DEVELOP.md", | ||
"LICENSE" | ||
] | ||
|
||
[features] | ||
default = ["std"] | ||
std = ["ockam_core/std", "alloc"] | ||
alloc = ["serde/alloc"] | ||
no-std = ["heapless"] | ||
std = ["alloc", "ockam_core/std"] | ||
no_std = ["heapless"] | ||
|
||
[dependencies] | ||
ockam_core = { path = "../ockam_core", version = "0.2.0", default-features = false } | ||
heapless = { version = "0.6", optional = true } | ||
ockam_core = { version = "0.1.0", default-features = false, path = "../ockam_core" } | ||
serde = { version = "1.0", default-features = false, features = ["derive"] } | ||
|
||
[dev-dependencies] | ||
serde_json = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../DEVELOP.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 8 additions & 7 deletions
15
implementations/rust/ockam/ockam_credential/src/attribute.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
use super::structs::*; | ||
use crate::{attribute_type::AttributeType, serdes::*}; | ||
use crate::{attribute_type::AttributeType, serde::*}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// Attributes describe the claims in credentials. The attribute | ||
/// describes the name of the claim, | ||
/// its meaning and how it is cryptographically signed | ||
/// An attribute describes a statement that the issuer of a credential is | ||
/// signing about the subject of the credential. | ||
#[derive(Clone, Debug, Serialize, Deserialize)] | ||
pub struct Attribute { | ||
/// The name of the attribute | ||
/// A label for the attribute. | ||
#[serde( | ||
serialize_with = "write_byte_string", | ||
deserialize_with = "read_byte_string" | ||
)] | ||
pub label: ByteString, | ||
/// A longer description of the meaning of the attribute | ||
|
||
/// A longer description of the meaning of the attribute. | ||
#[serde( | ||
serialize_with = "write_byte_string", | ||
deserialize_with = "read_byte_string" | ||
)] | ||
pub description: ByteString, | ||
/// The method that converts the attribute value to a cryptographic field element | ||
|
||
/// The data type of the attribute value. | ||
pub attribute_type: AttributeType, | ||
} |
10 changes: 5 additions & 5 deletions
10
implementations/rust/ockam/ockam_credential/src/attribute_type.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// A Mapper converts an arbitrary value to cryptographic field element | ||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)] | ||
/// The data type of an attribute's value. | ||
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)] | ||
pub enum AttributeType { | ||
/// The attribute is a UTF8 encoded string | ||
/// The attribute is a UTF8 encoded string. | ||
Utf8String, | ||
/// The attribute is a number either real or an integer | ||
/// The attribute is a number, either real or an integer. | ||
Number, | ||
/// The value is a byte sequence | ||
/// The value is a byte sequence. | ||
Blob, | ||
} |
Oops, something went wrong.