messaging_dart_sdk

所属分类:通讯编程
开发工具:Dart
文件大小:0KB
下载次数:0
上传日期:2023-09-26 20:54:21
上 传 者sh-1993
说明:  在Archethic公共区块链上管理去中心化的消息传递平台,
(Manage a decentralized messaging platform on the Archethic Public Blockchain,)

文件列表:
.tool-versions (11, 2023-11-20)
CHANGELOG.md (327, 2023-11-20)
CODE_OF_CONDUCT.md (5220, 2023-11-20)
CONTRIBUTING.md (8270, 2023-11-20)
LICENSE (34523, 2023-11-20)
analysis_options.yaml (7007, 2023-11-20)
lib/ (0, 2023-11-20)
lib/archethic_messaging_lib_dart.dart (599, 2023-11-20)
lib/src/ (0, 2023-11-20)
lib/src/model/ (0, 2023-11-20)
lib/src/model/address.freezed.dart (3845, 2023-11-20)
lib/src/model/authorized_key.freezed.dart (5698, 2023-11-20)
lib/src/model/authorized_key.g.dart (677, 2023-11-20)
lib/src/model/balance.freezed.dart (5396, 2023-11-20)
lib/src/model/balance.g.dart (694, 2023-11-20)
lib/src/model/cross_validation_stamp.freezed.dart (6206, 2023-11-20)
lib/src/model/cross_validation_stamp.g.dart (718, 2023-11-20)
lib/src/model/data.freezed.dart (8813, 2023-11-20)
lib/src/model/data.g.dart (1144, 2023-11-20)
lib/src/model/endpoint.freezed.dart (4838, 2023-11-20)
lib/src/model/endpoint.g.dart (566, 2023-11-20)
lib/src/model/error.freezed.dart (6255, 2023-11-20)
lib/src/model/error.g.dart (849, 2023-11-20)
lib/src/model/hosting_ref.freezed.dart (7673, 2023-11-20)
lib/src/model/hosting_ref.g.dart (1023, 2023-11-20)
lib/src/model/hosting_ref_content_metadata.freezed.dart (7668, 2023-11-20)
lib/src/model/hosting_ref_content_metadata.g.dart (970, 2023-11-20)
lib/src/model/keychain.freezed.dart (6383, 2023-11-20)
lib/src/model/keychain.g.dart (873, 2023-11-20)
lib/src/model/ledger.freezed.dart (5581, 2023-11-20)
lib/src/model/ledger.g.dart (718, 2023-11-20)
lib/src/model/ledger_operations.freezed.dart (8179, 2023-11-20)
lib/src/model/ledger_operations.g.dart (1073, 2023-11-20)
... ...

[![CI](https://github.com/archethic-foundation/messaging_dart_sdk/actions/workflows/ci.yaml/badge.svg)](https://github.com/archethic-foundation/messaging_dart_sdk/actions/workflows/ci.yaml) [![Pub](https://img.shields.io/pub/v/archethic_messaging_lib_dart.svg)](https://pub.dartlang.org/packages/archethic_messaging_lib_dart) [![Platform](https://img.shields.io/badge/Platform-Flutter-02569B?logo=flutter)](https://flutter.dev) # Archethic's Messaging Dart SDK Archethic Messaging SDK developped on Dart ## Usage This library aims to provide a easy way to manage a decentralized messaging platform on the Archethic Public Blockchain. With the help of a smart contract, you can manage discussions and associated messages. ## API All API are available in `messaging_service.dart` file. ### Installation To use the `MessagingService` class, you should include the `archethic_lib_dart` and `archethic_messaging_lib_dart` packages in your Dart project. Add the following dependencies to your `pubspec.yaml` file: ```yaml dependencies: archethic_lib_dart: ^ archethic_messaging_lib_dart: ^ ``` ### Initialization ```dart import 'package:archethic_lib_dart/archethic_lib_dart.dart' as archethic; import 'package:archethic_messaging_lib_dart/archethic_messaging_lib_dart'; void main() { // Initialize your keychain and API service as needed. archethic.Keychain keychain = ...; // Initialize your keychain archethic.ApiService apiService = ...; // Initialize your API service // Create an instance of MessagingService MessagingService messagingService = MessagingService( logsActivation: true, // Set to true to enable logging ); } ``` ### Discussion #### Create a New Discussion Creates a new discussion on the blockchain. ```dart Future<({ archethic.Transaction transaction, archethic.KeyPair previousKeyPair })> createDiscussion({ required archethic.Keychain keychain, required archethic.ApiService apiService, required List membersPubKey, required String discussionName, required List adminsPubKey, required String adminAddress, required String serviceName, }) ``` Parameters: - `keychain`: Keychain used to send transactions to the blockchain. - `apiService`: API service with blockchain integration. - `membersPubKey`: List of public keys of all discussion members. - `discussionName`: Name of the discussion. - `adminsPubKey`: List of public keys of all discussion administrators. - `adminAddress`: Address of the admin who wants to add members (provisions the SC's chain to manage fees). - `serviceName`: Service name in the current keychain (admin). - Returns a future with transaction and previous key pair information. #### Update an Existing Discussion Updates an existing discussion on the blockchain. ```dart Future<({ archethic.Transaction transaction, archethic.KeyPair previousKeyPair })> updateDiscussion({ required archethic.Keychain keychain, required archethic.ApiService apiService, required String discussionSCAddress, required List membersPubKey, required String discussionName, required List adminsPubKey, required String adminAddress, required String serviceName, required archethic.KeyPair adminKeyPair, bool updateSCAESKey = false, }) ``` Parameters: - `keychain`: Keychain used to send transactions to the blockchain. - `apiService`: API service with blockchain integration. - `membersPubKey`: List of public keys of all discussion members. - `discussionName`: Name of the discussion. - `adminsPubKey`: List of public keys of all discussion administrators. - `adminAddress`: Address of the admin who wants to add members (provisions the SC's chain to manage fees). - `serviceName`: Service name in the current keychain (admin). - Returns a future with transaction and previous key pair information. #### Update an Existing Discussion Updates an existing discussion on the blockchain. ```dart Future<({ archethic.Transaction transaction, archethic.KeyPair previousKeyPair })> updateDiscussion({ required archethic.Keychain keychain, required archethic.ApiService apiService, required String discussionSCAddress, required List membersPubKey, required String discussionName, required List adminsPubKey, required String adminAddress, required String serviceName, required archethic.KeyPair adminKeyPair, bool updateSCAESKey = false, }) ``` Parameters: - `keychain`: Keychain used to send transactions to the blockchain. - `apiService`: API service with blockchain integration. - `discussionSCAddress`: Smart contract's address for the discussion. - `membersPubKey`: List of public keys of all discussion members. - `discussionName`: Name of the discussion. - `adminsPubKey`: List of public keys of all discussion administrators. - `adminAddress`: Address of the admin who wants to add members (provisions the SC's chain to manage fees). - `serviceName`: Service name in the current keychain (admin). - `adminKeyPair`: Key pair of the admin. - `updateSCAESKey`: Update the AES key if set to true. - Returns a future with transaction and previous key pair information. #### Get a Discussion Retrieves a discussion from its address on the blockchain. ```dart Future getDiscussion({ required archethic.ApiService apiService, required String discussionSCAddress, required archethic.KeyPair keyPair, }) ``` Parameters: - `apiService`: API service with blockchain integration. - `discussionSCAddress`: Smart contract's address for the discussion. - `keyPair`: Key pair of the requester to check if the discussion's content can be decrypted. - Returns an AEDiscussion object or null if not found. #### Get the last properties of a discussion ```dart Future getDiscussionLastProperties({ required archethic.ApiService apiService, required String discussionSCAddress, required archethic.KeyPair readerKeyPair, }) ``` Parameters: - `apiService`: API service with blockchain integration. - `discussionSCAddress`: Smart contract's address for the discussion. - `readerKeyPair`: Key pair of the reader to check if the discussion's content can be decrypted. ### Messages #### Read Messages in Existing Discussion Reads messages in an existing discussion on the blockchain. ```dart Future> readMessages({ required archethic.ApiService apiService, required String discussionSCAddress, required archethic.KeyPair readerKeyPair, int limit = 0, int pagingOffset = 0, }) ``` Parameters: - `apiService`: API service with blockchain integration. - `discussionSCAddress`: Smart contract's address for the discussion. - `readerKeyPair`: Key pair of the reader. - `limit`: Limit the number of messages to retrieve (default is 0, which retrieves all). - `pagingOffset`: Offset for paging through messages. - Returns a list of AEMessage objects. #### Send Messages in Existing Discussion Sends a message in an existing discussion on the blockchain. ```dart Future<({ archethic.Address transactionAddress, archethic.KeyPair previousKeyPair })> sendMessage({ required archethic.Keychain keychain, required archethic.ApiService apiService, required String discussionSCAddress, required String messageContent, required String senderAddress, required String senderServiceName, required archethic.KeyPair senderKeyPair, }) ``` Parameters: - `keychain`: Keychain used to send transactions to the blockchain. - `apiService`: API service with blockchain integration. - `discussionSCAddress`: Smart contract's address for the discussion. - `messageContent`: Content of the message (not encrypted). - `senderAddress`: Address of the member who wants to send the message. - `senderServiceName`: Service name in the current keychain (sender). - `senderKeyPair`: Key pair of the sender. - Returns a future with transaction address and previous key pair information. #### Build a message ```dart Future<({ archethic.Transaction transaction, archethic.KeyPair previousKeyPair })> buildMessage({ required archethic.Keychain keychain, required archethic.ApiService apiService, required String discussionSCAddress, required String messageContent, required String senderAddress, required String senderServiceName, required archethic.KeyPair senderKeyPair, }) ``` Parameters: - `keychain`: Keychain used to send transactions to the blockchain. - `apiService`: API service with blockchain integration. - `discussionSCAddress`: Smart contract's address for the discussion. - `messageContent`: Content of the message (not encrypted). - `senderAddress`: Address of the member who wants to send the message. - `senderServiceName`: Service name in the current keychain (sender). - `senderKeyPair`: Key pair of the sender. - Returns a future with transaction address and previous key pair information. ## Running the tests ```bash dart test --exclude-tags noCI ```

近期下载者

相关文件


收藏者