passwordless-38


Namepasswordless-38 JSON
Version 0.0.9 PyPI version JSON
download
home_page
SummaryA client library for Bitwardens Passwordless.dev API
upload_time2023-08-30 05:41:10
maintainer
docs_urlNone
authorBitwarden
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Bitwarden Passwordless.dev Python 3.8 SDK Client

A Python client library for interacting with the Bitwarden Passwordless.dev API.

## Installation

1. Install the package using pip:

```bash
pip install passwordless-38
```

## Usage

### Configuration

You can store the API configurations in a file named `passwordlessconfig.ini` for easier management and security.

#### Creating a Configuration File

Create a file named `passwordlessconfig.ini` in the same directory as your script, with the following content:

```ini
[API]
API_URL = https://v4.passwordless.dev
API_SECRET = Your-API-Secret-Here
API_KEY = Your-API-Key-Here
VERIFY = True
```

Replace the values with your actual API secret and public API key.

The `PasswordlessClient` class will automatically read this file and use the specified configurations when making requests to the Passwordless.dev API.

#### Reading the Configuration in Code

Use the `configparser` module to read the configuration file and pass the keys to the `PasswordlessClient`:

```python
import configparser

config = configparser.ConfigParser()
config.read('config.ini')

api_secret = config['passwordless']['api_secret']
# api_key can be accessed similarly if needed

```
### Importing the Client

Once the package is installed, you can import the `PasswordlessClient` class in your Python script or application:

```python
from passwordless-38 import PasswordlessClient
```

### Creating a Client Instance

Create an instance of the `PasswordlessClient` class, providing your API private secret:

```python
client = PasswordlessClient(api_secret)
```

### Using the Client's Methods

You can now use the various methods provided by the `PasswordlessClient` class to interact with the Passwordless.dev API.


### Register Token

Register a new token using the `register_token` method:

```python
result = client.register_token(user_id="some-user-id", username="username@example.com", displayname="John Doe")
```

### Sign In Verification

Verify a sign-in token using the `signin_verify` method:

```python
result = client.signin_verify(token="your-token-here")
```

### Alias Management

Manage aliases using the `alias` method:

```python
result = client.alias(user_id="user-id", aliases=["alias1@example.com", "alias2@example.com"])
```

### Credentials Management

List and delete credentials using the `credentials_list` and `credentials_delete` methods:

```python
# List credentials
result = client.credentials_list(user_id="user-id")

# Delete credential
result = client.credentials_delete(credential_id="credential-id")
```

## Example Application

This section provides an example of how the `PasswordlessClient` class can be used in an application to interact with the Passwordless.dev API.

### 1. Import and Initialize the Client

First, ensure that the `passwordlessconfig.ini` file is created with the correct configurations as described in the Configuration section.

Then, import and initialize the client:

```python
from passwordless-38 import PasswordlessClient

client = PasswordlessClient()  # Reads from passwordlessconfig.ini
```

### 2. Register a New User

```python
user_id = "some-user-id"
username = "username@example.com"
displayname = "John Doe"

result = client.register_token(user_id, username, displayname)
print("Registration Result:", result)
```

### 3. Verify a Sign-In Token

```python
token = "your-token-here"
result = client.signin_verify(token)
print("Verification Result:", result)
```

### 4. Manage Aliases

```python
aliases = ["alias1@example.com", "alias2@example.com"]
result = client.alias(user_id, aliases)
print("Alias Management Result:", result)
```

### 5. List and Delete Credentials

```python
# List credentials
result = client.credentials_list(user_id)
print("Credentials List:", result)

# Delete a specific credential
credential_id = "credential-id"
result = client.credentials_delete(credential_id)
print("Credential Deletion Result:", result)
```

These examples demonstrate a typical workflow for interacting with the Passwordless.dev API. By using the `PasswordlessClient` class, you can easily integrate authentication and authorization features into your Python application.

## License

This project is licensed under the MIT License.

## Contributing

Please refer to the CONTRIBUTING.md file for details on contributing to this project.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "passwordless-38",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Bitwarden",
    "author_email": "hello@bitwarden.com",
    "download_url": "https://files.pythonhosted.org/packages/06/67/a0d810e917187d71b411146cca653497b475556390b2fe2c3440705b326b/passwordless-38-0.0.9.tar.gz",
    "platform": null,
    "description": "\r\n# Bitwarden Passwordless.dev Python 3.8 SDK Client\r\n\r\nA Python client library for interacting with the Bitwarden Passwordless.dev API.\r\n\r\n## Installation\r\n\r\n1. Install the package using pip:\r\n\r\n```bash\r\npip install passwordless-38\r\n```\r\n\r\n## Usage\r\n\r\n### Configuration\r\n\r\nYou can store the API configurations in a file named `passwordlessconfig.ini` for easier management and security.\r\n\r\n#### Creating a Configuration File\r\n\r\nCreate a file named `passwordlessconfig.ini` in the same directory as your script, with the following content:\r\n\r\n```ini\r\n[API]\r\nAPI_URL = https://v4.passwordless.dev\r\nAPI_SECRET = Your-API-Secret-Here\r\nAPI_KEY = Your-API-Key-Here\r\nVERIFY = True\r\n```\r\n\r\nReplace the values with your actual API secret and public API key.\r\n\r\nThe `PasswordlessClient` class will automatically read this file and use the specified configurations when making requests to the Passwordless.dev API.\r\n\r\n#### Reading the Configuration in Code\r\n\r\nUse the `configparser` module to read the configuration file and pass the keys to the `PasswordlessClient`:\r\n\r\n```python\r\nimport configparser\r\n\r\nconfig = configparser.ConfigParser()\r\nconfig.read('config.ini')\r\n\r\napi_secret = config['passwordless']['api_secret']\r\n# api_key can be accessed similarly if needed\r\n\r\n```\r\n### Importing the Client\r\n\r\nOnce the package is installed, you can import the `PasswordlessClient` class in your Python script or application:\r\n\r\n```python\r\nfrom passwordless-38 import PasswordlessClient\r\n```\r\n\r\n### Creating a Client Instance\r\n\r\nCreate an instance of the `PasswordlessClient` class, providing your API private secret:\r\n\r\n```python\r\nclient = PasswordlessClient(api_secret)\r\n```\r\n\r\n### Using the Client's Methods\r\n\r\nYou can now use the various methods provided by the `PasswordlessClient` class to interact with the Passwordless.dev API.\r\n\r\n\r\n### Register Token\r\n\r\nRegister a new token using the `register_token` method:\r\n\r\n```python\r\nresult = client.register_token(user_id=\"some-user-id\", username=\"username@example.com\", displayname=\"John Doe\")\r\n```\r\n\r\n### Sign In Verification\r\n\r\nVerify a sign-in token using the `signin_verify` method:\r\n\r\n```python\r\nresult = client.signin_verify(token=\"your-token-here\")\r\n```\r\n\r\n### Alias Management\r\n\r\nManage aliases using the `alias` method:\r\n\r\n```python\r\nresult = client.alias(user_id=\"user-id\", aliases=[\"alias1@example.com\", \"alias2@example.com\"])\r\n```\r\n\r\n### Credentials Management\r\n\r\nList and delete credentials using the `credentials_list` and `credentials_delete` methods:\r\n\r\n```python\r\n# List credentials\r\nresult = client.credentials_list(user_id=\"user-id\")\r\n\r\n# Delete credential\r\nresult = client.credentials_delete(credential_id=\"credential-id\")\r\n```\r\n\r\n## Example Application\r\n\r\nThis section provides an example of how the `PasswordlessClient` class can be used in an application to interact with the Passwordless.dev API.\r\n\r\n### 1. Import and Initialize the Client\r\n\r\nFirst, ensure that the `passwordlessconfig.ini` file is created with the correct configurations as described in the Configuration section.\r\n\r\nThen, import and initialize the client:\r\n\r\n```python\r\nfrom passwordless-38 import PasswordlessClient\r\n\r\nclient = PasswordlessClient()  # Reads from passwordlessconfig.ini\r\n```\r\n\r\n### 2. Register a New User\r\n\r\n```python\r\nuser_id = \"some-user-id\"\r\nusername = \"username@example.com\"\r\ndisplayname = \"John Doe\"\r\n\r\nresult = client.register_token(user_id, username, displayname)\r\nprint(\"Registration Result:\", result)\r\n```\r\n\r\n### 3. Verify a Sign-In Token\r\n\r\n```python\r\ntoken = \"your-token-here\"\r\nresult = client.signin_verify(token)\r\nprint(\"Verification Result:\", result)\r\n```\r\n\r\n### 4. Manage Aliases\r\n\r\n```python\r\naliases = [\"alias1@example.com\", \"alias2@example.com\"]\r\nresult = client.alias(user_id, aliases)\r\nprint(\"Alias Management Result:\", result)\r\n```\r\n\r\n### 5. List and Delete Credentials\r\n\r\n```python\r\n# List credentials\r\nresult = client.credentials_list(user_id)\r\nprint(\"Credentials List:\", result)\r\n\r\n# Delete a specific credential\r\ncredential_id = \"credential-id\"\r\nresult = client.credentials_delete(credential_id)\r\nprint(\"Credential Deletion Result:\", result)\r\n```\r\n\r\nThese examples demonstrate a typical workflow for interacting with the Passwordless.dev API. By using the `PasswordlessClient` class, you can easily integrate authentication and authorization features into your Python application.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License.\r\n\r\n## Contributing\r\n\r\nPlease refer to the CONTRIBUTING.md file for details on contributing to this project.\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A client library for Bitwardens Passwordless.dev API",
    "version": "0.0.9",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7bf0312e071d38528aed34c9fbe2ea94fb177add5fb214baf0d30c99161c3d95",
                "md5": "54f38edfe93c47aab888dc9e983e079b",
                "sha256": "1dfae7ba11a68a3414e75c78d6c6ffe6d8be529d0345f09783a2058fae766019"
            },
            "downloads": -1,
            "filename": "passwordless_38-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "54f38edfe93c47aab888dc9e983e079b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4123,
            "upload_time": "2023-08-30T05:41:08",
            "upload_time_iso_8601": "2023-08-30T05:41:08.421056Z",
            "url": "https://files.pythonhosted.org/packages/7b/f0/312e071d38528aed34c9fbe2ea94fb177add5fb214baf0d30c99161c3d95/passwordless_38-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0667a0d810e917187d71b411146cca653497b475556390b2fe2c3440705b326b",
                "md5": "60e307e9b149f63466124178f5b8ac01",
                "sha256": "781729276dcfdaf0ff9e87069f7d4239d89081e1be6893e05a1c7e8471138cc4"
            },
            "downloads": -1,
            "filename": "passwordless-38-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "60e307e9b149f63466124178f5b8ac01",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4150,
            "upload_time": "2023-08-30T05:41:10",
            "upload_time_iso_8601": "2023-08-30T05:41:10.092368Z",
            "url": "https://files.pythonhosted.org/packages/06/67/a0d810e917187d71b411146cca653497b475556390b2fe2c3440705b326b/passwordless-38-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-30 05:41:10",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "passwordless-38"
}
        
Elapsed time: 0.42376s