fix(router): feature gate openssl deps for basilisk feature (#536)

This commit is contained in:
Sampras Lopes
2023-02-11 14:10:58 +05:30
committed by GitHub
parent 1ba6b8c9f8
commit e4956820fd
4 changed files with 18 additions and 10 deletions

View File

@ -12,7 +12,7 @@ build = "src/build.rs"
[features] [features]
default = ["kv_store", "stripe", "oltp", "olap","accounts_cache"] default = ["kv_store", "stripe", "oltp", "olap","accounts_cache"]
kms = ["aws-config", "aws-sdk-kms"] kms = ["aws-config", "aws-sdk-kms"]
basilisk = [] basilisk = ["josekit"]
stripe = ["dep:serde_qs"] stripe = ["dep:serde_qs"]
sandbox = ["kms", "stripe", "basilisk"] sandbox = ["kms", "stripe", "basilisk"]
olap = [] olap = []
@ -48,7 +48,7 @@ frunk_core = "0.4.1"
futures = "0.3.25" futures = "0.3.25"
hex = "0.4.3" hex = "0.4.3"
http = "0.2.8" http = "0.2.8"
josekit = "0.8.1" josekit = { version = "0.8.1", optional = true }
jsonwebtoken = "8.2.0" jsonwebtoken = "8.2.0"
literally = "0.1.3" literally = "0.1.3"
maud = { version = "0.24", features = ["actix-web"] } maud = { version = "0.24", features = ["actix-web"] }

View File

@ -8,16 +8,16 @@ use router_env::{instrument, tracing};
#[cfg(not(feature = "basilisk"))] #[cfg(not(feature = "basilisk"))]
use crate::types::storage; use crate::types::storage;
use crate::{ use crate::{
core::{ core::errors::{self, CustomResult, RouterResult},
errors::{self, CustomResult, RouterResult}, logger, routes,
payment_methods::transformers as payment_methods,
},
logger, routes, services,
types::api, types::api,
utils::{self, BytesExt, StringExt}, utils::{self, StringExt},
}; };
#[cfg(feature = "basilisk")]
use crate::{core::payment_methods::transformers as payment_methods, services, utils::BytesExt};
#[cfg(feature = "basilisk")]
const VAULT_SERVICE_NAME: &str = "CARD"; const VAULT_SERVICE_NAME: &str = "CARD";
#[cfg(feature = "basilisk")]
const VAULT_VERSION: &str = "0"; const VAULT_VERSION: &str = "0";
pub struct SupplementaryVaultData { pub struct SupplementaryVaultData {
@ -381,6 +381,7 @@ impl Vault {
} }
//------------------------------------------------TokenizeService------------------------------------------------ //------------------------------------------------TokenizeService------------------------------------------------
#[cfg(feature = "basilisk")]
pub async fn create_tokenize( pub async fn create_tokenize(
state: &routes::AppState, state: &routes::AppState,
value1: String, value1: String,
@ -444,6 +445,7 @@ pub async fn create_tokenize(
} }
} }
#[cfg(feature = "basilisk")]
pub async fn get_tokenized_data( pub async fn get_tokenized_data(
state: &routes::AppState, state: &routes::AppState,
lookup_key: &str, lookup_key: &str,
@ -500,6 +502,7 @@ pub async fn get_tokenized_data(
} }
} }
#[cfg(feature = "basilisk")]
pub async fn delete_tokenized_data( pub async fn delete_tokenized_data(
state: &routes::AppState, state: &routes::AppState,
lookup_key: &str, lookup_key: &str,

View File

@ -1,11 +1,14 @@
pub mod api; pub mod api;
pub mod authentication; pub mod authentication;
#[cfg(feature = "basilisk")]
pub mod encryption; pub mod encryption;
pub mod logger; pub mod logger;
use std::sync::Arc; use std::sync::Arc;
pub use self::{api::*, encryption::*}; pub use self::api::*;
#[cfg(feature = "basilisk")]
pub use self::encryption::*;
use crate::connection::{diesel_make_pg_pool, PgPool}; use crate::connection::{diesel_make_pg_pool, PgPool};
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,6 +1,7 @@
use std::{num::Wrapping, str}; use std::{num::Wrapping, str};
use error_stack::{report, IntoReport, ResultExt}; use error_stack::{report, IntoReport, ResultExt};
#[cfg(feature = "basilisk")]
use josekit::jwe; use josekit::jwe;
use rand; use rand;
use ring::{aead::*, error::Unspecified}; use ring::{aead::*, error::Unspecified};
@ -175,6 +176,7 @@ pub fn get_key_id(keys: &Jwekey) -> &str {
} }
} }
#[cfg(feature = "basilisk")]
pub async fn encrypt_jwe( pub async fn encrypt_jwe(
keys: &Jwekey, keys: &Jwekey,
msg: &str, msg: &str,