Repository navigation
C++ SDK: expose create_personal_access_token #4613
Description
The C++ SDK can log in with a personal access token, but can't create one. The bridge declaration is commented out in foreign/cpp/src/lib.rs.
Where
The same files as the list and delete issue: foreign/cpp/src/lib.rs (the commented-out create_personal_access_token), foreign/cpp/src/client.rs, foreign/cpp/src/client.cpp, foreign/cpp/include/iggy.hpp and foreign/cpp/tests/e2e/client.cpp.
Context
The Rust trait is create_personal_access_token(name: &str, expiry: PersonalAccessTokenExpiry) -> Result<RawPersonalAccessToken, IggyError>. RawPersonalAccessToken is a single token: String, shown to the user once at creation.
PersonalAccessTokenExpiry is an alias for IggyExpiry (core/common/src/utils/personal_access_token_expiry.rs), the same type as topic message expiry. The C++ SDK already maps that for topics: the Expiry class in iggy.hpp, the message_expiry_kind and message_expiry_value fields on TopicCreateOptions, and parse_message_expiry in foreign/cpp/src/type_conversion.rs. Reuse that rather than adding a new mapping.
This touches the same bridge region as the list and delete issue, so expect a small rebase if both are picked up.
Done looks like
client.CreatePersonalAccessToken("ci-token", expiry)returns the token string.- That token works with
WithPersonalAccessTokenon a new client. - Creating a duplicate name throws, and calling before login throws.
- The e2e suite covers each.
Steps
- Read the commented-out declaration in
lib.rs, and howExpiryreachesparse_message_expiryforcreate_topic. - Declare
create_personal_access_tokenin the bridge taking the name and the expiry kind and value, and return the tokenStringdirectly, sinceRawPersonalAccessTokenhas one field. - Implement it in
client.rsusingparse_message_expiry, which is private totype_conversion.rstoday, so make itpub(crate). - Add
CreatePersonalAccessToken(name, expiry)toIggyBlockingClientiniggy.hppandclient.cpp, taking anExpiryand documenting that the token is only returned once. - Add e2e tests: before-login throws, the happy path, a duplicate name, and a round trip that logs in with the new token through
WithPersonalAccessToken.
Activity
Subham-KRLX commentedon Oct 21, 2026
@justinmclean could you please assign this issue to me? I would like to work on exposing CreatePersonalAccessToken(name, expiry) in the C++ SDK. I plan to wire up the Rust bridge using the existing Expiry conversion in type_conversion.rs implement the client method, and add e2e tests covering token creation, duplicate errors, and logging in with the new token.
slbotbm commentedon Oct 21, 2026
@Subham-KRLX assigned. please also add tge function to the ihgh level client in include/iggy.hpp and src/client.cpp