1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 "golang.org/x/text/runes"
11 "golang.org/x/text/transform"
12 "golang.org/x/text/unicode/norm"
16 // Implements the Nickname profile specified in RFC 7700.
17 // The nickname profile is not idempotent and may need to be applied multiple
18 // times before being used for comparisons.
19 Nickname *Profile = nickname
21 // Implements the UsernameCaseMapped profile specified in RFC 7613.
22 UsernameCaseMapped *Profile = usernameCaseMap
24 // Implements the UsernameCasePreserved profile specified in RFC 7613.
25 UsernameCasePreserved *Profile = usernameNoCaseMap
27 // Implements the OpaqueString profile defined in RFC 7613 for passwords and other secure labels.
28 OpaqueString *Profile = opaquestring
34 AdditionalMapping(func() transform.Transformer {
35 return &nickAdditionalMapping{}
43 usernameCaseMap = &Profile{
52 usernameNoCaseMap = &Profile{
60 opaquestring = &Profile{
62 AdditionalMapping(func() transform.Transformer {
72 // mapSpaces is a shared value of a runes.Map transformer.
73 var mapSpaces transform.Transformer = runes.Map(func(r rune) rune {
74 if unicode.Is(unicode.Zs, r) {