# Affinidi Portal (Affinidi-hosted)

> Affinidi offers a fully managed, hosted Control Plane to discover and seucrely connect indidvulas, business and agents.

Release Note

Affinidi-hosted Affinidi Meeting Place - Control Plane API is in Beta Programme. To get access, simply join the [Beta Programme](https://www.affinidi.com/affinidi-messaging-beta).

You can deploy with customizable configurations and choose from predefined appliance sizes to match your workload (e.g., development, small, medium, large ) through Affinidi Portal.

To get started, log in to the [Affinidi Portal ](https://portal.affinidi.com/meetingplace) and follow these steps.

## 1. Create Control Plane configuration

- 
Log in to the Affinidi Portal and select the project where you want to set up the Control Plane. If you are new to the Affinidi Portal, it automatically creates a default project for you.

- 
Go to Affinidi Meeting Place in the left sidebar, then click Create configuration.

Create Meeting Place Configuration page

- Set the following details to create the instance.

| Field | Description |
| Name | The name for your Control Plane instance. If left blank, one will be autogenerated. |
| Description 
 [Optional] | A short note on the purpose of creating the control plane  instance |
| Appliance size | The size of the server to be created. Provide options such as Dev, Small, Medium, Large depending your workload requirements. You can’t update this field after creating the configuration. |

Review your settings for the Control Plane configuration and click on Create. Deployment typically takes 2-5 minutes.

Once deployment is complete, Affinidi Portal displays the following details required to integrate with the Affinidi Meeting Place.

| Field | Description |
| Control Plane DID | The Decentralised Identifier (DID) assigned to the control plane to enable discovery and creation of secure channels. You can use this to connect to the control plane via Meeting Place SDK. |
| Control Plane URL | The endpoint containing information about the Control Plane API Server. You can use this URL to connect to the Control Plane API server via REST API. |

When the Deployment Status on the config page of the Affinidi Portal shows Complete, open your Control Plane URL in a browser.

You should see a confirmation page indicating your instance is active.

Control Plane API Server

## 2. Test Control Plane connection

You have two options to test the Control Plane server you just created.

### 2.1 Using Affinidi Control Plane SDK for Dart

To test using the Control Plane SDK, follow the steps below.

You also need to setup a DIDComm Mediator to proceed with the testing via Control Plane SDK.

#### 2.1.1. Set up environment

- 
Install [Dart SDK](https://dart.dev/get-dart) version ^3.6.0 on your machine.

- 
Create a dart project repository by running the command below.

```bash
dart create my_project_name
```

- Add the Control Plane SDK and SSI dart packages.

```bash
dart pub add meeting_place_control_plane
dart pub add ssi
```

#### 2.1.2. Create a Dart script

- Create a controlPlane.dart file with the following code.

```dart
import 'package:meeting_place_control_plane/meeting_place_control_plane.dart';
import 'package:ssi/ssi.dart';

void main() async {
  // Create a persistent wallet
  final wallet = PersistentWallet(InMemoryKeyStore());

  // Create a DIDManager
  final didManager = DidKeyManager(
    wallet: wallet,
    store: InMemoryDidStore(),
  );

  await didManager.addVerificationMethod(
    (await wallet.generateKey()).id,
  );

  // Set your Control Plane DID 
  final controlPlaneDid = '';

  // Set your Mediator DID 
  final mediatorDid = '';

  // Create an instance of ControlPlaneSDK
  final sdk = ControlPlaneSDK(
    didManager: didManager,
    controlPlaneDid: controlPlaneDid,
    mediatorDid: mediatorDid,
    didResolver: UniversalDIDResolver(),
  );

  // Create an authenticate command
  final command = AuthenticateCommand(controlPlaneDid: controlPlaneDid);

  // Test using the Authenticate Command
  final result = await sdk.execute(command);
  // Display the Command Result
  print("Generated Access Token: ${result.credentials.accessToken}");
}
```

- Replace the controlPlaneDid variable with the Control Plane DID generated from the Affinidi Portal.

You also need to set the Mediator DID variable.

```dart
final controlPlaneDid = 'did:web::mpx.affinidi.io';
final mediatorDid = 'did:web:.atlas.affinidi.io:.well-known';
```

#### 2.1.3. Run the Test Script

After setting up all the necessary codes and parameters, run the Dart script.

```bash
dart run controlPlane.dart
```

After running the script, the logs should display the access token generated after executing the Authentication Command.

### 2.2. Using REST API

To test the Control Plane using REST API, run the command below in your terminal:

Replace the <REPLACE_CONTROLPLANE_URL> with the generated Control Plane URL.

```bash
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"did": "did:peer:"}' \
  /v1/authenticate/challenge
```

Running the command should return result like below:

```bash
{"challenge":""}
```

This means that the API Server is able to respond via REST API.

For more details about how you can use REST API, you may refer to the Control Plane OSS [repository](https://github.com/affinidi/affinidi-meetingplace-controlplane-api-dart).

## What’s next

  [Integrate Affinidi Meeting Place into your applications](/products/affinidi-elements/affinidi-messaging/integration-guides/meeting-place.md)

  [Configure DIDComm Mediator to send messages](/products/affinidi-elements/affinidi-messaging/didcomm-mediator/deployment-options.md)
