Skip to content

Commit

Permalink
add network packages
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkahan committed Jun 12, 2024
1 parent f220715 commit 8ef8ece
Show file tree
Hide file tree
Showing 51 changed files with 273 additions and 589 deletions.
3 changes: 2 additions & 1 deletion application/tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import responses
from pytest import raises
from testutils import build_response, get_mock_api_key_auth
from vonage_application.application import Application
from vonage_application.common import (
ApplicationUrl,
Expand All @@ -25,6 +24,8 @@
from vonage_application.requests import ApplicationConfig, ListApplicationsFilter
from vonage_http_client.http_client import HttpClient

from testutils import build_response, get_mock_api_key_auth

path = abspath(__file__)

application = Application(HttpClient(get_mock_api_key_auth()))
Expand Down
34 changes: 0 additions & 34 deletions camara_auth/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions camara_auth/src/vonage_camara_auth/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion camara_auth/tests/BUILD

This file was deleted.

86 changes: 0 additions & 86 deletions camara_auth/tests/test_camara_auth.py

This file was deleted.

34 changes: 0 additions & 34 deletions gnp_sim_swap/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions gnp_sim_swap/src/vonage_gnp_sim_swap/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion gnp_sim_swap/tests/BUILD

This file was deleted.

86 changes: 0 additions & 86 deletions gnp_sim_swap/tests/_test_camara_auth.py

This file was deleted.

4 changes: 2 additions & 2 deletions camara_auth/BUILD → network_auth/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ file(name='readme', source='README.md')
files(sources=['tests/data/*'])

python_distribution(
name='vonage-camara-auth',
name='vonage-network-auth',
dependencies=[
':pyproject',
':readme',
'camara_auth/src/vonage_camara_auth',
'network_auth/src/vonage_network_auth',
],
provides=python_artifact(),
generate_setup=False,
Expand Down
File renamed without changes.
34 changes: 34 additions & 0 deletions network_auth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Vonage Network API Authentication Client

This package (`vonage-network-auth`) provides a client for authenticating Network APIs that require Oauth2 authentcation. Using it, it is possible to generate authenticated JWTs for use with GNP APIs, e.g. Sim Swap, Number Verification.

This package is intended to be used as part of an SDK, accessing required methods through the SDK instead of directly. Thus, it doesn't require manual installation or configuration unless you're using this package independently of an SDK.

For full API documentation, refer to the [Vonage developer documentation](https://developer.vonage.com).

## Installation

Install from the Python Package Index with pip:

```bash
pip install vonage-network-auth
```

## Usage

### Create a `NetworkAuth` Object

```python
from vonage_network_auth import NetworkAuth
from vonage_http_client import HttpClient, Auth

network_auth = NetworkAuth(HttpClient(Auth(application_id='application-id', private_key='private-key')))
```

### Generate an Authenticated Access Token

```python
token = camara_auth.get_oauth2_user_token(
number='447700900000', scope='dpv:FraudPreventionAndDetection#check-sim-swap'
)
```
4 changes: 2 additions & 2 deletions camara_auth/pyproject.toml → network_auth/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "vonage-camara-auth"
name = "vonage-network-auth"
version = "1.0.0"
description = "Package for working with Camara APIs that require Oauth2 in Python."
description = "Package for working with Network APIs that require Oauth2 in Python."
readme = "README.md"
authors = [{ name = "Vonage", email = "devrel@vonage.com" }]
requires-python = ">=3.8"
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions network_auth/src/vonage_network_auth/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .network_auth import NetworkAuth
from .responses import OidcResponse, TokenResponse

__all__ = ['NetworkAuth', 'OidcResponse', 'TokenResponse']
Loading

0 comments on commit 8ef8ece

Please sign in to comment.