Skip to content

Commit 5ff9ad7

Browse files
authored
Return channel in generate key (#34)
As `keygen` can return a private channel next to its key, this channel should be returned by the API.
1 parent 12ee0e0 commit 5ff9ad7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

v2/emitter.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,22 +359,22 @@ func (c *Client) Presence(key, channel string, status, changes bool) error {
359359
}
360360

361361
// GenerateKey sends a key generation request to the broker
362-
func (c *Client) GenerateKey(key, channel, permissions string, ttl int) (string, error) {
362+
func (c *Client) GenerateKey(key, channel, permissions string, ttl int) (string, string, error) {
363363
resp, err := c.request("keygen", &keygenRequest{
364364
Key: key,
365365
Channel: channel,
366366
Type: permissions,
367367
TTL: ttl,
368368
})
369369
if err != nil {
370-
return "", err
370+
return "", "", err
371371
}
372372

373373
// Cast the response and return it
374374
if result, ok := resp.(*keyGenResponse); ok {
375-
return result.Key, nil
375+
return result.Key, result.Channel, nil
376376
}
377-
return "", ErrUnmarshal
377+
return "", "", ErrUnmarshal
378378
}
379379

380380
// BlockKey sends a request to block a key.

0 commit comments

Comments
 (0)