05/18 Enhanced codes and functionalities 4
This commit is contained in:
@@ -32,12 +32,19 @@ class SharedItem(db.Model):
|
||||
db.ForeignKey('users.id', ondelete='SET NULL'),
|
||||
nullable=True,
|
||||
)
|
||||
# Plaintext metadata — not sensitive, used for display before decryption
|
||||
# Non-sensitive fallback label (set to item_type, e.g. "password").
|
||||
# The actual display name is stored encrypted in enc_name/iv_name below.
|
||||
item_name = db.Column(db.String(255), nullable=False)
|
||||
item_type = db.Column(db.String(20), nullable=False, default='password')
|
||||
# ECDH-encrypted payload
|
||||
enc_data = db.Column(db.Text, nullable=False)
|
||||
iv = db.Column(db.String(64), nullable=False)
|
||||
# Encrypted item name — AES-256-GCM with the ECDH shared secret.
|
||||
# enc_name: base64 ciphertext of the display name string.
|
||||
# iv_name : base64 12-byte GCM nonce.
|
||||
# Nullable for backwards compatibility with rows created before this column existed.
|
||||
enc_name = db.Column(db.String(512), nullable=True)
|
||||
iv_name = db.Column(db.String(64), nullable=True)
|
||||
|
||||
accepted = db.Column(db.Boolean, default=False, nullable=False)
|
||||
created_at = db.Column(db.DateTime, default=lambda: datetime.now(timezone.utc).replace(tzinfo=None), nullable=False)
|
||||
@@ -53,6 +60,8 @@ class SharedItem(db.Model):
|
||||
'item_type': self.item_type,
|
||||
'enc_data': self.enc_data,
|
||||
'iv': self.iv,
|
||||
'enc_name': self.enc_name,
|
||||
'iv_name': self.iv_name,
|
||||
'accepted': self.accepted,
|
||||
'created_at': self.created_at.isoformat() if self.created_at else None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user