request type for obtaining free pass

This commit is contained in:
Jędrzej Stuczyński
2024-02-09 13:54:13 +00:00
parent 6e7bac1e7e
commit 740cc72ec8
6 changed files with 52 additions and 1 deletions
@@ -15,6 +15,7 @@ pub const REWARDED: &str = "rewarded";
pub const COCONUT_ROUTES: &str = "coconut";
pub const BANDWIDTH: &str = "bandwidth";
pub const COCONUT_FREE_PASS: &str = "free-pass";
pub const COCONUT_BLIND_SIGN: &str = "blind-sign";
pub const COCONUT_VERIFY_BANDWIDTH_CREDENTIAL: &str = "verify-bandwidth-credential";
pub const COCONUT_EPOCH_CREDENTIALS: &str = "epoch-credentials";
+4 -1
View File
@@ -16,10 +16,13 @@ serde = { workspace = true, features = ["derive"] }
ts-rs = { workspace = true, optional = true }
tendermint = { workspace = true }
# for serde on secp256k1 signatures
ecdsa = { version = "0.16", features = ["serde"] }
nym-credentials-interface = { path = "../../common/credentials-interface" }
nym-crypto = { path = "../../common/crypto", features = ["serde", "asymmetric"]}
nym-mixnet-contract-common = { path= "../../common/cosmwasm-smart-contracts/mixnet-contract" }
nym-mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract" }
nym-node-requests = { path = "../../nym-node/nym-node-requests", default-features = false }
[features]
@@ -140,6 +140,20 @@ impl BlindedSignatureResponse {
}
}
#[derive(Serialize, Deserialize)]
pub struct FreePassRequest {
// secp256k1 key associated with the admin account
pub cosmos_pubkey: cosmrs::crypto::PublicKey,
pub inner_sign_request: BlindSignRequest,
/// Signature on the inner sign request
/// to prove the possession of the cosmos key/address
pub signature: cosmrs::crypto::secp256k1::Signature,
pub public_attributes_plain: Vec<String>,
}
#[derive(Serialize, Deserialize)]
pub struct VerificationKeyResponse {
pub key: VerificationKey,
+5
View File
@@ -26,6 +26,11 @@ use rocket::State as RocketState;
mod helpers;
pub async fn post_free_pass(state: &RocketState<State>) {
// attach secp256k1 pubkey; derive address; check contract admin verify signature
todo!()
}
#[post("/blind-sign", data = "<blind_sign_request_body>")]
// Until we have serialization and deserialization traits we'll be using a crutch
pub async fn post_blind_sign(
+14
View File
@@ -1729,6 +1729,7 @@ dependencies = [
"digest 0.10.7",
"elliptic-curve 0.13.5",
"rfc6979 0.4.0",
"serdect",
"signature 2.1.0",
"spki 0.7.2",
]
@@ -1837,6 +1838,7 @@ dependencies = [
"pkcs8 0.10.2",
"rand_core 0.6.4",
"sec1 0.7.3",
"serdect",
"subtle 2.4.1",
"zeroize",
]
@@ -3693,6 +3695,7 @@ dependencies = [
"bs58 0.4.0",
"cosmrs",
"cosmwasm-std",
"ecdsa 0.16.8",
"getset",
"nym-credentials-interface",
"nym-crypto",
@@ -5824,6 +5827,7 @@ dependencies = [
"der 0.7.8",
"generic-array 0.14.7",
"pkcs8 0.10.2",
"serdect",
"subtle 2.4.1",
"zeroize",
]
@@ -6149,6 +6153,16 @@ dependencies = [
"syn 2.0.28",
]
[[package]]
name = "serdect"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177"
dependencies = [
"base16ct 0.2.0",
"serde",
]
[[package]]
name = "serialize-to-javascript"
version = "0.1.1"
+14
View File
@@ -1480,6 +1480,7 @@ dependencies = [
"digest 0.10.7",
"elliptic-curve 0.13.5",
"rfc6979 0.4.0",
"serdect",
"signature 2.1.0",
"spki 0.7.2",
]
@@ -1588,6 +1589,7 @@ dependencies = [
"pkcs8 0.10.2",
"rand_core 0.6.4",
"sec1 0.7.3",
"serdect",
"subtle 2.4.1",
"zeroize",
]
@@ -3097,6 +3099,7 @@ dependencies = [
"bs58 0.4.0",
"cosmrs 0.15.0 (git+https://github.com/jstuczyn/cosmos-rust?branch=nym-temp/all-validator-features)",
"cosmwasm-std",
"ecdsa 0.16.8",
"getset",
"nym-credentials-interface",
"nym-crypto",
@@ -4690,6 +4693,7 @@ dependencies = [
"der 0.7.8",
"generic-array 0.14.7",
"pkcs8 0.10.2",
"serdect",
"subtle 2.4.1",
"zeroize",
]
@@ -4878,6 +4882,16 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "serdect"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177"
dependencies = [
"base16ct 0.2.0",
"serde",
]
[[package]]
name = "serialize-to-javascript"
version = "0.1.1"