UserCredentials is a convenience function that takes a filename for a user's JWT and a filename for the user's private Nkey seed.
(userOrChainedFile string, seedFiles ...string)
| 1378 | // UserCredentials is a convenience function that takes a filename |
| 1379 | // for a user's JWT and a filename for the user's private Nkey seed. |
| 1380 | func UserCredentials(userOrChainedFile string, seedFiles ...string) Option { |
| 1381 | userCB := func() (string, error) { |
| 1382 | return userFromFile(userOrChainedFile) |
| 1383 | } |
| 1384 | var keyFile string |
| 1385 | if len(seedFiles) > 0 { |
| 1386 | keyFile = seedFiles[0] |
| 1387 | } else { |
| 1388 | keyFile = userOrChainedFile |
| 1389 | } |
| 1390 | sigCB := func(nonce []byte) ([]byte, error) { |
| 1391 | return sigHandler(nonce, keyFile) |
| 1392 | } |
| 1393 | return UserJWT(userCB, sigCB) |
| 1394 | } |
| 1395 | |
| 1396 | // UserCredentialBytes is a convenience function that takes the JWT and seed |
| 1397 | // values as byte slices. This allows passing credentials directly from memory |
nothing calls this directly
no test coverage detected