Compare commits
2 Commits
5dbf93013a
...
1.4
Author | SHA1 | Date | |
---|---|---|---|
972c5577f4 | |||
671286dc39 |
@ -11,10 +11,14 @@ class MasterPass(sqlmodel.SQLModel, table=True):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
salt: bytes = sqlmodel.Field(
|
salt: bytes = sqlmodel.Field(
|
||||||
sa_column=sqlmodel.Column(sqlmodel.BINARY(64), nullable=False)
|
sa_column=sqlmodel.Column(sqlmodel.BINARY(64), nullable=False),
|
||||||
|
max_length=64,
|
||||||
|
min_length=64,
|
||||||
)
|
)
|
||||||
password_hash: bytes = sqlmodel.Field(
|
password_hash: bytes = sqlmodel.Field(
|
||||||
sa_column=sqlmodel.Column(sqlmodel.BINARY(128), nullable=False)
|
sa_column=sqlmodel.Column(sqlmodel.BINARY(128), nullable=False),
|
||||||
|
max_length=128,
|
||||||
|
min_length=128,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -22,13 +26,17 @@ class Account(sqlmodel.SQLModel, table=True):
|
|||||||
__tablename__ = "accounts"
|
__tablename__ = "accounts"
|
||||||
__table_args__ = (sqlmodel.PrimaryKeyConstraint("user_id", "name"),)
|
__table_args__ = (sqlmodel.PrimaryKeyConstraint("user_id", "name"),)
|
||||||
user_id: int = sqlmodel.Field()
|
user_id: int = sqlmodel.Field()
|
||||||
name: str = sqlmodel.Field(max_length=255)
|
name: str = sqlmodel.Field(max_length=256)
|
||||||
salt: bytes = sqlmodel.Field(
|
salt: bytes = sqlmodel.Field(
|
||||||
sa_column=sqlmodel.Column(sqlmodel.BINARY(64), nullable=False)
|
sa_column=sqlmodel.Column(sqlmodel.BINARY(64), nullable=False),
|
||||||
|
max_length=64,
|
||||||
|
min_length=64,
|
||||||
)
|
)
|
||||||
enc_login: bytes = sqlmodel.Field(
|
enc_login: bytes = sqlmodel.Field(
|
||||||
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(256), nullable=False)
|
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(256), nullable=False),
|
||||||
|
max_length=256,
|
||||||
)
|
)
|
||||||
enc_password: bytes = sqlmodel.Field(
|
enc_password: bytes = sqlmodel.Field(
|
||||||
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(256), nullable=False)
|
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(256), nullable=False),
|
||||||
|
max_length=256,
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
from typing import Self
|
from typing import Self
|
||||||
|
|
||||||
from cryptography.hazmat.backends import default_backend
|
|
||||||
from cryptography.hazmat.primitives import hashes
|
from cryptography.hazmat.primitives import hashes
|
||||||
from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305
|
from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305
|
||||||
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
|
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
|
||||||
@ -22,7 +21,6 @@ class Cipher:
|
|||||||
length=32,
|
length=32,
|
||||||
salt=salt,
|
salt=salt,
|
||||||
iterations=100000,
|
iterations=100000,
|
||||||
backend=default_backend(),
|
|
||||||
)
|
)
|
||||||
return cls(kdf.derive(password))
|
return cls(kdf.derive(password))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user