Core
Install Dependency
Package: meeting_place_core
dart pub add meeting_place_coreYou can check the latest version of this module on the pub.dev or view the source code at the GitHub repository.
Classes and Methods
MeetingPlaceCoreSDK
The MeetingPlaceCoreSDK is the main orchestrator for the Affinidi Meeting Place ecosystem, providing a high-level interface for connection setup, discovery, and secure decentralised communications through control plane and mediator services.
create
A static method that creates an instance of CoreSDK. For each connection, it requires the creations of an instance of CoreSDK.
Parameters
Wallet [Object]
A digital wallet to manage cryptographic keys supporting different algorithms for signing and verifying VC and VP.
This requires the installation of SSI package from pub.dev.
RepositoryConfig [Object]
A repository object which defines the storage, group, key and channel repository objects.
mediatorDid [string]
The mediator DID which includes the well-known path. (e.g. <YOUR-MEDIATOR-DID>:.well-known)
controlPlaneDid [string]
The control plane DID.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final wallet = Bip32Wallet.fromSeed(aliceSeed);
final storage = InMemoryStorage();
final mediatorDid = '<YOUR-MEDIATOR-DID>:.well-known';
final controlPlaneDid = '<YOUR-CONTROL-PLANE-DID>';
final sdk = MeetingPlaceCoreSDK.create(
wallet: wallet,
repositoryConfig: RepositoryConfig(
connectionOfferRepository: ConnectionOfferRepositoryImpl(storage: storage),
groupRepository: GroupRepositoryImpl(storage: storage),
channelRepository: ChannelRepositoryImpl(storage: storage),
keyRepository: KeyRepositoryImpl(storage: storage),
),
mediatorDid: mediatorDid,
controlPlaneDid: controlPlaneDid,
);generateDid
An instance method that generates a new DID using the provided [Wallet] instance.
Parameters
No Parameters Required
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';final sdk = await MeetingPlaceCoreSDK.create(
wallet: wallet,
...
);
final did = await sdk.generateDid();createOobFlow
An instance method that creates an Out-Of-Band invitation for an entity.
Parameters
vCard [Object]
An object that contains information about who is offering the offer. This helps others know whom they are connecting with and provides necessary contact details.
onDone [Function(Channel)]
A function that accepts a Channel [Object] which is created in the createOobFlow.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';final aliceSDK = await MeetingPlaceCoreSDK.create(
wallet: wallet,
...
);
final createOobFlowResult = await aliceSDK.createOobFlow(
vCard: VCardFixture.alicePrimaryVCard,
onDone: (receivedChannel) {
aliceChannel = receivedChannel;
aliceOnDoneCompleter.complete();
},
);acceptOobFlow
An instance method that accepts an Out-Of-Band invitation created by an entity. This is typically used by the party receiving the invitation to establish a connection.
Parameters
vCard [Object]
An object that contains information about who is offering the offer. This helps others know whom they are connecting with and provides necessary contact details.
onDone [Function(Channel)]
A function that accepts a Channel [Object] which is created in the createOobFlow.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final bobSDK = await MeetingPlaceCoreSDK.create(
...
);
final createOobFlowResult = await aliceSDK.createOobFlow(
vCard: VCardFixture.alicePrimaryVCard,
onDone: (receivedChannel) {
aliceChannel = receivedChannel;
aliceOnDoneCompleter.complete();
},
);
await bobSDK.acceptOobFlow(
createOobFlowResult.oobUrl,
vCard: VCardFixture.bobPrimaryVCard,
onDone: (receivedChannel) {
bobChannel = receivedChannel;
bobOnDoneCompleter.complete();
},
);validateOfferPhrase
An instance method that validates whether a given offer phrase is already in use within the system. This returns a response with an isAvailable flag that shows whether the offer phrase is available or already in use.
Parameters
phrase [string]
The offer phrase to be checked for availability.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final offerPhraseResult = aliceSDK.validateOfferPhrase('<OFFER-ID>');registerForPushNotifications
An instance method that registers the device for push notifications using the provided deviceToken from the OS-native push notification service, which will be used to notify the device about events in the Meeting Place flow and automatically included in subsequent API calls.
Parameters
deviceToken [string]
The device token obtained from the operating system’s native push notification service.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final deviceInstance = aliceSDK.registerForPushNotifications('<DEVICE-TOKEN>');registerForDIDCommNotifications
An instance method that registers the device for push notifications using the provided deviceToken from the OS-native push notification service, which will be used to notify the device about events in the Meeting Place flow and automatically included in subsequent API calls.
Parameters
No Parameters Required
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final registerForDidcommNotificationsResult = aliceSDK.registerForDIDCommNotifications();publishOffer
An instance method that publishes an offer on MeetingPlace. This method allows a user to create and share an offer that others can discover and connect with.
Parameters
offerName [string]
The name of your offer as it will be displayed when others search for offers.
vCard [Object]
An object that contains information about who is offering the offer. This helps others know whom they are connecting with and provides necessary contact details.
publishAsGroup [boolean]
JSON object to provide details for the wallet to create. See more here.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final publishOfferResult = await aliceSDK.publishOffer(
offerName: 'SDK Offer',
vCard: VCard(values: {
'n': {'given': 'Alice'}
}),
publishAsGroup: false, // false for personal offer, true for group offer
);findOffer
An instance method that finds an offer published by another party using a unique mnemonic identifier.
Parameters
mnemonic [string]
The unique mnemonic identifier used to search for the offer.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';final bobSDK = await MeetingPlaceCoreSDK.create(
...
);
final menmonic = '<ALICE-OFFER>';
final offerResult = await bobSDK.findOffer(mnemonic);acceptOffer
An instance method that accepts a connection offer published by another party. This method allows a user to respond to an offer and establish a connection request.
Parameters
connectionOffer [Object]
A connection offer object.
vCard [Object]
An object that contains information about who is offering the offer. This helps others know whom they are connecting with and provides necessary contact details.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';final bobSDK = await MeetingPlaceCoreSDK.create(
...
);
final menmonic = '<ALICE-OFFER>';
final offerResult = await bobSDK.findOffer(mnemonic);
final offerAcceptedResult = await bobSDK.acceptOffer(
connectionOffer: offerResult.connectionOffer!,
vCard: VCard(values: {
'n': {'given': 'Bob'}
}),
);notifyAcceptance
An instance method that notifies the owner of the offer about the acceptance of their connection offer.
Parameters
connectionOffer [Object]
ConnectionOffer object in the ‘accepted’ state.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';final bobSDK = await MeetingPlaceCoreSDK.create(
...
);
final menmonic = '<ALICE-OFFER>';
final offerResult = await bobSDK.findOffer(mnemonic);
final offerAcceptedResult = await bobSDK.acceptOffer(
connectionOffer: offerResult.connectionOffer!,
vCard: VCard(values: {
'n': {'given': 'Bob'}
}),
);
await bobSDK.notifyAcceptance(
connectionOffer: offerAcceptedResult.connectionOffer,
);approveConnectionRequest
An instance method to allow the owner of the offer to approve connection request.
Parameters
connectionOffer [Object]
[GroupConnectionOffer] object for group.
channel [Object]
Channel object.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
aliceSDK.discoveryEventsStream.listen((event) async {
if (event.type.name == DiscoveryEventType.InvitationAccept.name) {
await aliceSDK.approveConnectionRequest(
connectionOffer: publishOfferResult.connectionOffer,
channel: event.channel,
);
}
});rejectConnectionRequest
An instance method to allow the owner of the offer to reject connection request.
Parameters
channel [Object]
Channel object.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final channel = await aliceSDK.getChannelByDid(
message.data['memberDid'] as String,
);
if (channel == null) {
throw Exception('Channel does not exist');
}
await aliceSDK.rejectConnectionRequest(channel);leaveChannel
An instance method that allows a member to leave a channel. Depending on type of channel, it applies business logic to groups or individual channels.
Parameters
groupId [string]
The Group’ ID.
memberDid [string]
The member’s DID.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final groupId = "<GROUP-ID>";
final memberDid = "did:peer:.....";
await aliceSDK.leaveGroup(groupId, memberDid);sendMessage
An instance method that encrypts and signs the message using the sender’ s DID, then sends it to recipientDidDocument via DIDComm.
Parameters
message [object]
The DIDComm plain text message.
senderDid [string]
The DID used to send messages.
recipientDid [string]
The DID of recipient.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final bobSDK = await MeetingPlaceCoreSDK.create(
...
);
bobSDK.sendMessage(
message,
senderDid: senderDid,
recipientDid: recipientDid,
);queueMessage
An instance method that queues the message to be sent via DIDComm.
Parameters
message [object]
The DIDComm plain text message.
senderDid [string]
The DID used to send messages.
recipientDid [string]
The DID of recipient.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final bobSDK = await MeetingPlaceCoreSDK.create(
...
);
await bobSDK.queueMessage(
message,
senderDid: senderDid,
recipientDid: recipientDid,
);sendGroupMessage
An instance method that encrypts and signs the message using the sender’ s DID, then sends it to a group message using a group’s DID as the recipient via DIDComm.
Parameters
message [object]
The DIDComm plain text message.
senderDid [string]
The DID used to send messages.
recipientDid [string]
The DID of recipient.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final bobSDK = await MeetingPlaceCoreSDK.create(
...
);
await bobSDK.sendGroupMessage(
message,
senderDid: senderDid,
recipientDid: recipientDid,
);sendOutreachInvitation
Sends a targeted invitation to participants of an existing connection offer, inviting them to join a different offer.
Parameters
outreachConnectionOffer [ConnectionOffer]
The outreach connection offer used to send the invitation.
ConnectionOffer [ConnectionOffer]
The connection offer to which the invitee is being invited to connect.
messageToInclude [string]
A custom message to include in the invitation.
senderInfo [string]
Information about the sender to be included in the invitation.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final bobSDK = await MeetingPlaceCoreSDK.create(
...
);
final ConnectionOffer outreachOffer = /* existing offer with participants */;
final ConnectionOffer inviteToOffer = /* new offer you want to promote */;
await bobSDK.sendOutreachInvitation(
outreachConnectionOffer: outreachOffer,
inviteToConnectionOffer: inviteToOffer,
messageToInclude: 'Hi! Connect with me on this new offer.',
senderInfo: 'John',
;processControlPlaneEvents
An instance method that fetches latest updates (notifications) from Control Plane API and handles each update event. This may need some time to happen. Therefore the function returns a stream that is going to receive a connection offer for each processed update event.
Parameters
No Parameters Required
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
// Listen to control plane events stream
aliceSDK.controlPlaneEventsStream.listen((event) {
print('Event type: ${event.type}');
if (event.channel != null) {
print('Channel ID: ${event.channel!.id}');
print('Channel status: ${event.channel!.status}');
}
});
// Process pending control plane events
await aliceSDK.processControlPlaneEvents(
onDone: () {
print('All control plane events processed successfully');
},
);disposeDiscoveryEventsStream
An instance method that closes active discovery events stream.
Parameters
No Parameters Required
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
await aliceSDK.disposeDiscoveryEventsStream();deleteDiscoveryEvents
An instance method that deletes all pending discovery events.
Parameters
No Parameters Required
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
await aliceSDK.deleteDiscoveryEvents();fetchMessages
An instance method that retrieves available messages from the specified mediator instance mediatorDid. By setting deleteOnRetrieve to true, retrieved messages can be automatically deleted. The method takes care of checking message signatures and decrypts the messages if necessary.
Parameters
did [string]
DID used to fetch messages from mediator.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
await aliceSDK.fetchMessages('did:peer:.....');subscribeToMediator
An instance method that allows the MeetingPlaceCoreSDK intance to subscribes to incoming messages from the mediator.
Parameters
did [string]
DID used to fetch messages from mediator.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
await aliceSDK.subscribeToMediator('did:peer:.....');getConnectionOffer
An instance method that returns connection offer identified by offerLink from storage.
Parameters
offerLink [string]
The ID of the offer.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final offerLink = "<OFFER-LINK>";
await aliceSDK.getConnectionOffer(offerLink);markConnectionOfferAsDeleted
An instance method that marks connection offer as deleted - updates connection offer status to deleted. If connection offer is already marked as deleted, delete operation is going to be skipped.
Parameters
connectionOffer [object]
The ConnectionOffer instance.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final connectionOfferToBeDeleted = "<CONNECTION-OFFER>";
await aliceSDK.markConnectionOfferAsDeleted(connectionOfferToBeDeleted);deleteConnectionOffer
An instance method that deletes connection offer from storage.
Parameters
connectionOffer [object]
The ConnectionOffer instance.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final connectionOfferToBeDeleted = "<CONNECTION-OFFER>";
await aliceSDK.deleteConnectionOffer(connectionOfferToBeDeleted);getGroupByOfferLink
An instance method that returns group identified by offerLink from storage.
Parameters
connectionOffer [object]
The ConnectionOffer instance.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final offerLink = "<OFFER-LINK>";
await aliceSDK.getGroupByOfferLink(offerLink);getGroupById
An instance method that returns group identified by groupId from storage.
Parameters
groupId [string]
The groupID.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final groupId = "<GROUP-ID>";
await aliceSDK.getGroupById(groupId);updateGroup
An instance method that updates an existing group in the repository by using repository method updateGroup.
Parameters
group [object]
Specifies the channel entity to update.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final group = Group(
id: '<GROUP-ID>',
did: 'did:peer:...',
offerLink: '<OFFER-LINK>',
members: ['alice', 'bob'],
created: DateTime.now()
);
await aliceSDK.updateGroup(group);listConnectionOffers
An instance method that returns a list of all connection offers from repository by using repository method listConnectionOffers.
Parameters
No Parameters Required
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
await aliceSDK.listConnectionOffers();getChannelByDid
An instance method that fetches a channel entity from the repository by using repository method getChannelByDid method.
Parameters
did [string]
The DID to match the channel either by permanentChannelDid or otherPartyPermanentChannelDid.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
await aliceSDK.getChannelByDid('did:peer:...');getChannelByOtherPartyPermanentDid
An instance method that fetches a channel entity from the repository by using repository method findChannelByOtherPartyPermanentChannelDid method.
Parameters
did [string]
The DID to match the channel either by permanentChannelDid or otherPartyPermanentChannelDid.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
await aliceSDK.getChannelByOtherPartyPermanentDid('did:peer:...');updateChannel
An instance method that updates an existing channel in the repository.
Parameters
channel [object]
Specifies the channel entity to update.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final channel = new Channel({
...
});
await aliceSDK.updateChannel(channel);getMediatorDidFromUrl
An instance method that fetches the mediator DID from the provided URL.
Parameters
mediatorEndpoint [string]
The mediator endpoint which returns the DID document of the mediator.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage/in_memory_storage.dart';
final aliceSDK = await MeetingPlaceCoreSDK.create(
...
);
final mediatorEndpoint = "https://example.com/.well-known/did.json";
await aliceSDK.getMediatorDidFromUrl('<MEDIATOR-URL>');Glad to hear it! Please tell us how we can improve more.
Sorry to hear that. Please tell us how we can improve.
Thank you for sharing your feedback so we can improve your experience.