blob: 40013488bfdae295cbc219409862a497a7580d6f [file] [log] [blame]
Don Newton379ae252019-04-01 12:17:06 -04001package stringprep
2
3var mapNonASCIISpaceToASCIISpace = Mapping{
4 0x00A0: []rune{0x0020},
5 0x1680: []rune{0x0020},
6 0x2000: []rune{0x0020},
7 0x2001: []rune{0x0020},
8 0x2002: []rune{0x0020},
9 0x2003: []rune{0x0020},
10 0x2004: []rune{0x0020},
11 0x2005: []rune{0x0020},
12 0x2006: []rune{0x0020},
13 0x2007: []rune{0x0020},
14 0x2008: []rune{0x0020},
15 0x2009: []rune{0x0020},
16 0x200A: []rune{0x0020},
17 0x200B: []rune{0x0020},
18 0x202F: []rune{0x0020},
19 0x205F: []rune{0x0020},
20 0x3000: []rune{0x0020},
21}
22
23// SASLprep is a pre-defined stringprep profile for user names and passwords
24// as described in RFC-4013.
25//
26// Because the stringprep distinction between query and stored strings was
27// intended for compatibility across profile versions, but SASLprep was never
28// updated and is now deprecated, this profile only operates in stored
29// strings mode, prohibiting unassigned code points.
30var SASLprep Profile = saslprep
31
32var saslprep = Profile{
33 Mappings: []Mapping{
34 TableB1,
35 mapNonASCIISpaceToASCIISpace,
36 },
37 Normalize: true,
38 Prohibits: []Set{
39 TableA1,
40 TableC1_2,
41 TableC2_1,
42 TableC2_2,
43 TableC3,
44 TableC4,
45 TableC5,
46 TableC6,
47 TableC7,
48 TableC8,
49 TableC9,
50 },
51 CheckBiDi: true,
52}