func (KeyringSectionV1) HasRevocations() bool {
	return false
}
HasRevocations indicates that a Keyring holds revoked user keys. We don't
track in V1 so it is always false.
package registry
import (
	"context"
	"encoding/json"
	"errors"
	"net/url"
	"github.com/manifoldco/torus-cli/envelope"
	"github.com/manifoldco/torus-cli/identity"
	"github.com/manifoldco/torus-cli/primitive"
)
var ErrMemberNotFound = errors.New("keyring membership not found")
type KeyringClient struct {
	client  RoundTripper
	Members *KeyringMembersClient
}
type KeyringSection interface {
	GetKeyring() envelope.KeyringInf
	KeyringVersion() int
	FindMember(*identity.ID) (*primitive.KeyringMember, *primitive.MEKShare, error)
	FindMEKByKeyID(*identity.ID) (*primitive.MEKShare, error)
	HasRevocations() bool
	GetClaims() []envelope.KeyringMemberClaim
}
type KeyringSectionV1 struct {
	Keyring *envelope.KeyringV1        `json:"keyring"`
	Members []envelope.KeyringMemberV1 `json:"members"`
}
func (k *KeyringSectionV1) GetKeyring() envelope.KeyringInf {
	return k.Keyring
}
func (k *KeyringSectionV1) KeyringVersion() int {
	return k.Keyring.Body.KeyringVersion
}
func (k *KeyringSectionV1) FindMember(id *identity.ID) (*primitive.KeyringMember, *primitive.MEKShare, error) {
	var krm *primitive.KeyringMember
	var mekshare *primitive.MEKShare
	for _, m := range k.Members {
		if *m.Body.OwnerID == *id {
			krm, mekshare = convertV1KRM(&m)
			break
		}
	}
	if krm == nil {
		return nil, nil, ErrMemberNotFound
	}
	return krm, mekshare, nil
}
func (k *KeyringSectionV1) FindMEKByKeyID(id *identity.ID) (*primitive.MEKShare, error) {
	var mekshare *primitive.MEKShare
	for _, m := range k.Members {
		if *m.Body.EncryptingKeyID == *id {
			mekshare = &primitive.MEKShare{
				Key: m.Body.Key,
			}
			break
		}
	}
	if mekshare == nil {
		return nil, ErrMemberNotFound
	}
	return mekshare, nil
}
func convertV1KRM(krm *envelope.KeyringMemberV1) (*primitive.KeyringMember, *primitive.MEKShare) {
	return &primitive.KeyringMember{
			OrgID:           krm.Body.OrgID,
			KeyringID:       krm.Body.KeyringID,
			OwnerID:         krm.Body.OwnerID,
			PublicKeyID:     krm.Body.PublicKeyID,
			EncryptingKeyID: krm.Body.EncryptingKeyID,
		}, &primitive.MEKShare{
			Key: krm.Body.Key,
		}
}