0 purchases
sss256
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
copied to clipboard
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');
}
copied to clipboard
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');
}
copied to clipboard
Run Unit Test #
flutter test
copied to clipboard
License #
This code is under the Apache License v2.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.