Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: implement glome verify subcommand #200

Merged
merged 1 commit into from
Feb 24, 2025
Merged

Conversation

burgerdev
Copy link
Collaborator

@burgerdev burgerdev commented Feb 15, 2025

This PR adds the verify subcommand to the Rust CLI. Input tags can be truncated outputs of the tag subcommand (i.e., in base64-encoded form), the minimum size of a tag can be adjusted with a flag.

Verify a message tag

Usage: glome verify [OPTIONS] --key <FILE> --peer <FILE> <TAG>

Arguments:
  <TAG>
          Tag to verify

Options:
  -k, --key <FILE>
          Path to secret key

  -p, --peer <FILE>
          Path to peer's public key

  -c, --counter <n>
          Message counter index

      --min-tag-length <n>
          Minimum tag length
          
          Ideally a multiple of 4, defaults to 10 matching the MIN_ENCODED_AUTHCODE_LEN in login/login.h. Must be at least 2 and will be increased to 2 if the argument is lower.
          
          [default: 10]

  -h, --help
          Print help (see a summary with '-h')

Closes #188.

@burgerdev burgerdev requested a review from pkern February 15, 2025 11:45
Copy link
Member

@pkern pkern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM but one question.

tag_b64.truncate(tag_b64.len() - 1);
}

// Ensure that we're comparing at least one byte.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the minimum tag length would need to be checked by the caller of verify, right? I weakly feel that this is surprising behavior and there should be some minimum tag length setting/flag that you need to pass. I could be convinced otherwise.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, yes. I added a flag for this and set the default as we do in login.h.

Copy link
Member

@pkern pkern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pkern pkern merged commit 3b327f5 into google:master Feb 24, 2025
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reach CLI feature parity with Rust
2 participants