Metadata-Version: 2.4
Name: InstaPassEncrypt
Version: 0.1.0
Summary: Encrypt a password in the format Instagram's login expects.
Author: tingirifistik
License-Expression: MIT
Project-URL: Homepage, https://github.com/tingirifistik/InstaPassEncrypt
Project-URL: Source, https://github.com/tingirifistik/InstaPassEncrypt
Keywords: instagram,password,encryption,login
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cryptography>=42.0
Requires-Dist: pynacl>=1.5
Dynamic: license-file

# InstaPassEncrypt
[![Hits](https://hits.sh/github.com/tingirifistik/InstaPassEncrypt.svg?label=views&color=007ec6)](https://hits.sh/github.com/tingirifistik/InstaPassEncrypt/)


Encrypt a password in the format Instagram's web login expects
(`#PWD_INSTAGRAM_BROWSER:...`). The public encryption key is fetched
automatically from Instagram's login page.

## Installation

```bash
pip install InstaPassEncrypt
```

## Usage

As a library:

```python
from InstaPassEncrypt import encrypt_password

enc = encrypt_password("my_password")
print(enc)
# #PWD_INSTAGRAM_BROWSER:10:1700000000:AAEK...
```

Reuse the key when encrypting several passwords (one less network request each time):

```python
from InstaPassEncrypt import fetch_key, encrypt_password

key = fetch_key()
a = encrypt_password("first", key)
b = encrypt_password("second", key)
```

From the command line:

```bash
instapassencrypt
# Password: (type it, then Enter)

# or
python -m InstaPassEncrypt
```

## API

- `encrypt_password(password, key=None)`: returns the encrypted string. Fetches a key if none is given.
- `fetch_key(timeout=10)`: fetches and returns a `PasswordKey` from Instagram's login page.
- `PasswordKey(id, public_key, version)`: holds the key data.
- `KeyFetchError`: raised when the key can't be found on the login page.

## Disclaimer

Only for use with your own account. You are responsible for complying with
Instagram's Terms of Service.

## License

MIT
