Skip to content

Commit

Permalink
Wrap minimum_valid_iat_time with our standard db encryption
Browse files Browse the repository at this point in the history
  • Loading branch information
MelissaAutumn committed Jan 12, 2024
1 parent de2dc65 commit 314cd41
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/src/appointment/database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Subscriber(Base):
short_link_hash = Column(StringEncryptedType(String, secret, AesEngine, "pkcs5", length=255), index=False)

# Only accept the times greater than the one specified in the `iat` claim of the jwt token
minimum_valid_iat_time = Column(DateTime, index=True)
minimum_valid_iat_time = Column('minimum_valid_iat_time', StringEncryptedType(DateTime, secret, AesEngine, "pkcs5", length=255))

calendars = relationship("Calendar", cascade="all,delete", back_populates="owner")
slots = relationship("Slot", cascade="all,delete", back_populates="subscriber")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@
Create Date: 2024-01-09 16:52:20.941572
"""
import os
from alembic import op
import sqlalchemy as sa
from sqlalchemy_utils import StringEncryptedType
from sqlalchemy_utils.types.encrypted.encrypted_type import AesEngine


def secret():
return os.getenv("DB_SECRET")


# revision identifiers, used by Alembic.
Expand All @@ -17,7 +24,7 @@


def upgrade() -> None:
op.add_column('subscribers', sa.Column('minimum_valid_iat_time', sa.DateTime, index=True))
op.add_column('subscribers', sa.Column('minimum_valid_iat_time', StringEncryptedType(sa.DateTime, secret, AesEngine, "pkcs5", length=255)))


def downgrade() -> None:
Expand Down

0 comments on commit 314cd41

Please sign in to comment.