{"id":18408886,"url":"https://github.com/chmoder/data_vault","last_synced_at":"2025-04-07T09:33:21.083Z","repository":{"id":54765354,"uuid":"284498739","full_name":"chmoder/data_vault","owner":"chmoder","description":"Data Vault is a modular, pragmatic, credit card vault for Rust.","archived":false,"fork":false,"pushed_at":"2021-06-27T12:56:00.000Z","size":139,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T16:45:01.430Z","etag":null,"topics":["aes-128-cbc","aes-gcm-siv","async","blake3","credit-cards","data-vault","pci-dss","redis","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chmoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-02T16:26:26.000Z","updated_at":"2024-12-31T08:37:57.000Z","dependencies_parsed_at":"2022-08-14T02:10:29.393Z","dependency_job_id":null,"html_url":"https://github.com/chmoder/data_vault","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chmoder%2Fdata_vault","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chmoder%2Fdata_vault/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chmoder%2Fdata_vault/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chmoder%2Fdata_vault/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chmoder","download_url":"https://codeload.github.com/chmoder/data_vault/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247626645,"owners_count":20969340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aes-128-cbc","aes-gcm-siv","async","blake3","credit-cards","data-vault","pci-dss","redis","rust"],"created_at":"2024-11-06T03:22:08.304Z","updated_at":"2025-04-07T09:33:20.803Z","avatar_url":"https://github.com/chmoder.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data Vault\n\n\nData Vault is a library for storing and retrieving Credit Card data via Tokens.\n\n[![Actions Status](https://github.com/chmoder/data_vault/workflows/Rust/badge.svg)](https://github.com/chmoder/data_vault/actions)\n[![codecov](https://codecov.io/gh/chmoder/data_vault/branch/master/graph/badge.svg)](https://codecov.io/gh/chmoder/data_vault)\n[![Crates.io](https://img.shields.io/crates/v/data_vault)](https://crates.io/crates/data_vault)\n[![Documentation](https://docs.rs/data_vault/badge.svg)](https://docs.rs/data_vault)\n[![License](https://img.shields.io/crates/l/data_vault.svg)](https://img.shields.io/crates/l/data_vault.svg)\n[![Criterion](https://img.shields.io/criterion/chmoder/data_vault.svg)](https://criterion.dev/)\n\n\n```toml\n# Cargo.toml\n[dependencies]\ndata_vault = \"^0.3\"\n```\n\n```dotenv\n# Note: showing Redis and Postgres backend settings\n\n# REDIS CONFIGURATION\nREDIS_URL=redis://:foobared@127.0.0.1/\n# REDIS_POOL_MAX_SIZE=16\n\n# POSTGRES CONFIGURATION\nPOSTGRES.HOST=127.0.0.1\nPOSTGRES.USER=data_vault\nPOSTGRES.PASSWORD=foobared\nPOSTGRES.DBNAME=data_vault\nPOSTGRES.POOL.MAX_SIZE=100000\nPOSTGRES.POOLTIMEOUTS_WAIT_SECS=60\nPOSTGRES.POOL.TIMEOUTS_WAIT_NANOS=0\n\n# ENCRYPTION KEYS\nENCRYPTED_DATA_VAULT_KEY=000102030405060708090a0b0c0d0e0f\nENCRYPTED_DATA_VAULT_IV=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff\n```\n\n```rust\n// example.rs\n\n// traits\nuse data_vault::DataVault;\nuse data_vault::encryption::traits::Encryption;\n\n// Interchangeable backend\nuse data_vault::RedisDataVault;\n// Interchangeable encryption\nuse data_vault::encryption::AesGcmSivEncryption;\n// Interchangeable tokenizer\nuse data_vault::tokenizer::Blake3Tokenizer;\n\n// credit card type\nuse credit_card::CreditCard;\n\nuse tokio;\n\n#[tokio::main(flavor = \"multi_thread\")]\nasync fn main() {\n    let vault = RedisDataVault::\u003cAesGcmSivEncryption, Blake3Tokenizer\u003e::new().unwrap();\n    \n    let cc = CreditCard {\n        number: \"4111111111111111\".to_string(),\n        cardholder_name: \"Graydon Hoare\".to_string(),\n        expiration_month: \"01\".to_string(),\n        expiration_year: \"2023\".to_string(),\n        brand: None,\n        security_code: None\n    };\n    \n    let token = vault.store_credit_card(\u0026cc).await.unwrap();\n    let credit_card = vault.retrieve_credit_card(\u0026token.to_string()).await.unwrap();\n    assert_eq!(credit_card.number, cc.number)\n}\n```\n\n# Current Features\n- Store [Credit Cards](https://github.com/chmoder/credit_card)\n- Store `String`\n- Automatic Encryption and Decryption\n- Blake3 tokenization\n- Redis pool\n- Postgres pool\n- Configurable from .env file or Environment Variables\n- Interchangeable Backend\n- Interchangeable Encryption\n- Interchangeable Tokenization hasher\n\n\n# Performance (AMD Ryzen 9 3900X)\n## Redis\nThis [example](https://github.com/chmoder/data_vault/blob/master/examples/redis_benchmark.rs) output the following performance stats\nTokenize and stored **~18,000** credit cards per second.\n```\ntokenized and stored 100000 credit cards in 5.550836728s\nretrieved 100000 credit cards in 5.8276298s\ntokenized, stored, and retrieved 100000 credit cards in 11.378466528s\n```\n\n## Postgres\nThis [example](https://github.com/chmoder/data_vault/blob/master/examples/postgres_benchmark.rs) output the following performance stats\nTokenize and Store **~3,000** credit cards per second.\n```\ntokenized and stored 1000 credit cards in 336.54986ms\nretrieved 1000 credit cards in 54.622188ms\ntokenized, stored, and retrieved 1000 credit cards in 391.172048ms\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchmoder%2Fdata_vault","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchmoder%2Fdata_vault","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchmoder%2Fdata_vault/lists"}