Skip to content

C++ SDK: expose create_personal_access_token #4613

Open

Description

@justinmclean

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 WithPersonalAccessToken on 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 how Expiry reaches parse_message_expiry for create_topic.
  • Declare create_personal_access_token in the bridge taking the name and the expiry kind and value, and return the token String directly, since RawPersonalAccessToken has one field.
  • Implement it in client.rs using parse_message_expiry, which is private to type_conversion.rs today, so make it pub(crate).
  • Add CreatePersonalAccessToken(name, expiry) to IggyBlockingClient in iggy.hpp and client.cpp, taking an Expiry and 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

  1. Subham-KRLX commented on Oct 21, 2026

    @Subham-KRLX

    @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.

  2. slbotbm commented on Oct 21, 2026

    @slbotbm
    Contributor

    @Subham-KRLX assigned. please also add tge function to the ihgh level client in include/iggy.hpp and src/client.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cppChange related to C++ code.good first issueGood for newcomers

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions