generated from atsign-company/archetype
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Full re-write of SDK #22
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
d48e51f
feat: Created trait and implementation for low-level crypto operations
df7dca8
feat: Added aes functionality to at_crypto crate
549cac5
refactor: moved cryto_functions_trait into at_chops crate as a form o…
28ffa58
feat: created at_chops methods
b963803
feat: Added at_chops functionality
6b72ddf
feat: Created tls client and trait for creating a connection
8e8c5dc
feat: Added at_errors crate
0568df0
feat: Added at_records and at_sign crates
ae76646
feat: created at_secrets crate
23c3aad
feat: started implementation of verbs crate
094d55d
refactor: updated tls client to use trait object instead of generics
d2b47bb
refactor: updated at_chops crypto trait to use concrete types so that…
3335af5
feat: added from verb implementation
abf1836
refactor: split up pkam verb from from verb
a940371
feat: added scan verb
0acf71c
feat: updated parse_server_response to remove given prefix from result
29029e3
feat: partial implementation of lookup verb
0a5adb0
feat: created new at_client and implemented at_server dns lookup and …
64fa84d
test: Added new test for from verb
a9d115f
Added trace level logging to at_chops
aa2b8c3
feat: Added scan to client and as an example
da8a4dd
feat: Updated AtId to be an AtKey and added associated methods for co…
e6d1517
feat: finished implementing lookup verb
37cd8c9
feat: Added llookup, plookup and update verbs
42a96b2
refactor: update verb has 2 different constructors to make using it e…
4bd7e77
feat: full implementation of reading text data complete
dba0401
Added functionality to be able to send data
7dc31d2
chore: Updated examples and readme to be clearer
45985d6
Merge remote-tracking branch 'upstream/trunk' into trunk
5163a46
chore: Updated readme to fix error
6b31592
docs: Added information about how to run tests in the README
e09436d
refactor: fixed clippy errors
b069a02
Merge branch 'trunk' into trunk
cpswan bbf6321
Merge branch 'trunk' into trunk
cpswan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Binary file not shown.
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,17 @@ | ||
[package] | ||
name = "at_chops" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
aes = "0.8.3" | ||
anyhow = "1.0.79" | ||
base64 = "0.21.0" | ||
cipher = "0.4.4" | ||
crypto = "0.5.1" | ||
ctr = "0.9.2" | ||
log = "0.4.20" | ||
rand = "0.8.5" | ||
rsa = { version = "0.9.2", features = ["sha2"] } |
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,49 @@ | ||
use aes::cipher::StreamCipher; | ||
use anyhow::Result; | ||
use rsa::{RsaPrivateKey, RsaPublicKey}; | ||
|
||
/// A trait for cryptographic functions needed within the atSign library. | ||
pub trait CryptoFunctions { | ||
// ----- Base64 ----- | ||
/// Encode a byte array to base64 String. | ||
fn base64_encode(&self, data: &[u8]) -> String; | ||
|
||
/// Decode a base64 encoded string. | ||
fn base64_decode(&self, data: &[u8]) -> Result<Vec<u8>>; | ||
|
||
// ----- RSA ----- | ||
/// Construct an RSA private key from a byte array. | ||
fn construct_rsa_private_key(&self, key: &[u8]) -> Result<RsaPrivateKey>; | ||
|
||
/// Construct an RSA public key from a byte array. | ||
fn construct_rsa_public_key(&self, key: &[u8]) -> Result<RsaPublicKey>; | ||
|
||
/// Generate a new RSA key pair. | ||
fn generate_rsa_key_pair(&self) -> Result<(RsaPrivateKey, RsaPublicKey)>; | ||
|
||
/// Verify a signature using an RSA public key. | ||
fn rsa_verify(&self, data: &[u8], signature: &[u8], key: &RsaPublicKey) -> Result<bool>; | ||
|
||
/// Sign data (given as a byte array) using an RSA private key. | ||
/// The signature is returned as a byte array. | ||
fn rsa_sign(&self, data: &[u8], key: &RsaPrivateKey) -> Result<Vec<u8>>; | ||
|
||
/// Encrypt some data using an RSA public key. | ||
fn rsa_encrypt(&self, plaintext: &[u8], key: &RsaPublicKey) -> Result<Vec<u8>>; | ||
|
||
/// Decrypt some data using an RSA private key. | ||
fn rsa_decrypt(&self, ciphertext: &[u8], key: &RsaPrivateKey) -> Result<Vec<u8>>; | ||
|
||
// ----- AES ----- | ||
/// Construct an AES-256 cipher from a byte array and IV. | ||
fn construct_aes_cipher(&self, key: &[u8], iv: &[u8; 16]) -> Result<Box<dyn StreamCipher>>; | ||
|
||
/// Create a new AES-256 key from scratch. | ||
fn create_new_aes_key(&self) -> Result<[u8; 32]>; | ||
|
||
/// Encrypt some data using an AES key. | ||
fn aes_encrypt(&self, cipher: &mut dyn StreamCipher, plaintext: &[u8]) -> Result<Vec<u8>>; | ||
|
||
/// Decrypt some data using an AES key. | ||
fn aes_decrypt(&self, cipher: &mut dyn StreamCipher, ciphertext: &[u8]) -> Result<Vec<u8>>; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please bump the version to 0.3.0