Skip to main content

API Reference

import

  from secure_settings import Settings

The settings are stored in sqlite in encrypted form

CLI

You need to use salt to access correct data.
main.py <salt> <command> <argv_command>

Commands:
1. set_settings:
        argv:
            "name_settings=value_settings,name_settings2=value_settings2"
        description:
            Set settings into base
        example:
            main.py salt set_settings "name_settings=value_settings,name_settings2=value_settings2"
2. get_settings
        description:
            Get all settings from base
3. clear_settings
        description:
            Delete all settings on base
4. from_file
        argv:
            path_to_settings
        description:
            Filling in settings from a file
        example:
            main.py salt from_file file_settings                             
        example file:
            path_to_work;C:\\\\Program Files(x86)\\projects\\tralala.prj
            git_repo;E:\\\\tralala\\git
5. to_file
        argv:
            path_to_settings_to_upload
        description:
            Upload settings into file
        example:
            main.py salt to_file file_settings

Library

The program must be run with at least one parameter indicating the encryption key.

	main.py this_is_salt

Running without salt will result in a program error:

Missing key parameter. Read help.\nPress ENTER to exit.

Default values when initializing the class

Settings(delete_after_filling=True, close_after_get=True)

settings = Settings() readed_settings = settings.get_all() print(readed_settings.path_to_lib)

var/lib/

Using in you programms

run with argument string

from from secure_settings import Settings

settings = Settings()
dict_settings = settings.get_all()

Thats all, simple as one, two, three You may read settings:

dict_settings['path_to_repo']

or

dict_settings.path_to_repo

Security

There are two methods of encryption and decryption for the settings class:

    def encode(self, clear):
        enc = []
        for i in range(len(clear)):
            key_c = self.salt[i % len(self.salt)]
            enc_c = chr((ord(clear[i]) + ord(key_c)) % 256)
            enc.append(enc_c)
        return base64.urlsafe_b64encode("".join(enc).encode()).decode()

    def decode(self, enc):
        dec = []
        enc = base64.urlsafe_b64decode(enc).decode()
        for i in range(len(enc)):
            key_c = self.salt[i % len(self.salt)]
            dec_c = chr((256 + ord(enc[i]) - ord(key_c)) % 256)
            dec.append(dec_c)
        return "".join(dec)

After viewing the settings file without decryption, we will see something like the following:

#=path_to_libwqLDl8ONw6bCosONw5XDlsKi

Release files for secure-settings 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for secure-settings 1.0.3
File Size Uploaded
secure_settings-1.0.3.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for secure-settings 1.0.3
File Interpreter ABI Platform
secure_settings-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / secure_settings-1.0.3.tar.gz

Download URL secure_settings-1.0.3.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a8419914edb17ee77da2903af184d4102358827c3065d16985b5bc912a5480b6
BLAKE2b-256 checksum
How to use checksums
36b7a7e14d6355ccdec09b55ad7cee8f754a7ea41968f4c31822a735cb2cf929
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.9.1 Windows/10

Release files / secure_settings-1.0.3-py3-none-any.whl

Download URL secure_settings-1.0.3-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
101dcabc44700bdef14f3e97dbe026f7c3965201899ba294a5fac1eed582aab9
BLAKE2b-256 checksum
How to use checksums
06810e205024c9feccdbc951f54e4770d6fd532a3c965acb25d3bb186a10151e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.9.1 Windows/10

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page