sss256 1.0.0 copy "sss256: ^1.0.0" to clipboard
sss256: ^1.0.0 copied to clipboard

sss256 is a library with utilities for encode\decode secret with Shamir`s Secret Sharing algo

sss256 #

sss256 is a library with utilities for encode\decode secret with Shamir`s Secret Sharing algo

Use this package as a library #

Add this to your package's pubspec.yaml file:

dependencies:
  sss256: ^1.0.0

1. An implementation of Shamir's Secret Sharing Algorithm 256-bits in Dart #

Usage #

Use encode/decode Base64Url

import 'package:sss256';

main() {
  const secret = 'Very secret "foo bar"';

  print('Secret before encoding: $secret');
  final shares = splitSecret(
    secret: secret,
    treshold: 3,
    shares: 6,
  );

  print('Secret splited shares:');
  print(shares);
  final restoredSecret = restoreSecret(shares: shares.sublist(0, 3));
  print('\nRestored secret: $restoredSecret');
}

Use encode/decode Hex

import 'package:sss256';

main() {
  const secret = 'Very secret "foo bar"';

  print('Secret before encoding: $secret');
  final shares = splitSecret(
    isBase64: false,
    secret: secret,
    treshold: 3,
    shares: 6,

  );

  print('Secret splited shares:');
  print(shares);
  final restoredSecret = restoreSecret(shares: shares.sublist(0, 3), isBase64: false);
  print('\nRestored secret: $restoredSecret');
}

Run Unit Test #

flutter test

License #

This code is under the Apache License v2.

3
likes
150
points
177
downloads

Publisher

unverified uploader

Weekly Downloads

sss256 is a library with utilities for encode\decode secret with Shamir`s Secret Sharing algo

Repository (GitHub)

Documentation

API reference

License

Apache-2.0 (license)

More

Packages that depend on sss256