generate_code_standalone

Function generate_code_standalone 

Source
pub fn generate_code_standalone(
    secret_key: &[u8; 32],
    counter: u64,
    alphabet_str: Option<&str>,
    code_length: Option<usize>,
    check_position: Option<CheckPosition>,
) -> String
Expand description

Generate a code with standalone parameters.

This is useful for testing or one-off generation without a .bin file.

§Arguments

  • secret_key - 32-byte secret key
  • counter - Counter value
  • alphabet_str - Alphabet string (default if None)
  • code_length - Number of random characters (9 default)
  • check_position - Check digit position (End default)

§Example

use promocrypt_core::{generate_code_standalone, CheckPosition};

let secret = [0u8; 32];
let code = generate_code_standalone(&secret, 0, None, None, None);
assert_eq!(code.len(), 10);