Skip to content

Commit 59a840c

Browse files
committed
Make structs #[repr(C)] is the ffi feature is enabled
1 parent 3bc8ad6 commit 59a840c

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ authors = ["Tejas Mehta <[email protected]>"]
1010
version = "0.1.0"
1111
edition = "2021"
1212

13+
[features]
14+
default = []
15+
ffi = []
16+
1317
[dependencies]
1418
hmac = "0.12.0"
1519
sha-1 = "0.10.0"

src/hotp.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use base32::Alphabet;
1818
/// [RFC4226]: https://datatracker.ietf.org/doc/html/rfc4226
1919
2020
#[derive(Debug, Clone, Hash)]
21+
#[cfg_attr(feature = "ffi", repr(C))]
2122
pub struct HOTP {
2223
/// The secret key used in the HMAC process.
2324
///

src/totp.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use base32::Alphabet;
1717
/// [RFC6238]: https://datatracker.ietf.org/doc/html/rfc6238
1818
1919
#[derive(Debug, Clone, Hash)]
20+
#[cfg_attr(feature = "ffi", repr(C))]
2021
pub struct TOTP {
2122
/// The secret key used in the HMAC process.
2223
///

src/util.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use sha2::{Sha256, Sha512};
1515
/// [RFC6238]: https://datatracker.ietf.org/doc/html/rfc6238
1616
1717
#[derive(Debug, Copy, Clone, Hash)]
18+
#[cfg_attr(feature = "ffi", repr(C))]
1819
pub enum MacDigest {
1920
SHA1,
2021
SHA256,

0 commit comments

Comments
 (0)