Skip to content

Commit

Permalink
Add a touch of documentation that was missing from lestrrat-go#192
Browse files Browse the repository at this point in the history
  • Loading branch information
lestrrat committed May 20, 2020
1 parent d173045 commit 42e30c6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions jwk/jwk.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ import (
)

// New creates a jwk.Key from the given key (RSA/ECDSA/symmetric keys).
//
// The constructor auto-detects the type of key to be instantiated
// based on the input type:
//
// * "crypto/rsa".PrivateKey and "crypto/rsa".PublicKey creates an RSA based key
// * "crypto/ecdsa".PrivateKey and "crypto/ecdsa".PublicKey creates an EC based key
// * []byte creates a symmetric key
func New(key interface{}) (Key, error) {
if key == nil {
return nil, errors.New(`jwk.New requires a non-nil key`)
Expand Down

0 comments on commit 42e30c6

Please sign in to comment.