Metadata-Version: 2.1
Name: ape-aws
Version: 0.8.0a3
Summary: Ape AWS KMS: Ape plugin to make transactions through AWS KMS
Home-page: https://github.com/ApeWorX/ape-aws-kms
Author: ApeWorX Ltd.
Author-email: admin@apeworx.io
License: Apache-2.0
Keywords: ethereum
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.7,<4
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: boto3 <2,>=1.34.79
Requires-Dist: eth-ape <0.9,>=0.8.2
Requires-Dist: ecdsa <1,>=0.19.0
Requires-Dist: cryptography <38,>=37.0.4
Requires-Dist: importlib-metadata ; python_version < "3.8"
Provides-Extra: dev
Requires-Dist: pytest <9.0,>=8.0 ; extra == 'dev'
Requires-Dist: pytest-xdist ; extra == 'dev'
Requires-Dist: pytest-cov ; extra == 'dev'
Requires-Dist: hypothesis <7.0,>=6.2.0 ; extra == 'dev'
Requires-Dist: black <25,>=24.2.0 ; extra == 'dev'
Requires-Dist: mypy <2,>=1.8.0 ; extra == 'dev'
Requires-Dist: flake8 <8,>=7.0.0 ; extra == 'dev'
Requires-Dist: isort <6,>=5.10.1 ; extra == 'dev'
Requires-Dist: setuptools ; extra == 'dev'
Requires-Dist: wheel ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'
Requires-Dist: commitizen ; extra == 'dev'
Requires-Dist: pre-commit ; extra == 'dev'
Requires-Dist: pytest-watch ; extra == 'dev'
Requires-Dist: IPython ; extra == 'dev'
Requires-Dist: ipdb ; extra == 'dev'
Provides-Extra: lint
Requires-Dist: black <25,>=24.2.0 ; extra == 'lint'
Requires-Dist: mypy <2,>=1.8.0 ; extra == 'lint'
Requires-Dist: flake8 <8,>=7.0.0 ; extra == 'lint'
Requires-Dist: isort <6,>=5.10.1 ; extra == 'lint'
Provides-Extra: release
Requires-Dist: setuptools ; extra == 'release'
Requires-Dist: wheel ; extra == 'release'
Requires-Dist: twine ; extra == 'release'
Provides-Extra: test
Requires-Dist: pytest <9.0,>=8.0 ; extra == 'test'
Requires-Dist: pytest-xdist ; extra == 'test'
Requires-Dist: pytest-cov ; extra == 'test'
Requires-Dist: hypothesis <7.0,>=6.2.0 ; extra == 'test'

# Ape AWS KMS

Ape plugin to make transactions through AWS KMS

## Dependencies
- [python3](https://www.python.org/downloads) version 3.10 or greater, python3-dev

## Installation

### via `pip`

You can install the latest release via [`pip`](https://pypi.org/project/pip/):

```bash
pip install <PYPI_NAME>
```

### via `setuptools`

You can clone the repository and use [`setuptools`](https://github.com/pypa/setuptools) for the most up-to-date version:

```bash
git clone https://github.com/ApeWorX/<PYPI_NAME>.git
cd <PYPI_NAME>
python3 setup.py install
```

## Quick Usage

```bash
pip install ape-aws
```

### Using CLI tool

List commands:

```bash
ape aws -h
```

To create a new key:

```bash
ape aws kms create KeyAlias -d 'Description of new key'
```

To delete this key:

```bash
ape aws kms delete KeyAlias
```

To import an existing private key into KMS:

```bash
$ ape aws kms import KeyAlias
Enter your private key:
SUCCESS: Key imported successfully with ID: <key-id>
```

You can also import a private key from a file (from hex or bytes):

```bash
$ ape aws kms import KeyAlias --private-key <path-to-private-key>
INFO: Reading private key from <private-key-file>
SUCCESS: Key imported successfully with ID: <key-id>
```

You can import using a mnemonic phrase as well:

```bash
$ ape aws kms import KeyAlias --use-mnemonic
Enter your mnemonic phrase:
SUCCESS: Key imported successfully with ID: <key-id>
```

### IPython

First, create a KMS key with the CLI tool

```bash
ape console
```

```python
In [1]: kms_acct = accounts.load("KeyAlias")
In [2]: kms_acct.sign_message("12345")
Out[2]: <MessageSignature v=27, r=0x..., s=0x...>
```

## Development

This project is in development and should be considered a beta.
Things might not be in their final state and breaking changes may occur.
Comments, questions, criticisms and pull requests are welcomed.

## Prerequisites to AWS Setup

To begin, create a virtual environment set up and activate the virtual environment before doing anything for the setup of AWS

1. You must have an AWS account
2. Must be an AWS Identity and Access Management (IAM) user with administrator access
3. Must have configured AWS credentials
4. Must have [Docker](https://docs.docker.com/get-docker/),
   [Python3](https://www.python.org/downloads/) and
   [pip](https://pip.pypa.io/en/stable/installation/) installed on your workstation

## AWS Setup

#### For Mac and Linux
Create a `~/.aws` folder in your home directory:
```bash
mkdir ~/.aws
```

Note: get your access key and key id from your IAM in you AWS account [here](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html).
Create a `credentials` file in the `~/.aws` folder:
```bash
cat <<EOF > ~/.aws/credentials
[default]
aws_access_key_id = YOUR_ACCESS_KEY
aws_secret_access_key = YOUR_SECRET
EOF
```

Create a `config` file in the `~/.aws` folder:
```bash
cat <<EOF > ~/.aws/config
[default]
region = YOUR_REGION
output = json
EOF
```

## AWS KMS Key Import Steps

For manual setup, follow this [article](https://aws.amazon.com/blogs/database/import-ethereum-private-keys-to-aws-kms/)

## License

This project is licensed under the [Apache 2.0](LICENSE).
