shamir_secret_plg 0.6.0 copy "shamir_secret_plg: ^0.6.0" to clipboard
shamir_secret_plg: ^0.6.0 copied to clipboard

Shamir's Secret Sharing plugin for Flutter and Dart, threshold-based recovery, and cross-platform compatibility including web, mobile, and desktop.

secretsplit #

pub package            Buy Me a Coffee

A Flutter plugin for Shamir's Secret Sharing, supporting encryption, share splitting, and cross-platform recovery — including support for Web, Android, iOS, Windows, macOS, and Linux.

🔧 Features #

  • Split secrets into N shares with a threshold
  • Combine shares to recover the original secret
  • Pure Dart or native-backed implementation (via FFI)
  • Works on all Flutter-supported platforms

🚀 Getting Started #

Add to your pubspec.yaml:

dependencies:
  secretsplit: ^0.1.0

Example #

import 'dart:convert';
import 'dart:typed_data';

import 'package:shamir_secret_plg/shamir_secret_plg.dart';

String _hex(Uint8List o) {
  return o.map((b) => b.toRadixString(16).padLeft(2, '0')).join();
}

void main(List<String> arguments) async {
  String secret = "You will never find what I have hidden";
  IShamir shamir = ShamirClaude01();
  
  List<Uint8List>? shares = shamir.split(
      Uint8List.fromList(utf8.encode(secret)),
      totalShares: 5,
      threshold: 3);

  if (shares == null) {
    print("something gone wrong, you can try  to split again.");
  } else {
    for (int i = 0; i < shares.length; i++) {
      print("Share ${i + 1}: ${_hex(shares[i])}");
    }

    print("5 shares have been created, you need only 3 to reconstruct the secret. Let's take 1, 3, qnd 5");

    final selectedShares = [0, 2, 4].map((i) => shares[i]).toList();
    final bReconstructed = shamir.combine(selectedShares);
    final reconstructed = utf8.decode(bReconstructed);
    print("The secret was: $reconstructed");
  }

}
0
likes
130
points
45
downloads

Publisher

unverified uploader

Weekly Downloads

Shamir's Secret Sharing plugin for Flutter and Dart, threshold-based recovery, and cross-platform compatibility including web, mobile, and desktop.

Homepage
Repository (GitHub)

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface, web

More

Packages that depend on shamir_secret_plg