@@ -21,7 +21,7 @@ namespace hmac_cpp {
2121 // / \param b Pointer to second array
2222 // / \param b_len Length of the second array
2323 // / \return true if both arrays are equal
24- bool constant_time_equals (const uint8_t * a, size_t a_len,
24+ HMAC_CPP_API bool constant_time_equals (const uint8_t * a, size_t a_len,
2525 const uint8_t * b, size_t b_len);
2626
2727 // / \brief Compare vectors in constant time.
@@ -98,7 +98,7 @@ namespace hmac_cpp {
9898 // / \param dk_len Desired length of the derived key in bytes, must be positive
9999 // / \param hash_type Hash function to use (SHA1, SHA256, SHA512)
100100 // / \return Derived key as a vector of bytes
101- std::vector<uint8_t > pbkdf2 (
101+ HMAC_CPP_API std::vector<uint8_t > pbkdf2 (
102102 const void * password_ptr, size_t password_len,
103103 const void * salt_ptr, size_t salt_len,
104104 uint32_t iterations, size_t dk_len,
@@ -220,7 +220,7 @@ namespace hmac_cpp {
220220 // / \param out_ptr Output buffer for derived key
221221 // / \param dk_len Length of output buffer in bytes, must be positive
222222 // / \return true on success, false on invalid parameters
223- bool pbkdf2 (Pbkdf2Hash prf,
223+ HMAC_CPP_API bool pbkdf2 (Pbkdf2Hash prf,
224224 const void * password_ptr, size_t password_len,
225225 const void * salt_ptr, size_t salt_len,
226226 uint32_t iterations, uint8_t * out_ptr, size_t dk_len) noexcept ;
@@ -292,7 +292,7 @@ namespace hmac_cpp {
292292 // / \param out_ptr Output buffer for derived key
293293 // / \param dk_len Length of output buffer in bytes, must be positive
294294 // / \return true on success, false on invalid parameters
295- bool pbkdf2_hmac_sha256 (const void * password_ptr, size_t password_len,
295+ HMAC_CPP_API bool pbkdf2_hmac_sha256 (const void * password_ptr, size_t password_len,
296296 const void * salt_ptr, size_t salt_len,
297297 uint32_t iterations, uint8_t * out_ptr, size_t dk_len) noexcept ;
298298
@@ -359,7 +359,7 @@ namespace hmac_cpp {
359359 // / \param dk_len Desired length of the derived key in bytes, must be positive.
360360 // / \param prf Hash function to use (SHA1, SHA256, SHA512).
361361 // / \return Derived key as a vector of bytes.
362- std::vector<uint8_t > pbkdf2_with_pepper (
362+ HMAC_CPP_API std::vector<uint8_t > pbkdf2_with_pepper (
363363 const void * password_ptr, size_t password_len,
364364 const void * salt_ptr, size_t salt_len,
365365 const void * pepper_ptr, size_t pepper_len,
@@ -438,7 +438,7 @@ namespace hmac_cpp {
438438 // / \param salt_ptr Pointer to optional salt buffer (may be null when salt_len is 0).
439439 // / \param salt_len Length of the salt in bytes.
440440 // / \return Pseudorandom key (PRK) as a byte vector.
441- std::vector<uint8_t > hkdf_extract_sha256 (
441+ HMAC_CPP_API std::vector<uint8_t > hkdf_extract_sha256 (
442442 const void * ikm_ptr, size_t ikm_len,
443443 const void * salt_ptr, size_t salt_len);
444444
@@ -459,7 +459,7 @@ namespace hmac_cpp {
459459 // / \param info_len Length of the info buffer in bytes.
460460 // / \param L Length of output keying material in bytes.
461461 // / \return Output keying material as a byte vector.
462- std::vector<uint8_t > hkdf_expand_sha256 (
462+ HMAC_CPP_API std::vector<uint8_t > hkdf_expand_sha256 (
463463 const void * prk_ptr, size_t prk_len,
464464 const void * info_ptr, size_t info_len,
465465 size_t L);
@@ -510,13 +510,8 @@ namespace hmac_cpp {
510510 // / \param hash_type Hash function to use (SHA1, SHA256, SHA512). Default is SHA256
511511 // / \return Hex-encoded HMAC-SHA256 of the rounded time value
512512 // / \throws std::runtime_error if the system time cannot be retrieved
513- std::string generate_time_token (const std::vector<uint8_t >& key, int interval_sec = 60 , TypeHash hash_type = TypeHash::SHA256 );
513+ HMAC_CPP_API std::string generate_time_token (const std::vector<uint8_t >& key, int interval_sec = 60 , TypeHash hash_type = TypeHash::SHA256 );
514514
515- // / \brief Generate time token using secure buffer key.
516- // / \param key Secret key bytes.
517- // / \param interval_sec Token rotation interval in seconds.
518- // / \param hash_type Hash function to use.
519- // / \return Hex-encoded token.
520515 inline std::string generate_time_token (const secure_buffer<uint8_t >& key, int interval_sec = 60 , TypeHash hash_type = TypeHash::SHA256 ) {
521516 return generate_time_token (std::vector<uint8_t >(key.begin (), key.end ()), interval_sec, hash_type);
522517 }
@@ -539,14 +534,7 @@ namespace hmac_cpp {
539534 // / \param hash_type Hash function to use (SHA1, SHA256, SHA512). Default is SHA256
540535 // / \return true if the token is valid within the ±1 interval range; false otherwise
541536 // / \throws std::runtime_error if the system time cannot be retrieved
542- bool is_token_valid (const std::string &token, const std::vector<uint8_t >& key, int interval_sec = 60 , TypeHash hash_type = TypeHash::SHA256 );
543-
544- // / \brief Validate time token using secure buffer key.
545- // / \param token Token to validate.
546- // / \param key Secret key bytes.
547- // / \param interval_sec Token rotation interval in seconds.
548- // / \param hash_type Hash function to use.
549- // / \return true if token is valid.
537+ HMAC_CPP_API bool is_token_valid (const std::string &token, const std::vector<uint8_t >& key, int interval_sec = 60 , TypeHash hash_type = TypeHash::SHA256 );
550538 inline bool is_token_valid (const std::string &token, const secure_buffer<uint8_t >& key, int interval_sec = 60 , TypeHash hash_type = TypeHash::SHA256 ) {
551539 return is_token_valid (token, std::vector<uint8_t >(key.begin (), key.end ()), interval_sec, hash_type);
552540 }
@@ -570,14 +558,8 @@ namespace hmac_cpp {
570558 // / \param hash_type Hash function to use (SHA1, SHA256, SHA512). Default is SHA256
571559 // / \return Hex-encoded HMAC-SHA256 of the concatenated timestamp and fingerprint
572560 // / \throws std::runtime_error if the system time cannot be retrieved
573- std::string generate_time_token (const std::vector<uint8_t >& key, const std::string &fingerprint, int interval_sec = 60 , TypeHash hash_type = TypeHash::SHA256 );
561+ HMAC_CPP_API std::string generate_time_token (const std::vector<uint8_t >& key, const std::string &fingerprint, int interval_sec = 60 , TypeHash hash_type = TypeHash::SHA256 );
574562
575- // / \brief Generate fingerprint-bound token using secure buffer key.
576- // / \param key Secret key bytes.
577- // / \param fingerprint Client identifier.
578- // / \param interval_sec Token rotation interval in seconds.
579- // / \param hash_type Hash function to use.
580- // / \return Hex-encoded token.
581563 inline std::string generate_time_token (const secure_buffer<uint8_t >& key, const std::string &fingerprint, int interval_sec = 60 , TypeHash hash_type = TypeHash::SHA256 ) {
582564 return generate_time_token (std::vector<uint8_t >(key.begin (), key.end ()), fingerprint, interval_sec, hash_type);
583565 }
@@ -602,15 +584,8 @@ namespace hmac_cpp {
602584 // / \param hash_type Hash function to use (SHA1, SHA256, SHA512). Default is SHA256
603585 // / \return true if the token is valid within the ±1 interval range; false otherwise
604586 // / \throws std::runtime_error if the system time cannot be retrieved
605- bool is_token_valid (const std::string &token, const std::vector<uint8_t >& key, const std::string &fingerprint, int interval_sec = 60 , TypeHash hash_type = TypeHash::SHA256 );
587+ HMAC_CPP_API bool is_token_valid (const std::string &token, const std::vector<uint8_t >& key, const std::string &fingerprint, int interval_sec = 60 , TypeHash hash_type = TypeHash::SHA256 );
606588
607- // / \brief Validate fingerprint-bound token using secure buffer key.
608- // / \param token Token to validate.
609- // / \param key Secret key bytes.
610- // / \param fingerprint Client identifier.
611- // / \param interval_sec Token rotation interval in seconds.
612- // / \param hash_type Hash function to use.
613- // / \return true if token is valid.
614589 inline bool is_token_valid (const std::string &token, const secure_buffer<uint8_t >& key, const std::string &fingerprint, int interval_sec = 60 , TypeHash hash_type = TypeHash::SHA256 ) {
615590 return is_token_valid (token, std::vector<uint8_t >(key.begin (), key.end ()), fingerprint, interval_sec, hash_type);
616591 }
@@ -635,7 +610,7 @@ namespace hmac_cpp {
635610 // / \param digits Desired number of digits in the OTP (typically 6–8, max 9)
636611 // / \param hash_type Hash function to use (SHA1, SHA256, SHA512). Default is SHA1
637612 // / \return One-Time Password (OTP) as an integer in the range [0, 10^digits)
638- int get_hotp_code (const void * key_ptr, size_t key_len, uint64_t counter, int digits = 6 , TypeHash hash_type = TypeHash::SHA1 );
613+ HMAC_CPP_API int get_hotp_code (const void * key_ptr, size_t key_len, uint64_t counter, int digits = 6 , TypeHash hash_type = TypeHash::SHA1 );
639614
640615 // / \brief Computes HOTP code from a vector of bytes as key (RFC 4226)
641616 // / \tparam T Must be either `char` or `uint8_t`
@@ -679,7 +654,7 @@ namespace hmac_cpp {
679654 // / \param digits Desired number of digits in the OTP (1-9)
680655 // / \return One-Time Password (OTP) as an integer
681656 // / \throws std::runtime_error if the digest is too short for dynamic truncation
682- int hotp_from_digest (const std::vector<uint8_t >& hmac_result, int digits);
657+ HMAC_CPP_API int hotp_from_digest (const std::vector<uint8_t >& hmac_result, int digits);
683658 }
684659
685660 // / \brief Computes TOTP (Time-Based One-Time Password) code for a specific timestamp
@@ -692,7 +667,7 @@ namespace hmac_cpp {
692667 // / \param hash_type Hash function to use (SHA1, SHA256, SHA512; default: SHA1)
693668 // / \return TOTP code as an integer
694669 // / \throws std::invalid_argument if period <= 0 or digits not in [1,9]
695- int get_totp_code_at (
670+ HMAC_CPP_API int get_totp_code_at (
696671 const void * key_ptr,
697672 size_t key_len,
698673 uint64_t timestamp,
@@ -765,7 +740,7 @@ namespace hmac_cpp {
765740 // / \return TOTP code as an integer.
766741 // / \throws std::invalid_argument if period <= 0 or digits not in [1,9].
767742 // / \throws std::runtime_error if the system time cannot be retrieved.
768- int get_totp_code (
743+ HMAC_CPP_API int get_totp_code (
769744 const void * key_ptr,
770745 size_t key_len,
771746 int period = 30 ,
@@ -822,7 +797,7 @@ namespace hmac_cpp {
822797 // / The +1 step check is skipped when the computed counter equals
823798 // / std::numeric_limits<uint64_t>::max().
824799 // / \throws std::invalid_argument if period <= 0 or digits not in [1,9]
825- bool is_totp_token_valid (
800+ HMAC_CPP_API bool is_totp_token_valid (
826801 int token,
827802 const void * key_ptr,
828803 size_t key_len,
@@ -912,7 +887,7 @@ namespace hmac_cpp {
912887 // / std::numeric_limits<uint64_t>::max().
913888 // / \throws std::invalid_argument if period <= 0 or digits not in [1,9]
914889 // / \throws std::runtime_error if the system time cannot be retrieved
915- bool is_totp_token_valid (
890+ HMAC_CPP_API bool is_totp_token_valid (
916891 int token,
917892 const void * key_ptr,
918893 size_t key_len,
0 commit comments