Skip to content

Opaque tokens#313

Open
jonbarrow wants to merge 14 commits into
devfrom
feat/grpc-tokens
Open

Opaque tokens#313
jonbarrow wants to merge 14 commits into
devfrom
feat/grpc-tokens

Conversation

@jonbarrow
Copy link
Copy Markdown
Member

@jonbarrow jonbarrow commented Jan 2, 2026

Resolves #107 and #108

Changes:

Moves tokens to random data instead of storing the data directly. Trying to fit all the data inside the token was a losing battle because of how space-limited it all ways. This removes clients abilities to handle data entirely locally, but that's fine since it's only a single network hop. I made the tokens be the length of what they are from the official sources, despite the fact that some can sometimes be bigger, just to keep things simple

Marking as a draft because this isn't finished. The entire gRPC side needs to be done, which relies on PretendoNetwork/grpc#10 being merged. Also for gRPC, I think we should just ditch the v1 implementation entirely since it's token handling is fundementally incomaptible with this new handling. Just cut our losses there

Comment thread src/database.ts Fixed
Comment thread src/services/nnas/routes/oauth.ts Outdated
Comment thread src/services/api/routes/v1/register.ts
Comment thread src/services/api/routes/v1/login.ts
Comment thread src/models/independent-service-token.ts
Comment thread src/models/oauth-token.ts
@mrjvs
Copy link
Copy Markdown
Contributor

mrjvs commented Jan 2, 2026

I haven't checked token sizes in my review, will possibly need to be checked by someone else

@jonbarrow jonbarrow marked this pull request as ready for review January 15, 2026 02:21
@jonbarrow
Copy link
Copy Markdown
Member Author

jonbarrow commented Jan 15, 2026

This should be ready for review now. I did test that it builds locally and it does, though not much else. It should all work fine though, the changes just replace manual token handling with DB lookups so nothing huge really

I'm not going to be here tomorrow however, so do feel free to make any required bug fixes/changes while I'm out just to push things along

Comment thread src/services/api/routes/v1/login.ts
throw new ServerError(Status.INVALID_ARGUMENT, 'Invalid token');
}

// TODO - Add checks for the client ID/title ID and matching system/token types here
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This comment is inaccurate, there isn't any title ID in use here, this should be about client ID / client secret

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.

[Enhancement]: Store tokens in database

5 participants