# Path: pyledger/server/config.py
# SECRET = b'test'
# LIFETIME = 1
# 
# Path: pyledger/server/config.py
# SECRET = b'test'
# LIFETIME = 1


import base64
from enum import Enum
from cryptography.exceptions import InvalidKey
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, \
    LargeBinary
from sqlalchemy import create_engine, desc
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy.orm import sessionmaker, scoped_session
from pyledger.server.config import args
from pyledger.server.config import password_backend, SECRET
            backend=password_backend
        )
        try:
            kpdf.verify(password.encode('utf-8'), self.get_password())
            correct = True
        except InvalidKey as e:
            print(e)
            correct = False

        return correct

    @classmethod
    def query(cls):
        return DB.session.query(cls)

    @staticmethod
    def from_name(name):
        return User.query().filter(User.name == name).one_or_none()

    def get_permissions(self):
        return Permissions(self.profile)

    def set_permissions(self, permissions):
        self.profile = permissions.value


class Session(Model):
    __tablename__ = 'sessions'
    id = Column(Integer, primary_key=True)
    key = Column(String, unique=True)

# Path: pyledger/server/config.py
# SECRET = b'test'
# LIFETIME = 1
# 
# Path: pyledger/server/config.py
# SECRET = b'test'
# LIFETIME = 1


# Path: pyledger/server/db.py
import base64
from enum import Enum
from cryptography.exceptions import InvalidKey
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, \
    LargeBinary
from sqlalchemy import create_engine, desc
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy.orm import sessionmaker, scoped_session
from pyledger.server.config import args
from pyledger.server.config import password_backend, SECRET

            backend=password_backend
        )
        try:
            kpdf.verify(password.encode('utf-8'), self.get_password())
            correct = True
        except InvalidKey as e:
            print(e)
            correct = False

        return correct

    @classmethod
    def query(cls):
        return DB.session.query(cls)

    @staticmethod
    def from_name(name):
        return User.query().filter(User.name == name).one_or_none()

    def get_permissions(self):
        return Permissions(self.profile)

    def set_permissions(self, permissions):
        self.profile = permissions.value


class Session(Model):
    __tablename__ = 'sessions'
    id = Column(Integer, primary_key=True)
    key = Column(String, unique=True)

    registered = Column(DateTime)