For secret-sharing schemes which need support for threshold recombination there's cryptomancy-secret. If your needs are incredibly simple, this module may provide a simpler option.
Its goal is to be:
- threshold support
- padding bytes
// the API takes and outputs Uint8Arrays// so you'll probably want to convert between that and different formatsvar Format = ;// it expects you to supply your own randomness// so it can be deterministic if that suits your needs// otherwise use a cryptographically secure source of random bytesvar Source = ;var secure_bytes = Sourcebytes;var plaintext = "PEW PEW PEW";var u8_message = Format;// load the libraryvar Shard = ;// split the plaintext up into 5 shards// all of which are necessary to reproduce the original valuevar shards = Shard;// print out your shards in whatever format you like// I like base64 because they're probably not valid UTF8// and I don't like hexconsole;// join the shards// order doesn't matter because internally it's just xor'ing the valuesvar recovered = Format;console;