File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,11 @@ type (
57
57
// Look the MustLoad/Load method.
58
58
//
59
59
// Example at: _examples/multiple-kids.
60
- KeysConfiguration []struct {
60
+ KeysConfiguration []KeyConfiguration
61
+
62
+ // KeyConfiguration is a single key configuration.
63
+ // It's just a representation of the Key struct but with string fields.
64
+ KeyConfiguration struct {
61
65
ID string `json:"id" yaml:"ID" toml:"ID" ini:"id"`
62
66
// Alg declares the algorithm name.
63
67
// Available values:
@@ -94,6 +98,17 @@ type (
94
98
}
95
99
)
96
100
101
+ // Get returns the key configuration based on its id.
102
+ func (c KeysConfiguration ) Get (kid string ) (KeyConfiguration , bool ) {
103
+ for _ , entry := range c {
104
+ if entry .ID == kid {
105
+ return entry , true
106
+ }
107
+ }
108
+
109
+ return KeyConfiguration {}, false
110
+ }
111
+
97
112
// MustLoad same as Load but it panics if errored.
98
113
func (c KeysConfiguration ) MustLoad () Keys {
99
114
keys , err := c .Load ()
You can’t perform that action at this time.
0 commit comments