Skip to content

Commit 5fad10c

Browse files
committed
keys: Added key type to the response payload
Updates tailscale/tailscale#9632
1 parent 61a211e commit 5fad10c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

keys.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type createOAuthClientWithKeyTypeRequest struct {
4848
// Key describes an authentication key within the tailnet.
4949
type Key struct {
5050
ID string `json:"id"`
51+
KeyType string `json:"keyType"`
5152
Key string `json:"key"`
5253
Description string `json:"description"`
5354
Created time.Time `json:"created"`

keys_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func TestClient_CreateAuthKey(t *testing.T) {
2727

2828
expected := &Key{
2929
ID: "test",
30+
KeyType: "auth",
3031
Key: "thisisatestkey",
3132
Created: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
3233
Expires: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
@@ -65,6 +66,7 @@ func TestClient_CreateAuthKeyWithExpirySeconds(t *testing.T) {
6566

6667
expected := &Key{
6768
ID: "test",
69+
KeyType: "auth",
6870
Key: "thisisatestkey",
6971
Created: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
7072
Expires: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
@@ -104,6 +106,7 @@ func TestClient_CreateAuthKeyWithDescription(t *testing.T) {
104106

105107
expected := &Key{
106108
ID: "test",
109+
KeyType: "auth",
107110
Key: "thisisatestkey",
108111
Created: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
109112
Expires: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
@@ -137,6 +140,7 @@ func TestClient_CreateOAuthClient(t *testing.T) {
137140

138141
expected := &Key{
139142
ID: "test",
143+
KeyType: "client",
140144
Key: "thisisatestclient",
141145
Created: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
142146
Expires: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
@@ -178,6 +182,7 @@ func TestClient_GetKey(t *testing.T) {
178182

179183
expected := &Key{
180184
ID: "test",
185+
KeyType: "auth",
181186
Created: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
182187
Expires: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
183188
Capabilities: capabilities,

0 commit comments

Comments
 (0)