From 43ef85038bfee945679bf8e1ce6870ad998bc416 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 10 Jul 2022 12:06:16 +0200 Subject: [PATCH] Tweak model for access tokens --- .../versions/65387f69edfb_add_indieauth_access_token_model.py | 2 +- app/ldsig.py | 1 - app/models.py | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/alembic/versions/65387f69edfb_add_indieauth_access_token_model.py b/alembic/versions/65387f69edfb_add_indieauth_access_token_model.py index 710d438..2ba207d 100644 --- a/alembic/versions/65387f69edfb_add_indieauth_access_token_model.py +++ b/alembic/versions/65387f69edfb_add_indieauth_access_token_model.py @@ -21,7 +21,7 @@ def upgrade() -> None: op.create_table('indieauth_access_token', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), - sa.Column('indieauth_authorization_request_id', sa.Integer(), nullable=False), + sa.Column('indieauth_authorization_request_id', sa.Integer(), nullable=True), sa.Column('access_token', sa.String(), nullable=False), sa.Column('expires_in', sa.Integer(), nullable=False), sa.Column('scope', sa.String(), nullable=False), diff --git a/app/ldsig.py b/app/ldsig.py index 5ff0bad..3668516 100644 --- a/app/ldsig.py +++ b/app/ldsig.py @@ -65,7 +65,6 @@ async def verify_signature( key_id = doc["signature"]["creator"] key = await _get_public_key(db_session, key_id) - print(key) to_be_signed = _options_hash(doc) + _doc_hash(doc) signature = doc["signature"]["signatureValue"] signer = PKCS1_v1_5.new(key.pubkey or key.privkey) # type: ignore diff --git a/app/models.py b/app/models.py index c37b9bd..625a624 100644 --- a/app/models.py +++ b/app/models.py @@ -423,7 +423,7 @@ class IndieAuthAccessToken(Base): created_at = Column(DateTime(timezone=True), nullable=False, default=now) indieauth_authorization_request_id = Column( - Integer, ForeignKey("indieauth_authorization_request.id"), nullable=False + Integer, ForeignKey("indieauth_authorization_request.id"), nullable=True ) access_token = Column(String, nullable=False, unique=True, index=True)