journeyapps / node-sqlcipher

SQLCipher bindings for Node
https://journeyapps.com
BSD 3-Clause "New" or "Revised" License
207 stars 66 forks source link

sqlcipher_export not working #78

Closed haivle closed 3 years ago

haivle commented 3 years ago

Can you help me to take a look at the flowing snippet? I'm trying to export the encrypted db to a decrypted db but it seems not working. ` async function demo() { var db = new sqlite3.Database(ENCRYPTED_DB_FOLDER)

db.serialize(function () { // db.run('PRAGMA cipher_compatibility = 3') db.run("PRAGMA key = 'abc'") db.run('PRAGMA cipher_page_size = 1024') db.run("PRAGMA kdf_iter = '64000'") db.run('PRAGMA cipher_hmac_algorithm = HMAC_SHA1') db.run('PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA1')

db.run(
  `
    ATTACH DATABASE "data/global/db/decrypted_database.db" AS plaintext KEY "";
    SELECT sqlcipher_export("plaintext");
    DETACH DATABASE plaintext;
  `,
)

})

db.close() } `