Taddes 6b09e9947a
Some checks failed
Checks / python-checks (push) Has been cancelled
Checks / rust-checks (push) Has been cancelled
Glean probe-scraper / glean-probe-scraper (push) Has been cancelled
Build, Tag and Push Container Images to GAR Repository / check (push) Has been cancelled
Build, Tag and Push Container Images to GAR Repository / build-and-push-syncstorage-rs (push) Has been cancelled
Build, Tag and Push Container Images to GAR Repository / build-and-push-syncserver-postgres (push) Has been cancelled
Build, Tag and Push Container Images to GAR Repository / build-and-push-syncserver-postgres-enterprise-gar (push) Has been cancelled
Build, Tag and Push Container Images to GAR Repository / build-and-push-syncstorage-rs-spanner-python-utils (push) Has been cancelled
Build, Tag and Push Container Images to GAR Repository / build-and-push-syncserver-postgres-python-utils (push) Has been cancelled
Build, Tag and Push Container Images to GAR Repository / build-and-push-syncserver-postgres-python-utils-enterprise-gar (push) Has been cancelled
Build, Tag and Push Container Images to GAR Repository / build-and-push-syncserver-mysql (push) Has been cancelled
MySQL Build and Test / build-and-test-mysql (push) Has been cancelled
MySQL Build and Test / build-mysql-image (push) Has been cancelled
MySQL Build and Test / mysql-e2e-tests (push) Has been cancelled
Postgres Build and Test / build-and-test-postgres (push) Has been cancelled
Postgres Build and Test / build-postgres-image (push) Has been cancelled
Postgres Build and Test / postgres-e2e-tests (push) Has been cancelled
Publish Sync docs to pages / build-mdbook (push) Has been cancelled
Publish Sync docs to pages / build-openapi (push) Has been cancelled
Publish Sync docs to pages / combine-and-prepare (push) Has been cancelled
Publish Sync docs to pages / deploy (push) Has been cancelled
Spanner Build, Test, and Push / build-and-test-spanner (push) Has been cancelled
Spanner Build, Test, and Push / build-spanner-image (push) Has been cancelled
Spanner Build, Test, and Push / spanner-e2e-tests (push) Has been cancelled
chore: upgrade Python for all utils and refactor (#2127)
chore: upgrade Python for all utils and refactor
2026-03-24 16:23:04 -04:00
..
2025-08-04 15:37:46 -04:00

Make a Hawk compatible Auth header

Dependencies and Environment Setup:

To use the syncstorage-rs make_hawk_token.py script, you'll need a Python =>3.10 development environment with Poetry installed. You can also directly call the script using Poetry as described in step 5.

The easiest solution recommended to use pyenv and the pyenv-virtualenv plugin for your virtual environments as a way to isolate the dependencies from other directories.

  1. Install pyenv using the latest documentation for your platform.

  2. Follow the instructions to install the pyenv-virtualenv plugin. See the pyenv-virtualenv documentation.

  3. Ensure you've added pyenv and pyenv-virtualenv to your PATH.

    Ex:

    export PATH="$HOME/.pyenv/bin:$PATH"
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"
    
  4. Install version, create virtualenv, activate and install dependencies from inside the hawk/ directory. Note you can simply install dependencies, not create a virtual environment and invoke the script using poetry run.

    $ cd syncstorage-rs/tools/hawk
    # pyenv version install
    $ pyenv install 3.14
    
    # creates named, associated virtualenv
    $ pyenv virtualenv 3.14 hawk # or whatever project name you like.
    $ pyenv local hawk # activates virtual env whenever you enter this directory. 
    
    # Install dependencies
    $ pip install poetry
    $ poetry install
    
  5. In general, to run the script with the Poetry managed dependencies - once you're already in your virtual env - run the following (more details in #3): poetry run python make_hawk_token.py

Create a Token Header:

You'll need to pass along your SYNC_MASTER_SECRET and the uri you'll be testing in order to generate a valid Hawk Id:

poetry run python make_hawk_token.py --uri /1.5/1/storage/meta/global --secret=$SYNC_MASTER_SECRET --as_header

** For testing against uri's using methods other than GET, you'll need to pass along the --method flag to generate your token. Ie, poetry run python make_hawk_token.py --method PUT --uri /1.5/1/storage/meta/global --secret=$SYNC_MASTER_SECRET --as_header. See examples/put.bash for an example of this.

Use -h for help.

By default, with no passed arguments, a default Hawk Id token will be generated mapping to your localhost:8000 with the path http://localhost:8000/1.5/1/storage/col2/.