def encrypt_doc(crypto, doc): """ Wrapper around encrypt_docstr that accepts a crypto object and the document as arguments. :param crypto: a soledad crypto object. :type crypto: SoledadCrypto :param doc: the document. :type doc: SoledadDocument """ key = crypto.doc_passphrase(doc.doc_id) secret = crypto.secret return encrypt_docstr(doc.get_json(), doc.doc_id, doc.rev, key, secret)
def encrypt_doc(crypto, doc): """ Wrapper around encrypt_docstr that accepts a crypto object and the document as arguments. :param crypto: a soledad crypto object. :type crypto: SoledadCrypto :param doc: the document. :type doc: SoledadDocument """ key = crypto.doc_passphrase(doc.doc_id) secret = crypto.secret return encrypt_docstr(doc.get_json(), doc.doc_id, doc.rev, key, secret)
def decrypt_doc(crypto, doc): """ Wrapper around decrypt_doc_dict that accepts a crypto object and the document as arguments. :param crypto: a soledad crypto object. :type crypto: SoledadCrypto :param doc: the document. :type doc: SoledadDocument :return: json string with the decrypted document :rtype: str """ key = crypto.doc_passphrase(doc.doc_id) secret = crypto.secret return decrypt_doc_dict(doc.content, doc.doc_id, doc.rev, key, secret)
def decrypt_doc(crypto, doc): """ Wrapper around decrypt_doc_dict that accepts a crypto object and the document as arguments. :param crypto: a soledad crypto object. :type crypto: SoledadCrypto :param doc: the document. :type doc: SoledadDocument :return: json string with the decrypted document :rtype: str """ key = crypto.doc_passphrase(doc.doc_id) secret = crypto.secret return decrypt_doc_dict(doc.content, doc.doc_id, doc.rev, key, secret)