card-validate

Crates.iocard-validate
lib.rscard-validate
version2.4.0
sourcesrc
created_at2017-08-27 09:56:02.668452
updated_at2024-03-30 21:06:31.829379
descriptionRust card validate detects and validates credit card numbers
homepagehttps://github.com/valeriansaliou/rs-card-validate
repositoryhttps://github.com/valeriansaliou/rs-card-validate.git
max_upload_size
id29433
size20,137
Valerian Saliou (valeriansaliou)

documentation

README

rs-card-validate

Test and Build Build and Release Buy Me A Coffee

Documentation

Crate

Detects and validates credit card numbers (type of card, number length and Luhn checksum).

Important notice: this is a complete rework of @rprotasov initial work, supporting more card providers and containing important validation fixes.

🇫🇷 Crafted in Brest, France.

Supported providers

Debit cards:

  • Visa Electron
  • Maestro
  • Forbrugsforeningen
  • Dankort

Credit cards:

  • Visa
  • MasterCard
  • American Express
  • MIR
  • Diners Club
  • Discover
  • UnionPay
  • JCB

Install library

In your Cargo.toml:

[dependencies]
card-validate = "2.3"

Validate a number

extern crate card_validate;

use card_validate::Validate;

let card_number = "5236313877109142";

match Validate::from(card_number) {
  Ok(result) => println!("Card type is: {}", result.card_type.name()),
  Err(err) => println!("Card is invalid: {:?}", err)
}
Commit count: 64

cargo fmt