feat(scripts): private key to a vehicle-scoped permission JWT in one command - #21
Open
elffjs wants to merge 1 commit into
Open
feat(scripts): private key to a vehicle-scoped permission JWT in one command#21elffjs wants to merge 1 commit into
elffjs wants to merge 1 commit into
Conversation
…command
signin.sh stops at the /siwe sign-in token, which no data API accepts. Getting a
token dq will actually take meant four curls and a hand-run `cast wallet sign`
every time, which is enough friction that people avoid issuing test queries at
all — the GCP node went weeks with no cloudevent or range traffic, so several
per-op dashboards had never rendered a single sample.
vehicle-token.sh carries on through /exchange/tokens/exchange to the permission
token. The JWT is the only thing on stdout, so it composes:
TOKEN=$(PK=0x… TOKEN_ID=192641 scripts/vehicle-token.sh)
curl -H "authorization: Bearer $TOKEN" https://dq.gcp.dimo.xyz/query …
Progress and errors go to stderr; -v also dumps the decoded claims there, which
is how you check what the chain actually granted — the exchange returns a token
carrying only the permissions the license holds, so asking for more than you
have is not an error and would otherwise fail confusingly later.
Uses the deprecated-but-served tokenId/privileges fields rather than the newer
asset-DID + named-permissions shape, so it does not depend on which dauth is
deployed.
Validated end to end against dauth.gcp.dimo.xyz: challenge, personal_sign and
/siwe/token all succeed with a throwaway key, and /exchange correctly 403s
because that key holds no permissions on the vehicle.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PUy3eg2C7hDBPBNLyLRgkj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
signin.shstops at the/siwesign-in token, which no data API accepts. Getting a token dq will actually take means four curls and a hand-runcast wallet signevery time.That friction has a real cost: the GCP node went weeks with no cloudevent or range traffic, so several per-op dashboards had never rendered a single sample — not because the instrumentation was broken, but because nobody could conveniently issue the queries.
Usage
The JWT is the only thing on stdout, so it composes:
Progress and errors go to stderr.
-valso dumps the decoded claims there — that's how you check what the chain actually granted, since the exchange returns a token carrying only the permissions your license holds. Asking for more than you have is not an error and would otherwise fail confusingly later.Defaults target
dauth.gcp.dimo.xyzand the Polygon vehicle NFT;BASE_URL,NFT_CONTRACT,PRIVILEGESandAUDIENCEall override.Notes
tokenId/privilegesfields rather than the newer asset-DID + named-permissions shape, so it doesn't depend on which dauth is deployed.cast(Foundry),curl,jq— same assignin.sh.Validation
Run end to end against
dauth.gcp.dimo.xyz: challenge,personal_sign, and/siwe/tokenall succeed with a throwaway key;/exchangecorrectly returns 403 because that key holds no permissions on the vehicle. Guard paths (missingPK, missingTOKEN_ID, non-numericPRIVILEGES) checked too.🤖 Generated with Claude Code
https://claude.ai/code/session_01PUy3eg2C7hDBPBNLyLRgkj