errors.go 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2022 The NATS Authors
  2. // Licensed under the Apache License, Version 2.0 (the "License");
  3. // you may not use this file except in compliance with the License.
  4. // You may obtain a copy of the License at
  5. //
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. package nkeys
  14. // Errors
  15. const (
  16. ErrInvalidPrefixByte = nkeysError("nkeys: invalid prefix byte")
  17. ErrInvalidKey = nkeysError("nkeys: invalid key")
  18. ErrInvalidPublicKey = nkeysError("nkeys: invalid public key")
  19. ErrInvalidPrivateKey = nkeysError("nkeys: invalid private key")
  20. ErrInvalidSeedLen = nkeysError("nkeys: invalid seed length")
  21. ErrInvalidSeed = nkeysError("nkeys: invalid seed")
  22. ErrInvalidEncoding = nkeysError("nkeys: invalid encoded key")
  23. ErrInvalidSignature = nkeysError("nkeys: signature verification failed")
  24. ErrCannotSign = nkeysError("nkeys: can not sign, no private key available")
  25. ErrPublicKeyOnly = nkeysError("nkeys: no seed or private key available")
  26. ErrIncompatibleKey = nkeysError("nkeys: incompatible key")
  27. ErrInvalidChecksum = nkeysError("nkeys: invalid checksum")
  28. ErrNoSeedFound = nkeysError("nkeys: no nkey seed found")
  29. ErrInvalidNkeySeed = nkeysError("nkeys: doesn't contain a seed nkey")
  30. ErrInvalidUserSeed = nkeysError("nkeys: doesn't contain an user seed nkey")
  31. ErrInvalidRecipient = nkeysError("nkeys: not a valid recipient public curve key")
  32. ErrInvalidSender = nkeysError("nkeys: not a valid sender public curve key")
  33. ErrInvalidCurveKey = nkeysError("nkeys: not a valid curve key")
  34. ErrInvalidCurveSeed = nkeysError("nkeys: not a valid curve seed")
  35. ErrInvalidEncrypted = nkeysError("nkeys: encrypted input is not valid")
  36. ErrInvalidEncVersion = nkeysError("nkeys: encrypted input wrong version")
  37. ErrCouldNotDecrypt = nkeysError("nkeys: could not decrypt input")
  38. ErrInvalidCurveKeyOperation = nkeysError("nkeys: curve key is not valid for sign/verify")
  39. ErrInvalidNKeyOperation = nkeysError("nkeys: only curve key can seal/open")
  40. ErrCannotOpen = nkeysError("nkeys: cannot open no private curve key available")
  41. ErrCannotSeal = nkeysError("nkeys: cannot seal no private curve key available")
  42. )
  43. type nkeysError string
  44. func (e nkeysError) Error() string {
  45. return string(e)
  46. }