File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,28 @@ type (
103
103
}
104
104
)
105
105
106
+ // Clone returns a new copy of the KeyConfiguration.
107
+ func (c KeyConfiguration ) Clone () KeyConfiguration {
108
+ return KeyConfiguration {
109
+ ID : c .ID ,
110
+ Alg : c .Alg ,
111
+ Private : c .Private ,
112
+ Public : c .Public ,
113
+ MaxAge : c .MaxAge ,
114
+ EncryptionKey : c .EncryptionKey ,
115
+ }
116
+ }
117
+
118
+ // Clone returns a new copy of the KeysConfiguration.
119
+ // Load or MustLoad must be called to parse the keys after the clone.
120
+ func (c KeysConfiguration ) Clone () KeysConfiguration {
121
+ cloned := make (KeysConfiguration , len (c ))
122
+ for i , v := range c {
123
+ cloned [i ] = v .Clone ()
124
+ }
125
+ return cloned
126
+ }
127
+
106
128
// Get returns the key configuration based on its id.
107
129
func (c KeysConfiguration ) Get (kid string ) (KeyConfiguration , bool ) {
108
130
for _ , entry := range c {
You can’t perform that action at this time.
0 commit comments