github.com/greenpau/go-authcrunch@v1.1.4/pkg/errors/kms.go (about) 1 // Copyright 2022 Paul Greenberg greenpau@outlook.com 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package errors 16 17 // Key Management System Errors 18 const ( 19 // CryptoKeyConfig 20 ErrCryptoKeyConfigNewInvalidArgs StandardError = "kms: invalid token config arguments: %v" 21 ErrCryptoKeyConfigNewArgTypeInvalid StandardError = "kms: invalid token config argument type: %T" 22 ErrCryptoKeyConfigNewFailedUnmarshal StandardError = "kms: failed unmarshal token config: %v" 23 ErrCryptoKeyConfigNewEmptyArg StandardError = "kms: emtpy token config arguments" 24 ErrCryptoKeyConfigReadFile StandardError = "kms: failed to open file %q referenced in token config: %v" 25 ErrCryptoKeyConfigFileNotSupported StandardError = "kms: file %q is not supported due to extension type" 26 ErrCryptoKeyConfigFileKeyNotFound StandardError = "kms: file %q has no keys" 27 ErrCryptoKeyConfigUnsupportedPrivateKeyAlgo StandardError = "unsupported private key algo %T" 28 ErrCryptoKeyConfigUnsupportedPublicKeyAlgo StandardError = "unsupported public key algo %T" 29 ErrCryptoKeyConfigEmptyEnvVar StandardError = "environment variable %s has empty value" 30 ErrCryptoKeyConfigEntryInvalid StandardError = "key config entry %q is invalid: %v" 31 ErrCryptoKeyConfigNoConfigFound StandardError = "no key configs found" 32 ErrCryptoKeyConfigKeyInvalid StandardError = "key config %d is invalid: %v" 33 34 // KeyManager 35 ErrKeyManagerAddKeyNil StandardError = "kms: failed adding nil key to key manager" 36 ErrKeyManagerCryptoKeyConfigInvalidType StandardError = "kms: failed key manager with invalid token config type: %T" 37 // Keystore 38 ErrKeystoreAddKeyNil StandardError = "keystore: failed adding nil key to keystore" 39 ErrCryptoKeyStoreAddKeyNil StandardError = "keystore: failed adding nil key to keystore" 40 ErrCryptoKeyStoreParseTokenFailed StandardError = "keystore: failed to parse token" 41 ErrCryptoKeyStoreTokenData StandardError = "keystore: failed creating user from a parsed token" 42 ErrCryptoKeyStoreParseTokenExpired StandardError = "keystore: parsed token has expired" 43 ErrCryptoKeyStoreSignTokenFailed StandardError = "keystore: failed to sign token" 44 ErrCryptoKeyStoreNoVerifyKeysFound StandardError = "keystore: no verification keys found" 45 ErrCryptoKeyStoreNoSignKeysFound StandardError = "keystore: no signing keys found" 46 ErrCryptoKeyStoreAutoGenerateNotAvailable StandardError = "auto-generate not available when keystore is not empty" 47 ErrCryptoKeyStoreAutoGenerateFailed StandardError = "failed to auto-generate keystore keypair: %v" 48 ErrCryptoKeyStoreAutoGenerateAlgo StandardError = "auto-generate does not support %q algorithm" 49 // Signing 50 ErrUnsupportedSigningMethod StandardError = "kms: grantor does not support %s token signing method" 51 ErrUnexpectedSigningMethod StandardError = "signing method mismatch: %v (expected) vs. %v (received)" 52 )