Skip to content

Conversation

@tomaz-lc
Copy link
Contributor

@tomaz-lc tomaz-lc commented Jan 13, 2026

Details

This PR introduces new limacharlie get-token --hours=<expiry time in hours> command which allows users to generate
JWTs with longer expiration time.

Use cases include operations which require longer expiration tokens (e.g. search results download).

Keep in mind that this feature is implemented as a low level utility command. In the future when search results download
command is implemented, generating long lived token for the purpose of the download will be handled transparently by the new command.

Background

Long-running operations like search download jobs can run for several hours. The default JWT tokens expire after ~1 hour, which causes these jobs to fail mid-execution. This PR enables users to generate tokens with sufficient validity for their expected job duration.

Changes

SDK Changes (limacharlie/Manager.py)

  • New getJWT(expiry_seconds) public method that:
    • Accepts optional unix timestamp for token expiry
    • Validates expiry is in the future
    • Returns the JWT token string

CLI Changes (limacharlie/__main__.py)

  • New get-token command with options:
    • --hours: Token validity duration (default: 1 hour)
    • --format: Output format - raw (just token) or json (with metadata)
    • --environment: Specify which configured environment to use
  • Warns when generating tokens > 24 hours for security awareness
  • JSON output includes: token, expiry timestamp, ISO expiry, valid_hours, oid

Usage Examples

# Generate 8-hour token for search download jobs
limacharlie get-token --hours 8

# Generate token with JSON metadata
limacharlie get-token --hours 8 --format json

# Use specific environment
limacharlie get-token --env production --hours 12

Add support for generating JWT tokens with custom expiry times, useful for
long-running operations like search download jobs that may run for several hours.

Changes:
 - Add Manager.getJWT(expiry_seconds) public method to generate tokens with
   optional custom expiry timestamp
 - Add 'limacharlie get-token' CLI command with --hours and --format options
 - Add comprehensive unit tests for both SDK method and CLI command

The get-token command supports:
 - --hours: Token validity duration (default: 1, supports fractional values)
 - --format: Output format ('raw' for just the token, 'json' for metadata)
 - --environment: Specify which environment to use

Example usage:
  limacharlie get-token --hours 8                    # 8-hour token (raw)
  limacharlie get-token --hours 8 --format json      # With metadata
  limacharlie get-token --env prod --hours 12        # Specific environment
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.

2 participants