func encodeCaveat(
	condition string,
	rootKey []byte,
	thirdPartyInfo ThirdPartyInfo,
	key *KeyPair,
	ns *checkers.Namespace,
) ([]byte, error) {
	switch thirdPartyInfo.Version {
	case Version0, Version1:
		return encodeCaveatV1(condition, rootKey, &thirdPartyInfo.PublicKey, key)
	case Version2:
		return encodeCaveatV2(condition, rootKey, &thirdPartyInfo.PublicKey, key)
	default:
		// Version 3 or later - use V3.
		return encodeCaveatV3(condition, rootKey, &thirdPartyInfo.PublicKey, key, ns)
	}
}
// encodeCaveat encrypts a third-party caveat with the given condtion
// and root key. The thirdPartyInfo key holds information about the
// third party we're encrypting the caveat for; the key is the
// public/private key pair of the party that's adding the caveat.
//
// The caveat will be encoded according to the version information
// found in thirdPartyInfo.
encodeCaveat encrypts a third-party caveat with the given condtion
and root key. The thirdPartyInfo key holds information about the
third party we're encrypting the caveat for; the key is the
public/private key pair of the party that's adding the caveat.

The caveat will be encoded according to the version information
found in thirdPartyInfo.
// encodeCaveat encrypts a third - party caveat with the given condtion // and root key . The thirdPartyInfo key holds information about the // third party we ' re encrypting the caveat for ; the key is the // public / private key pair of the party that ' s adding the caveat . // // The caveat will be encoded according to the version information // found in thirdPartyInfo .
func encodeCaveat(
	condition string,
	rootKey []byte,
	thirdPartyInfo ThirdPartyInfo,
	key *KeyPair,
	ns *checkers.Namespace,
) ([]byte, error) {
	switch thirdPartyInfo.Version {
	case Version0, Version1:
		return encodeCaveatV1(condition, rootKey, &thirdPartyInfo.PublicKey, key)
	case Version2:
		return encodeCaveatV2(condition, rootKey, &thirdPartyInfo.PublicKey, key)
	default:
		return encodeCaveatV3(condition, rootKey, &thirdPartyInfo.PublicKey, key, ns)
	}
}
func encodeCaveat ( condition string , rootKey [ ] byte , thirdPartyInfo ThirdPartyInfo , key * KeyPair , ns * checkers . Namespace , ) ( [ ] byte , error ) { switch thirdPartyInfo . Version { case Version0 , Version1 : return encodeCaveatV1 ( condition , rootKey , & thirdPartyInfo . PublicKey , key ) case Version2 : return encodeCaveatV2 ( condition , rootKey , & thirdPartyInfo . PublicKey , key ) default : return encodeCaveatV3 ( condition , rootKey , & thirdPartyInfo . PublicKey , key , ns ) } }
encodeCaveat encrypts a third-party caveat with the given condtion
and root key.
encodeCaveat encrypts a third - party caveat with the given condtion and root key .
// Version 3 or later - use V3.