5
5
# on the general principle that we should vary test values;
6
6
# they don't have any particular meaning. Make sure they match the tests!
7
7
#
8
- # WARNING: The encrypted_email_bidx *MUST* end in newline, because that
9
- # is the format created (and required) by the gem blind_index.
10
- # The encrypted_email also ends in newline, but that's just because the
8
+ # Note: The encrypted_email ends in newline, but that's just because the
11
9
# gem attr_encrypted does that (it's not actually required).
10
+ # At one time the encrypted_email_bidx *MUST* end in newline, because that
11
+ # is the format created (and required) by the gem blind_index, but that is
12
+ # no longer true.
12
13
#
13
- # We encrypt user email addresses. For test purposes, we used a fixed
14
+ # User email addresses are encrypted in the database, so for proper
15
+ # testing we must store them as encrypted data.
16
+ # For test purposes, we used a fixed
14
17
# encryption IV (don't do this with real data), and provide precomputed
15
- # values for "encrypted_email" and "encrypted_email_bidx". There's
16
- # lot of infrastructure that has to work to compute these values, and they
17
- # take time to compute, so providing precomputed values makes sense.
18
- # To find values for new email addresses, run "rails console" and then:
18
+ # values for "encrypted_email" and "email_bidx".
19
+ # We *must* do this for email_bidx, at least, because the fixture code is
20
+ # loaded and run as an ERB before its keys are fully set up.
21
+ # That's okay; there's lot of infrastructure
22
+ # that has to work correctly to compute these values,
23
+ # and they take time to compute, so providing their fixtures as
24
+ # known-correct precomputed values makes sense.
25
+ # (It means that tests are more independent of the system under test, and
26
+ # thus failures are more likely to help point out the actual problems.)
27
+ #
28
+ # To find values for new email addresses, run "rails console"
29
+ # (make sure to *not* set 'EMAIL_ENCRYPTION_KEY' nor 'EMAIL_BLIND_INDEX_KEY')
30
+ # and then do something like this:
31
+
19
32
# encrypted_email_iv: "G4fbeClWL3aFMY9I"
20
- # encrypted_email:
21
- # User.encrypt_email('[email protected] ',
22
- # iv: Base64.decode64('G4fbeClWL3aFMY9I'))
23
- # encrypted_email_bidx:
33
+ # encrypted_email: # Find its value with:
34
+ # User.encrypt_email(email, iv: Base64.decode64('G4fbeClWL3aFMY9I'))
35
+ # email_bidx: # Find its value with:
36
+ # User.generate_email_bidx(email)
37
+ # Another (longer) way to compute email_bidx is to run:
24
38
# BlindIndex.generate_bidx("[email protected] ", User.blind_indexes[:email])
25
- # An alternative approach is to create a stub user:
39
+ # You can create a stub user and find its email_bidx this way :
26
40
# x = User.new; x.email = '[email protected] '; x.compute_email_bidx
27
41
# This assumes that you're using the usual (default) test keys.
28
42
#
32
46
# iv: Base64.decode64('G4fbeClWL3aFMY9I')).inspect)
33
47
# puts(' encrypted_email_bidx: ' + BlindIndex.generate_bidx(
34
48
# current_email, User.blind_indexes[:email]).inspect)
35
- #
36
- # Here are some additional encryptions if you need them:
37
- # current_email = '[email protected] '
38
- # encrypted_email_iv: "G4fbeClWL3aFMY9I"
39
- # encrypted_email: "0LWldZP1iahMHmhaQwjU9g27hpaNo56iCfMNh+ZsERg=\n"
40
- # encrypted_email_bidx: "C/0XJyW8Xitx19MPv1j8B65iNOaykMLZnMZ/TctNp3U=\n"
41
- #
42
- # current_email = '[email protected] '
43
- # encrypted_email_iv: "G4fbeClWL3aFMY9I"
44
- # encrypted_email: "27ulebbkl7xNLmFHDArW/ZzHIFjaYveE2hxJl2Kxdk2/rm4xXw==\n"
45
- # encrypted_email_bidx: "0SHo5Lc+XTrcY6HvouDwAIvEdy+8odILw9DP3MGXMfM=\n"
46
- #
47
- # current_email = '[email protected] '
48
- # encrypted_email: "3LC6d73QlLFAA3RTCEnJ455qaUF28kYI7ZOGoIDUhkzm\n"
49
- # encrypted_email_iv: "G4fbeClWL3aFMY9I"
50
- # encrypted_email_bidx: "yspd41bZJvT9bn0MQXU2l2dnhpZTIKpf0u46w6+qf1U=\n"
51
49
52
50
# current_email = '[email protected] '
53
51
test_user :
54
52
name : Test
53
+ # This is our conventional IV value
55
54
encrypted_email_iv : " G4fbeClWL3aFMY9I"
55
+ # encrypted_email: (%= User.encrypt_email('[email protected] ',
56
+ # iv: Base64.decode64('G4fbeClWL3aFMY9I')).inspect %)
56
57
encrypted_email : " ybGkapP1iahMHmhaQwjU9qTfGB7w/KCFTiUGkIVZZ08=\n "
57
- encrypted_email_bidx : " hEghi+qNCA63qDAuTIq8jBWtOweoQ33EstwMnvM3/gk=\n "
58
+ # email_bidx: (%= User.generate_email_bidx('[email protected] ').inspect %)
59
+ email_bidx : " vmUX8sb4/akruZRPDwQ7e2bZHiAcqxO2BS7u2vdg/Cs="
58
60
password_digest : <%= User.digest('password') %>
59
61
provider : local
60
62
preferred_locale : en
61
63
activated : true
62
64
activated_at : <%= Time.zone.now %>
63
65
64
66
# current_email = '[email protected] '
67
+ # User.encrypt_email('[email protected] ',
68
+ # iv: Base64.decode64('G4fbeClWL3aFMY9I'))
65
69
test_user_melissa :
66
70
name : Melissa Lewis
67
71
encrypted_email_iv : " G4fbeClWL3aFMY9I"
68
72
encrypted_email : " 0LG7d6DjkIlEFmVSHQvDv5qGImt+oNOl9LLibPvLAwHeWmo=\n "
69
- encrypted_email_bidx : " ip6E/EM+EYkbzsRm6ZTprRg4PTsN/T5xY9E80U3Hlfo=\n "
73
+ # email_bidx: (%= User.generate_email_bidx('[email protected] ').inspect %)
74
+ email_bidx : " gkyruOK5LMxyHFElzYO9YtdKJBrIJZnkDamwU6M1+Jc="
70
75
password_digest : <%= User.digest('password1') %>
71
76
provider : local
72
77
preferred_locale : en
@@ -78,7 +83,8 @@ test_user_mark:
78
83
name : Mark Watney
79
84
encrypted_email_iv : " G4fbeClWL3aFMY9I"
80
85
encrypted_email : " 0LWldZP1iahMHmhaQwTJ/JxzMJME5stBTXCm7WcmYyg=\n "
81
- encrypted_email_bidx : " aZpkg4oEr8KjacLrZINGN1JRGD1caIWoWUTM57KOePk=\n "
86
+ # email_bidx: (%= User.generate_email_bidx('[email protected] ').inspect %)
87
+ email_bidx : " PM4RbQebE5i3FU4Zm/+cNT6P0POakuR8Fz9QzP7L01U="
82
88
password_digest : <%= User.digest('password') %>
83
89
provider : local
84
90
preferred_locale : en
@@ -90,7 +96,8 @@ test_user_not_active:
90
96
name : Forgetful
91
97
encrypted_email_iv : " G4fbeClWL3aFMY9I"
92
98
encrypted_email : " 27ulebbkl7xNLmFHDArW/ZzHLEXQQHbOqCyJ9yfVGoZn2ok7ew==\n "
93
- encrypted_email_bidx : " nRtJqO5uutJ7Z/HcjLHM/jt3cA++pN1t85URKscQfsQ=\n "
99
+ # email_bidx: (%= User.generate_email_bidx('[email protected] ').inspect %)
100
+ email_bidx : " y5UiQko516f50w/YRAZAuW7FzzpWKmvg1Yzd44ry+JQ="
94
101
password_digest : <%= User.digest('password') %>
95
102
provider : local
96
103
preferred_locale : en
@@ -101,7 +108,8 @@ test_user_cs:
101
108
name : Case Sensitive
102
109
encrypted_email_iv : " G4fbeClWL3aFMY9I"
103
110
encrypted_email : " /rWke4D1n7pIGm1JCCfD6ZiEP0bY51bxymIp4AvOLZGyoX8ln1EALDc=\n "
104
- encrypted_email_bidx : " +rRkCLpeIVcfwtPu+Jy6YyXtksI/w3frgdSu8J4kR2M=\n "
111
+ # email_bidx: (%= User.generate_email_bidx('[email protected] '.downcase).inspect %)
112
+ email_bidx : " I5hCRmgHRw0+XSK6TMfTRk/vhkbX+2cXUJzaiWTVqcs="
105
113
password_digest : <%= User.digest('password') %>
106
114
provider : local
107
115
preferred_locale : en
@@ -113,7 +121,8 @@ admin_user:
113
121
name : Admin
114
122
encrypted_email_iv : " G4fbeClWL3aFMY9I"
115
123
encrypted_email : " 3LC6d73QlLFAA3RTCEnF/pQPuTWBDzfZWpDX1TJ+bsBO\n "
116
- encrypted_email_bidx : " PH39U8dihphvLTlLEwJWXdy2OLz477WOn/DNsZaHqfE=\n "
124
+ # email_bidx: (%= User.generate_email_bidx('[email protected] ').inspect %)
125
+ email_bidx : " pdszbZsBfJRl+Fg0ZZ7/Mwguy64JlXvJ7TflzSEIawM="
117
126
password_digest : <%= User.digest('password') %>
118
127
provider : local
119
128
preferred_locale : en
@@ -128,7 +137,8 @@ github_user:
128
137
nickname : github-user
129
138
encrypted_email_iv : " G4fbeClWL3aFMY9I"
130
139
encrypted_email : " 2r2jdqby3LxSC3Z/CB/H/ImFKgTeplS8IDY+qfw8Fi73KhLn8MYC\n "
131
- encrypted_email_bidx : " Vyiu7EdbDXioCgMAVIWqLHyBH148S9JcSspSWq6nPN8=\n "
140
+ # email_bidx: (%= User.generate_email_bidx('[email protected] ').inspect %)
141
+ email_bidx : " ZjENXwF1sT4lGPhlXJMGGojv/NgxQvRgis647Pgotwg="
132
142
password_digest : <%= User.digest('password') %>
133
143
provider : github
134
144
preferred_locale : en
@@ -140,7 +150,8 @@ fr_user:
140
150
name : French Test
141
151
encrypted_email : " 26b6arbjhYlEFmVSHQvDv5abKOzHp6ZN4HPtuqnxJkbq84I=\n "
142
152
encrypted_email_iv : " G4fbeClWL3aFMY9I"
143
- encrypted_email_bidx : " 7e3Bzzf0T1HnQKICsDEqJGosonRFiZZNtN445wgNDYU=\n "
153
+ # email_bidx: (%= User.generate_email_bidx('[email protected] ').inspect %)
154
+ email_bidx : " iZlt4P3IjjuMUuajvkGqwatHglhDxoNCUsYMgebOEOQ="
144
155
password_digest : <%= User.digest('password') %>
145
156
provider : local
146
157
preferred_locale : fr
0 commit comments