-
Notifications
You must be signed in to change notification settings - Fork 32
Anonymous credentials draft endpoints #1016
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
Draft
LDiazN
wants to merge
57
commits into
master
Choose a base branch
from
userauth-dep
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
2d81a8a
Fix capitalization in dockerfile
LDiazN e6c5fdc
Clone userauth repo into include dir
LDiazN 294af32
Add ooniauth-py as dependency
LDiazN 6754df8
Remove unused imports
LDiazN 42b5ec5
Add server state model for anonymous credentials
LDiazN 7c11874
remove unnecessary pass
LDiazN 0970cb5
Add utility functions to work with protocol objects
LDiazN c97f3ba
Add initialization of server state table
LDiazN 950cbe3
Add manifest endpoint
LDiazN a9990ed
Fix error with postgres dep
LDiazN 94a7936
Init server state dep in tests
LDiazN bcffac5
fix bare except
LDiazN 7b602c2
remove unused import
LDiazN 50e0c47
Add test file for anonymous credentials
LDiazN ad14987
Add register endpoint for anonymous credentials
LDiazN d286c76
Add test for credential sign request
LDiazN bfb5600
Add line to check if user is able to verify credential
LDiazN f582c8f
Improve error reporting
LDiazN db5763a
Add test for not found error
LDiazN f06ce42
Add test for protocol error
LDiazN 08413d7
Add test for bad serialization
LDiazN 75eead1
Refactor to share metrics to the entire module
LDiazN ddf860a
Creating manifest table
LDiazN 2baff84
Added foreign key to server state to fetch keys
LDiazN 4dd14be
Change register endpoint to use manifest version
LDiazN 9810800
Use new manifest style in endpoints
LDiazN 355e059
Use extra fields in measurement submission
LDiazN b9b9250
Testing measurement submission
LDiazN cff7f32
Improve testing of measurement submission
LDiazN ec63895
Fix broken test
LDiazN 6c667f0
Fix broken tests
LDiazN 985e89a
Fix bad fiture downgrade
LDiazN 4328d27
Add anonymous credentials related data to fastpath
LDiazN f93131a
Merge branch 'master' into userauth-dep
LDiazN 28cb8e0
fix broken tests
LDiazN 3b3bfb2
Add fastpath migration to oonimeasurements tests
LDiazN e0f4432
refactor to_http_exception
LDiazN 5b12744
Add new ooniauth dependency url
LDiazN f895dc8
Add anonymous creentials columns to ooniprobe test schema
LDiazN e7336cb
Use alter table instead of directly changing the table
LDiazN ca7e93d
Inline compression ratio; rename s_or_n to serialize_optional
LDiazN 536e774
Add error message to info log
LDiazN c40e14b
Add error message to info log
LDiazN 5deb275
Add utility functions for testing in ooniprobe
LDiazN 98f0025
Merge conflict
LDiazN cb52441
Add utils file for tests
LDiazN 0e0648e
Add better docstrings
LDiazN e315218
Add better docstrings
LDiazN d06e830
Add initial version of credential update endpoints
LDiazN 5fccf4a
Adding tests for credential update
LDiazN a8519a2
Fix bad error message
LDiazN 15ef04a
Add simple credential update test
LDiazN b8a3d9f
Refactor to move fixtures to conftest
LDiazN 1ffd959
Remove unused import
LDiazN c2f4e16
Add test with full workflow
LDiazN bc3069f
Merge branch 'master' into userauth-dep
LDiazN 4657422
Black reformat
LDiazN File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
71 changes: 71 additions & 0 deletions
71
.../common/src/common/alembic/versions/7e28b5d17a7f_add_server_state_table_for_anonymous_.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| """Add server state table for anonymous credentials | ||
|
|
||
| Revision ID: 7e28b5d17a7f | ||
| Revises: 8e7ecea5c2f5 | ||
| Create Date: 2025-10-08 10:36:55.796144 | ||
|
|
||
| """ | ||
|
|
||
| from typing import Sequence, Union | ||
|
|
||
| from alembic import op | ||
| import sqlalchemy as sa | ||
| import sqlalchemy.schema as sc | ||
|
|
||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision: str = "7e28b5d17a7f" | ||
| down_revision: Union[str, None] = "8e7ecea5c2f5" | ||
| branch_labels: Union[str, Sequence[str], None] = None | ||
| depends_on: Union[str, Sequence[str], None] = None | ||
|
|
||
| # --- | ||
| ooniprobe_server_state_id_seq = sc.Sequence("ooniprobe_server_state_id_seq", start=1) | ||
| ooniprobe_manifest_id_seq = sc.Sequence("ooniprobe_manifest_id_seq", start=1) | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| op.execute(sc.CreateSequence(ooniprobe_server_state_id_seq)) | ||
|
|
||
| op.create_table( | ||
| "ooniprobe_server_state", | ||
| sa.Column( | ||
| "id", | ||
| sa.String(), | ||
| nullable=False, | ||
| server_default=ooniprobe_server_state_id_seq.next_value(), | ||
| primary_key=True, | ||
| ), | ||
| sa.Column("date_created", sa.DateTime(timezone=True), nullable=False), | ||
| sa.Column("secret_key", sa.String(), nullable=False), | ||
| sa.Column("public_parameters", sa.String(), nullable=False), | ||
| ) | ||
|
|
||
| op.execute(sc.CreateSequence(ooniprobe_manifest_id_seq)) | ||
| op.create_table( | ||
| "ooniprobe_manifest", | ||
| sa.Column( | ||
| "version", | ||
| sa.String(), | ||
| nullable=False, | ||
| server_default=ooniprobe_manifest_id_seq.next_value(), | ||
| primary_key=True, | ||
| ), | ||
| sa.Column("date_created", sa.DateTime(timezone=True), nullable=False), | ||
| sa.Column("nym_scope", sa.String(), nullable=False), | ||
| sa.Column("submission_policy", sa.JSON(), nullable=False), | ||
|
|
||
| sa.Column( | ||
| "server_state_id", | ||
| sa.String(), | ||
| sa.ForeignKey("ooniprobe_server_state.id"), | ||
| nullable=False, | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| op.drop_table("ooniprobe_manifest") | ||
| op.drop_table("ooniprobe_server_state") | ||
| op.execute(sc.DropSequence(ooniprobe_server_state_id_seq)) | ||
| op.execute(sc.DropSequence(ooniprobe_manifest_id_seq)) |
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if at some point we renamed this function
gas something a bit more understandable. It's basically getting the key and if not it's setting to to False. Correct?I believe modern versions of python have native support for this.
I guess we can take note of it as a future refactoring work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just do that I think, the fastpath now runs in python 3.12 in AWS, this can be replaced with
measurement.get('is_verified', False)We can open another issue for that