Skip to content

Commit

Permalink
chore: remove ic_oss_cose
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Aug 17, 2024
1 parent f034d4c commit c705151
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 84 deletions.
36 changes: 7 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ members = [
"src/ic_oss_can",
"src/ic_oss",
"src/ic_oss_cli",
"src/ic_oss_cose",
"examples/ai_canister",
]
resolver = "2"
Expand All @@ -18,7 +17,7 @@ strip = true
opt-level = 's'

[workspace.package]
version = "0.7.1"
version = "0.7.2"
edition = "2021"
repository = "https://github.com/ldclabs/ic-oss"
keywords = ["file", "storage", "oss", "s3", "icp"]
Expand Down
1 change: 0 additions & 1 deletion src/ic_oss_bucket/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@ getrandom = { workspace = true }
lazy_static = "1.4"
hyperx = { git = "https://github.com/ldclabs/hyperx", rev = "4b9bd373b8c4d29a32e59912bf598ba69273c032" }
ic-oss-types = { path = "../ic_oss_types", version = "0.7" }
ic-oss-cose = { path = "../ic_oss_cose", version = "0.7" }
2 changes: 1 addition & 1 deletion src/ic_oss_bucket/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use ic_http_certification::{
cel::{create_cel_expr, DefaultCelBuilder},
HttpCertification, HttpCertificationPath, HttpCertificationTree, HttpCertificationTreeEntry,
};
use ic_oss_cose::{Token, BUCKET_TOKEN_AAD};
use ic_oss_types::{
cose::{Token, BUCKET_TOKEN_AAD},
file::{
FileChunk, FileInfo, UpdateFileInput, CHUNK_SIZE, MAX_FILE_SIZE, MAX_FILE_SIZE_PER_CALL,
},
Expand Down
1 change: 0 additions & 1 deletion src/ic_oss_cluster/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ serde = { workspace = true }
serde_bytes = { workspace = true }
getrandom = { workspace = true }
ic-oss-types = { path = "../ic_oss_types", version = "0.7" }
ic-oss-cose = { path = "../ic_oss_cose", version = "0.7" }
8 changes: 4 additions & 4 deletions src/ic_oss_cluster/src/api_admin.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use candid::Principal;
use ic_cdk::api::management_canister::main::*;
use ic_oss_cose::{
cose_sign1, coset::CborSerializable, sha256, Token as CoseToken, BUCKET_TOKEN_AAD,
CLUSTER_TOKEN_AAD, ES256K,
};
use ic_oss_types::{
bucket::Token,
cluster::{AddWasmInput, DeployWasmInput},
cose::{
cose_sign1, coset::CborSerializable, sha256, Token as CoseToken, BUCKET_TOKEN_AAD,
CLUSTER_TOKEN_AAD, ES256K,
},
format_error,
permission::Policies,
};
Expand Down
2 changes: 1 addition & 1 deletion src/ic_oss_cluster/src/api_auth.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use candid::Principal;
use ic_oss_cose::{
use ic_oss_types::cose::{
cose_sign1, coset::CborSerializable, sha256, Token, BUCKET_TOKEN_AAD, CLUSTER_TOKEN_AAD, ES256K,
};
use serde_bytes::ByteBuf;
Expand Down
2 changes: 1 addition & 1 deletion src/ic_oss_cluster/src/store.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use candid::Principal;
use ciborium::{from_reader, into_writer};
use ic_oss_cose::{sha256, CLUSTER_TOKEN_AAD};
use ic_oss_types::{
cluster::{AddWasmInput, BucketDeploymentInfo, ClusterInfo},
cose::{sha256, CLUSTER_TOKEN_AAD},
permission::Policies,
};
use ic_stable_structures::{
Expand Down
27 changes: 0 additions & 27 deletions src/ic_oss_cose/Cargo.toml

This file was deleted.

15 changes: 0 additions & 15 deletions src/ic_oss_cose/README.md

This file was deleted.

1 change: 1 addition & 0 deletions src/ic_oss_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ icrc-ledger-types = { workspace = true }
k256 = { workspace = true }
ed25519-dalek = { workspace = true }
sha2 = { workspace = true }
coset = "0.3.8"
5 changes: 3 additions & 2 deletions src/ic_oss_cose/src/lib.rs → src/ic_oss_types/src/cose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use coset::{
iana, Algorithm, CborSerializable, CoseSign1, CoseSign1Builder, HeaderBuilder,
};
use ed25519_dalek::{Signature, VerifyingKey};
use ic_oss_types::bucket;
use k256::{ecdsa, ecdsa::signature::hazmat::PrehashVerifier};
use num_traits::ToPrimitive;
use serde::{Deserialize, Serialize};
Expand All @@ -14,6 +13,8 @@ use sha2::Digest;
pub use coset;
pub use iana::Algorithm::{EdDSA, ES256K};

use crate::bucket;

const CLOCK_SKEW: i64 = 5 * 60; // 5 minutes
const ALG_ED25519: Algorithm = Algorithm::Assigned(EdDSA);
const ALG_SECP256K1: Algorithm = Algorithm::Assigned(ES256K);
Expand Down Expand Up @@ -197,8 +198,8 @@ pub fn sha256(data: &[u8]) -> [u8; 32] {
#[cfg(test)]
mod test {
use super::*;
use crate::permission::{Operation, Permission, Policies, Policy, Resource, Resources};
use ed25519_dalek::Signer;
use ic_oss_types::permission::{Operation, Permission, Policies, Policy, Resource, Resources};

#[test]
fn test_ed25519_token() {
Expand Down
1 change: 1 addition & 0 deletions src/ic_oss_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::collections::BTreeMap;

pub mod bucket;
pub mod cluster;
pub mod cose;
pub mod file;
pub mod folder;
pub mod permission;
Expand Down

0 comments on commit c705151

Please sign in to comment.