KeePassTests.swift 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. import XCTest
  2. @testable import KeePass
  3. final class KeePassTests: XCTestCase {
  4. func testKDB() throws {
  5. let file = Bundle.module.url(forResource: "test-password-1234", withExtension: "kdb")!
  6. let key = CompositeKey(password: "1234")
  7. let db = try KeePass.open(contentOf: file, compositeKey: key)
  8. print(db)
  9. }
  10. func testKDBX3() throws {
  11. let file = Bundle.module.url(forResource: "test-password-1234", withExtension: "kdbx")!
  12. let key = CompositeKey(password: "1234")
  13. let db = try KeePass.open(contentOf: file, compositeKey: key)
  14. print(db)
  15. }
  16. func testKDBX4() throws {
  17. let file = Bundle.module.url(forResource: "argon2-kdf-AES-cipher", withExtension: "kdbx")!
  18. let key = CompositeKey(password: "test")
  19. let db = try KeePass.open(contentOf: file, compositeKey: key)
  20. print(db)
  21. }
  22. static var allTests = [
  23. ("testKDB", testKDB),
  24. ("testKDBX3", testKDBX3),
  25. ("testKDBX4", testKDBX4),
  26. ]
  27. }