flutter_gundb
다수의 사용자 간 P2P 암호화 통신을 위한 gunDB 포트.
이 라이브러리는 Dart와 Flutter용 GunDB js의 포트입니다. 여러 사용자 간의 P2P 암호화 통신을 가능하게 합니다. GUN은 커뮤니티가 운영하고 암호화된 애플리케이션을 구축할 수 있도록 해주는 도구 생태계로, 오픈소스 Firebase 또는 탈중앙형 Dropbox와 유사합니다.
^3.0.6^3.0.0^2.2.0^0.5.3^3.1.1^2.2.3^1.1.0^8.0.0{"sdk":"flutter"}{"sdk":"flutter"}^2.0.0아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
This library is a port of GunDB js for the Dart and Flutter. P2P encrypted Communication between multiple users. GUN is an ecosystem of tools that let you build community run and encrypted applications - like an Open Source Firebase or a Decentralized Dropbox.
Note: Some APIs like certify and user, not implemented completely (Trying to do so ;) )
Demo Gif
Decentralized alternatives to Zoom, Reddit, Instagram, Slack, YouTube, Stripe, Wikipedia, Facebook Horizon and more have already pushed terabytes of daily P2P traffic on GUN.
Add library to your app.
flutter pub add flutter_gundb
or
.....
dependencies:
flutter_gundb: ^0.0.3
....
Short example is below. Added longer examples to /example folder.
import 'package:flutter_gundb/flutter_gundb.dart';
void main() {
final chainGunClient = FlutterGunSeaClient();
final getAditya = gun.get('aditya');
getAditya.put({
name: "Aditya Kumar Pandey",
email: "janatig@janatig.com",
});
getAditya.on((a, [b, c]) {
print('Getting Value:: $a');
});
}
Example on how to store the data locally.
import 'package:flutter_gundb/flutter_gundb.dart';
void main() async {
await initializeFlutterGun();
final chainGunClient = FlutterGunSeaClient(registerStorage: true);
final localFirstStorage = gun.get('local-first-storage');
localFirstStorage.put({
name: "Testing the Local First",
anime_website: "animeloved.com",
});
localFirstStorage.on((a, [b, c]) {
print('Getting Value:: $a');
});
}
Example How to send other user encrypted data
import 'package:flutter_gundb/flutter_gundb.dart';
void main() {
() async {
var aditya = await pair();
var pandey = await pair();
// On Aditya
var shared = await secret(pandey.epub, aditya);
var shared_enc = await encrypt('<Your Shared Data>', shared);
// Now Share `shared_enc` to your friend pandey (Send shared_enc and aditya's public key)
// On Pandey Side
var decryptKey = await secret(aditya.epub, pandey);
var decryptedData = await decrypt(shared_enc, decryptKey);
// `decryptedData` This is your Decrypted Data
} ();
}
Some APIs like certify and user. If anyone wants to help, kindly send a PR. I would appreciate it. Thank you in advance :)