Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add example datafile in agilekeychain format, tidy up integration tests

  • Loading branch information...
commit 6ac9bbb52b119008ebad1493c74bce0cb2a89851 1 parent ef4e600
James Brown authored February 22, 2013

Showing 28 changed files with 3,902 additions and 4 deletions. Show diff stats Hide diff stats

  1. 3,870  data/sample.agilekeychain/1Password.html
  2. BIN  data/sample.agilekeychain/a/default/thumb/l/A7E82B9E4EAB4F8BB14DC3C6C25EF6C8
  3. 1  data/sample.agilekeychain/a/default/thumb/l/A7E82B9E4EAB4F8BB14DC3C6C25EF6C8.def
  4. BIN  data/sample.agilekeychain/a/default/thumb/m/A7E82B9E4EAB4F8BB14DC3C6C25EF6C8
  5. 1  data/sample.agilekeychain/a/default/thumb/m/A7E82B9E4EAB4F8BB14DC3C6C25EF6C8.def
  6. 1  data/sample.agilekeychain/config/buildnum
  7. 1  data/sample.agilekeychain/config/use-thumbnails
  8. BIN  data/sample.agilekeychain/data/default/.1password.keys
  9. 1  data/sample.agilekeychain/data/default/.password.hint
  10. BIN  data/sample.agilekeychain/data/default/1password.keys
  11. 1  data/sample.agilekeychain/data/default/23591BA807444B1EB5F356A807ED62F0.1password
  12. 1  data/sample.agilekeychain/data/default/A7E82B9E4EAB4F8BB14DC3C6C25EF6C8.1password
  13. 1  data/sample.agilekeychain/data/default/contents.js
  14. 1  data/sample.agilekeychain/data/default/encryptionKeys.js
  15. 0  data/{sample_cloudkeychain → sample.cloudkeychain}/default/band_0.js
  16. 0  data/{sample_cloudkeychain → sample.cloudkeychain}/default/band_1.js
  17. 0  data/{sample_cloudkeychain → sample.cloudkeychain}/default/band_2.js
  18. 0  data/{sample_cloudkeychain → sample.cloudkeychain}/default/band_3.js
  19. 0  data/{sample_cloudkeychain → sample.cloudkeychain}/default/band_4.js
  20. 0  data/{sample_cloudkeychain → sample.cloudkeychain}/default/band_5.js
  21. 0  data/{sample_cloudkeychain → sample.cloudkeychain}/default/band_7.js
  22. 0  data/{sample_cloudkeychain → sample.cloudkeychain}/default/band_D.js
  23. 0  data/{sample_cloudkeychain → sample.cloudkeychain}/default/band_E.js
  24. 0  data/{sample_cloudkeychain → sample.cloudkeychain}/default/band_F.js
  25. 0  data/{sample_cloudkeychain → sample.cloudkeychain}/default/profile.js
  26. 8  onepassword/keychain.py
  27. 17  tests/integration/agilekeychain.py
  28. 2  tests/integration/cloudkeychain.py
3,870  data/sample.agilekeychain/1Password.html
3870 additions, 0 deletions not shown
BIN  data/sample.agilekeychain/a/default/thumb/l/A7E82B9E4EAB4F8BB14DC3C6C25EF6C8
Binary file not shown
1  data/sample.agilekeychain/a/default/thumb/l/A7E82B9E4EAB4F8BB14DC3C6C25EF6C8.def
... ...
@@ -0,0 +1 @@
  1
+{"encryptionKey":"FDFF57742F4248719A337AD2AD93DA76","encrypted":true,"contentsHash":"d7560e1d"}
BIN  data/sample.agilekeychain/a/default/thumb/m/A7E82B9E4EAB4F8BB14DC3C6C25EF6C8
Binary file not shown
1  data/sample.agilekeychain/a/default/thumb/m/A7E82B9E4EAB4F8BB14DC3C6C25EF6C8.def
... ...
@@ -0,0 +1 @@
  1
+{"encryptionRequired":false,"encrypted":false,"contentsHash":"2039460f"}
1  data/sample.agilekeychain/config/buildnum
... ...
@@ -0,0 +1 @@
  1
+39001
1  data/sample.agilekeychain/config/use-thumbnails
... ...
@@ -0,0 +1 @@
  1
+y
BIN  data/sample.agilekeychain/data/default/.1password.keys
Binary file not shown
1  data/sample.agilekeychain/data/default/.password.hint
... ...
@@ -0,0 +1 @@
  1
+george
BIN  data/sample.agilekeychain/data/default/1password.keys
Binary file not shown
1  data/sample.agilekeychain/data/default/23591BA807444B1EB5F356A807ED62F0.1password
... ...
@@ -0,0 +1 @@
  1
+{"uuid":"23591BA807444B1EB5F356A807ED62F0","updatedAt":1361554847,"locationKey":"","openContents":{"securityLevel":"SL5","contentsHash":"10a7703b"},"keyID":"FDFF57742F4248719A337AD2AD93DA76","title":"I am a note!","location":"","encrypted":"U2FsdGVkX19tN63hCc5UeaATCvjt2/1e5cMsFArwvFzrPmPGGqxIuzxtmHym5gWBnuGE9ztw6Qvl6bmZ9PsqHA==\u0000","createdAt":1361554834,"typeName":"securenotes.SecureNote"}
1  data/sample.agilekeychain/data/default/A7E82B9E4EAB4F8BB14DC3C6C25EF6C8.1password
... ...
@@ -0,0 +1 @@
  1
+{"uuid":"A7E82B9E4EAB4F8BB14DC3C6C25EF6C8","updatedAt":1361554830,"locationKey":"google.com","openContents":{"usernameHash":"f1a17031762820b40e5fc9ad54e9735a6c4b6dd3a7cbe0dd46033406ed354f17","securityLevel":"SL5","contentsHash":"530e2de0"},"keyID":"FDFF57742F4248719A337AD2AD93DA76","title":"Google","location":"http://www.google.com","encrypted":"U2FsdGVkX18k/jtACb/7twKFg+Dfa+JNT8fpFif0u20ecEcMZDjUXlYyP2VEjk65xTNgkSHQELJ9e8ZsF/wu1V/K933WPAtfYMEVXstM+e980cdMiH94K3qrX0foTo+TDCVcSyvBhawGuU08sJ+qeBHYNmIw+7A3SiWEyUDK9J750XWNInSoTldiqiE5RN1wuodzODt0nZyqNnJ+ixzR4A==\u0000","createdAt":1361554822,"typeName":"webforms.WebForm"}
1  data/sample.agilekeychain/data/default/contents.js
... ...
@@ -0,0 +1 @@
  1
+[["A7E82B9E4EAB4F8BB14DC3C6C25EF6C8","webforms.WebForm","Google","google.com",1361554830,"",0,"N"],["23591BA807444B1EB5F356A807ED62F0","securenotes.SecureNote","I am a note!","",1361554847,"",0,"N"]]
1  data/sample.agilekeychain/data/default/encryptionKeys.js
... ...
@@ -0,0 +1 @@
  1
+{"SL3":"931524D13B0F414FA07B9170F22416E0","list":[{"data":"U2FsdGVkX1/Iz/e3HWD6bKewSmspW0+w/n0Y9+cAvi7zGlykOEGMy4coED2UKh18Ur9ptM4LjRga5YcXyKWEtH6BB9/7s6JBYc4MY3scnpxRBaEXZBV0rT+Q068w7UHf8rWkSMdrqP6piQsxNlxvnhazKNy4o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Tv28x0KnuY6PKiE1TtcjUh2qzg2bh6tJ2nxuIjX+ffBMSlw8ho+Qpa8wh+0MGBA5KeoDhKopbY84oRBVCk+azdRK31tAdFyW95ojH7RfQKFLt5bzn+s6j5vpTuk9TVO0q9i8W8WlSd0WZsfcoCvgThHA2gyoaZJpI97wsFHbWfBq+g+GMRvTRm/NgzLdDfrCi7sxBD1FOfSY82UgIzi+HxNbaSAfHzKzK2A2fGrV8qRAgdm/ZULhyA5rrJwWp6U/Wwd8pSkAOD62fvOKNWOPouc1j0tXbu9IAWgvpiT/4g317fe6L70wib0cESpS3z4/wgezHPzGyUQWGF4WicVD/OASIJGIZPN9B5WyUI8YyF9ftsTmly5jHtuRiQ55+x77ADWP9FB2Mx39QZvghdj6iytPvV6nS+9xE70NHattfLBxBk5k9kUN+J16ezFa/Xmc7k2FS6s4LMXfy5q9p1FQiBoYJD0Oq9N+8boY07temEYNAdi7PwZT\u0000","level":"SL5","identifier":"FDFF57742F4248719A337AD2AD93DA76","iterations":26178},{"data":"U2FsdGVkX19xaJ9QpE7lyDBA3+SogtjqenB+NOAy4pKw0utGRgYPsepwkxQZqoAR2qnt9smlUC18tCTcOJgONkr92suVgaSfts/eX3dHl51cJd3Wsm08ovTOxtydmYt0uGbo8MDEIsLkidJZGWy4n84MjeDy9ldlDNWvieL+1tF9f0nyxNw2f7k8L4kybxjYQBPE1lfa86mLR3rv7tx4rOQ1ojsLaf7RaJ1/DB/r8c3NN0YrB0fWdob2c349dyWDC/MLTHTD76ZOkzdKNorfp+17iYJBRNBe5hN7aFnfl4orkfZ2ObHD4mmg3wlLiCDc5c+Ytj87/fVVxcatJVt5FYcZdPbAeBB/cxmMRs1Qv56c40XT161wmtxF30CDgg5thfPZplnQgS2MuXFT51phscZQ8IkDJPi7fXah8RtjbZV8yY5d0yHe7UWA4FTwdBaHbDnvB+rufOHShDwpkXtbjEffZNIRAJlyNDVKWeklfvaq7SRhTwzGcFu934jwerzg1Iktnb1ewa0FfpuwnRggoDLC/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sJUf/X0d75vYPiXspLHoWWvCi27cIZN1A103+3tUotO0zSGqeAlZ19TLZ1ykiDvhpaLOFfJDPyV1e8Kf212L10H6ncjeFaIi5PuAHNzLBPAZuj/MeoBjpY4DTs+aoJX+cwR3NuDsskPhj2iUriM\u0000","level":"SL3","identifier":"931524D13B0F414FA07B9170F22416E0","iterations":26178}],"SL5":"FDFF57742F4248719A337AD2AD93DA76"}
0  data/sample_cloudkeychain/default/band_0.js → data/sample.cloudkeychain/default/band_0.js
File renamed without changes
0  data/sample_cloudkeychain/default/band_1.js → data/sample.cloudkeychain/default/band_1.js
File renamed without changes
0  data/sample_cloudkeychain/default/band_2.js → data/sample.cloudkeychain/default/band_2.js
File renamed without changes
0  data/sample_cloudkeychain/default/band_3.js → data/sample.cloudkeychain/default/band_3.js
File renamed without changes
0  data/sample_cloudkeychain/default/band_4.js → data/sample.cloudkeychain/default/band_4.js
File renamed without changes
0  data/sample_cloudkeychain/default/band_5.js → data/sample.cloudkeychain/default/band_5.js
File renamed without changes
0  data/sample_cloudkeychain/default/band_7.js → data/sample.cloudkeychain/default/band_7.js
File renamed without changes
0  data/sample_cloudkeychain/default/band_D.js → data/sample.cloudkeychain/default/band_D.js
File renamed without changes
0  data/sample_cloudkeychain/default/band_E.js → data/sample.cloudkeychain/default/band_E.js
File renamed without changes
0  data/sample_cloudkeychain/default/band_F.js → data/sample.cloudkeychain/default/band_F.js
File renamed without changes
0  data/sample_cloudkeychain/default/profile.js → data/sample.cloudkeychain/default/profile.js
File renamed without changes
8  onepassword/keychain.py
@@ -8,7 +8,8 @@
8 8
 from . import padding
9 9
 from .item import Item
10 10
 
11  
-EXPECTED_VERSION = 30645
  11
+EXPECTED_VERSION_MIN = 30000
  12
+EXPECTED_VERSION_MAX = 40000
12 13
 
13 14
 
14 15
 class AbstractKeychain(object):
@@ -48,8 +49,9 @@ def check_version(self):
48 49
         version_file = os.path.join(self.base_path, 'config', 'buildnum')
49 50
         with open(version_file, 'r') as f:
50 51
             version_num = int(f.read().strip())
51  
-        if version_num != EXPECTED_VERSION:
52  
-            raise ValueError("I only understand 1Password build %s" % EXPECTED_VERSION)
  52
+        if version_num < EXPECTED_VERSION_MIN or version_num > EXPECTED_VERSION_MAX:
  53
+            print version_num
  54
+            raise ValueError("I only understand 1Password builds in [%s,%s]" % (EXPECTED_VERSION_MIN, EXPECTED_VERSION_MAX))
53 55
 
54 56
     def unlock(self, password):
55 57
         keys = self._load_keys(password)
17  tests/integration/agilekeychain.py
... ...
@@ -0,0 +1,17 @@
  1
+import os.path
  2
+
  3
+import testify as T
  4
+
  5
+import onepassword.keychain
  6
+
  7
+class AgileKeychainIntegrationTestCase(T.TestCase):
  8
+    test_file_root = os.path.realpath(os.path.join(__file__, '..', '..', '..', 'data', 'sample.agilekeychain'))
  9
+
  10
+    def test_open(self):
  11
+        c = onepassword.keychain.AKeychain(self.test_file_root)
  12
+        c.unlock("george")
  13
+
  14
+
  15
+if __name__ == '__main__':
  16
+    T.run()
  17
+
2  tests/integration/cloudkeychain.py
@@ -5,7 +5,7 @@
5 5
 import onepassword.keychain
6 6
 
7 7
 class CloudKeychainIntegrationTestCase(T.TestCase):
8  
-    test_file_root = os.path.realpath(os.path.join(__file__, '..', '..', '..', 'data', 'sample_cloudkeychain'))
  8
+    test_file_root = os.path.realpath(os.path.join(__file__, '..', '..', '..', 'data', 'sample.cloudkeychain'))
9 9
 
10 10
     def test_open(self):
11 11
         c = onepassword.keychain.CKeychain(self.test_file_root)

0 notes on commit 6ac9bbb

Please sign in to comment.
Something went wrong with that request. Please try again.