<commit_before>miniLockLib = module.exports = {}

miniLockLib.Keys             = require "./Keys"
miniLockLib.ID               = require "./ID"
miniLockLib.EncryptOperation = require("./EncryptOperation")
miniLockLib.DecryptOperation = require("./DecryptOperation")




# ------------------
# Make a set of Keys
# ------------------
#
# Call `miniLockLib.makeKeyPair` to generate a set of keys from a secret phrase
# and email address. Your `callback` receives a pair of `keys` like this:
#
#   miniLockLib.makeKeyPair secretPhrase, emailAddress, (error, keys) ->
#    if keys
#      keys.publicKey is a Uint8Array
#      keys.secretKey is a Uint8Array
#      error is undefined
#    else
#      error is a String explaining the failure
#      keys is undefined
#
# `miniLockLib.makeKeyPair` is defined in Keys.coffee. Refer to that file for
# details about unacceptable secret phrases, unacceptable email addresses and
# other failure conditions.

miniLockLib.makeKeyPair = miniLockLib.Keys.makeKeyPair




# --------------
# Encrypt a File
# --------------
#
#     miniLockLib.encrypt
#       data: File or Blob,
#       name: "alice_and_bobby.txt"
#       keys: {publicKey: Uint8Array, secretKey: Uint8Array}
#       miniLockIDs: [Alice.miniLockID, Bobby.miniLockID]
#       callback: (error, encrypted) ->
#         if encrypted
#           encrypted.name is "alice_and_bobby.txt.minilock"
#           encrypted.data is a Blob
#           encrypted.data.size is Number
#           encrypted.senderID is Alice.miniLockID
#           error is undefined
#         else
#           error is a String explaing the failure
#           encrypted is undefined
#
# A `miniLockLib.EncryptOperation` is constructed when you call `encrypt`. Refer
# to EncryptOperation.coffee to see how it works.

miniLockLib.encrypt = (params) ->
  {data, name, miniLockIDs, keys, callback} = params
  new miniLockLib.EncryptOperation
    data: data
    name: name
    keys: keys
    miniLockIDs: miniLockIDs
    saveName: name+".minilock"
    callback: callback
    start: yes




# --------------
# Decrypt a File
# --------------
#
#     miniLockLib.decrypt
#       data: File or Blob,
#       keys: {publicKey: Uint8Array, secretKey: Uint8Array}
#       callback: (error, decrypted) ->
#         if decrypted
#           decrypted.name is "alice_and_bobby.txt"
#           decrypted.data.constructor is Blob
#           decrypted.data.size.constructor is Number
#           decrypted.senderID is Alice.miniLockID
#           error is undefined
#         else
#           error is a String explaing the failure
#           encrypted is undefined
#
# A `miniLockLib.DecryptOperation` is constructed when you call `encrypt`. Refer
# to DecryptOperation.coffee to see how it works.

miniLockLib.decrypt = (params) ->
  {data, keys, callback} = params
  new miniLockLib.DecryptOperation
    data: data
    keys: keys
    callback: callback<commit_msg>Comments.<commit_after>miniLockLib = module.exports = {}

miniLockLib.Keys             = require "./Keys"
miniLockLib.ID               = require "./ID"
miniLockLib.EncryptOperation = require("./EncryptOperation")
miniLockLib.DecryptOperation = require("./DecryptOperation")




# ------------------
# Make a set of Keys
# ------------------
#
# Call `miniLockLib.makeKeyPair` to generate a set of keys from a secret phrase
# and email address. Your `callback` receives a pair of `keys` like this:
#
#   miniLockLib.makeKeyPair secretPhrase, emailAddress, (error, keys) ->
#    if keys
#      keys.publicKey is a Uint8Array
#      keys.secretKey is a Uint8Array
#      error is undefined
#    else
#      error is a String explaining the failure
#      keys is undefined
#
# `miniLockLib.makeKeyPair` is defined in Keys.coffee. Refer to that file for
# details about unacceptable secret phrases, unacceptable email addresses and
# other failure conditions.

miniLockLib.makeKeyPair = miniLockLib.Keys.makeKeyPair




# --------------
# Encrypt a File
# --------------
#
#     miniLockLib.encrypt
#       data: File or Blob,
#       name: "alice_and_bobby.txt"
#       keys: {publicKey: Uint8Array, secretKey: Uint8Array}
#       miniLockIDs: [Alice.miniLockID, Bobby.miniLockID]
#       callback: (error, encrypted) ->
#         if encrypted
#           encrypted.name is "alice_and_bobby.txt.minilock"
#           encrypted.data is a Blob
#           encrypted.data.size is Number
#           encrypted.senderID is Alice.miniLockID
#           error is undefined
#         else
#           error is a String explaing the failure
#           encrypted is undefined
#
# A `miniLockLib.EncryptOperation` is constructed when you call `encrypt`.
# Refer to EncryptOperation.coffee to see how it works.

miniLockLib.encrypt = (params) ->
  {data, name, miniLockIDs, keys, callback} = params
  new miniLockLib.EncryptOperation
    data: data
    name: name
    keys: keys
    miniLockIDs: miniLockIDs
    saveName: name+".minilock"
    callback: callback
    start: yes




# --------------
# Decrypt a File
# --------------
#
#     miniLockLib.decrypt
#       data: File or Blob,
#       keys: {publicKey: Uint8Array, secretKey: Uint8Array}
#       callback: (error, decrypted) ->
#         if decrypted
#           decrypted.name is "alice_and_bobby.txt"
#           decrypted.data.constructor is Blob
#           decrypted.data.size.constructor is Number
#           decrypted.senderID is Alice.miniLockID
#           error is undefined
#         else
#           error is a String explaing the failure
#           encrypted is undefined
#
# A `miniLockLib.DecryptOperation` is constructed when you call `decrypt`.
# Refer to DecryptOperation.coffee to see how it works.

miniLockLib.decrypt = (params) ->
  {data, keys, callback} = params
  new miniLockLib.DecryptOperation
    data: data
    keys: keys
    callback: callback
{'fraction_non_alphanumeric': 0.11504273504273504, 'fraction_numerical': 0.0020512820512820513, 'mean_word_length': 2.441764705882353, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '311929', 'n_tokens_mistral': 1772, 'n_tokens_neox': 1702, 'n_words': 515}