"""RSA Keys. The RSA key saved into our codebase contains an id (unique), the public and private RSA key. Those keys are used to encrypt in the frontend the username and user's password. The id is also passed along in the request. Getting back the id allows us to fetch the private rsa key, which is used to decrypt the request. """ from sukimu.dynamodb import IndexDynamo from sukimu.dynamodb import TableDynamo from sukimu.fields import Field from sukimu.schema import Index from sukimu.schema import Schema from auth import config from auth.connectors import dynamodb RsaKey = Schema( TableDynamo(config.TABLE_RSA_KEY, dynamodb.connection), IndexDynamo( Index.PRIMARY, 'token', read_capacity=1, write_capacity=1), token=Field(required=True, basetype=str), public_key=Field(required=True, basetype=bytes), private_key=Field(required=True, basetype=bytes), # RsaKeys are only valid for a few minutes. date=Field(required=True, basetype=int))