// Identity configures libp2p to use the given private key to identify itself.
768348
func Identity(sk crypto.PrivKey) Option {
	return func(cfg *Config) error {
		if cfg.PeerKey != nil {
			return fmt.Errorf("cannot specify multiple identities")
		}

		cfg.PeerKey = sk
		return nil
	}
}
482454
func NewIdentityKeyPairFromKeys(priv, pub []byte) *IdentityKeyPair {
	return &IdentityKeyPair{
		PublicKey:  IdentityKey{*NewECPublicKey(pub)},
		PrivateKey: *NewECPrivateKey(priv),
	}
}
973794
func (m Member) Identity() string {
	// Read the identity from the labels
	identity, set := m.Label(membership.IdentityLabelKey)
	if set {
		return identity
	}

	// return the member's address if there is no identity set
	return m.Address
}
1350543
func (ed *eventDescriptor) setIdentity(identity uint32) {
	ed.id = uint16(identity)
	ed.version = uint8(identity >> 16)
}
466648
func (s *ListRecordsInput) SetIdentityId(v string) *ListRecordsInput {
	s.IdentityId = &v
	return s
}
956929
func (m *Machine) SetIdentity(id string) {
	m.Lock()
	defer m.Unlock()

	m.identity = id
}
269300
func (n *Node) SetIdentity(identity string) error {
	return n.memberlist.SetLocalLabel(membership.IdentityLabelKey, identity)
}
1005809
func identity(N int) []float64 {
	var results []float64
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			if j == i {
				results = append(results, 1)
			} else {
				results = append(results, 0)
			}
		}
	}
	return results
}
1357804
func (s *LookupDeveloperIdentityInput) SetIdentityId(v string) *LookupDeveloperIdentityInput {
	s.IdentityId = &v
	return s
}
288712
func (s *GetEmailIdentityOutput) SetIdentityType(v string) *GetEmailIdentityOutput {
	s.IdentityType = &v
	return s
}
714643
func WithPrivateKey(key []byte) SigningIdentityOption {
	return func(o *IdentityOption) error {
		o.PrivateKey = key
		return nil
	}
}
111897
func (e *Endpoint) SetIdentity(identity *identityPkg.Identity) {

	// Set a boolean flag to indicate whether the endpoint has been injected by
	// Istio with a Cilium-compatible sidecar proxy.
	istioSidecarProxyLabel, found := identity.Labels[k8sConst.PolicyLabelIstioSidecarProxy]
	e.hasSidecarProxy = found &&
		istioSidecarProxyLabel.Source == labels.LabelSourceK8s &&
		strings.ToLower(istioSidecarProxyLabel.Value) == "true"

	oldIdentity := "no identity"
	if e.SecurityIdentity != nil {
		oldIdentity = e.SecurityIdentity.StringID()
	}

	// Current security identity for endpoint is its old identity - delete its
	// reference from global identity manager, add add a reference to the new
	// identity for the endpoint.
	identitymanager.RemoveOldAddNew(e.SecurityIdentity, identity)
	e.SecurityIdentity = identity

	// Clear selectorPolicy. It will be determined at next regeneration.
	e.selectorPolicy = nil

	// Sets endpoint state to ready if was waiting for identity
	if e.GetStateLocked() == StateWaitingForIdentity {
		e.SetStateLocked(StateReady, "Set identity for this endpoint")
	}

	// Whenever the identity is updated, propagate change to key-value store
	// of IP to identity mapping.
	e.runIPIdentitySync(e.IPv4)
	e.runIPIdentitySync(e.IPv6)

	if oldIdentity != identity.StringID() {
		e.getLogger().WithFields(logrus.Fields{
			logfields.Identity:       identity.StringID(),
			logfields.OldIdentity:    oldIdentity,
			logfields.IdentityLabels: identity.Labels.String(),
		}).Info("Identity of endpoint changed")
	}
	e.UpdateLogger(map[string]interface{}{
		logfields.Identity: identity.StringID(),
	})
}
51669
func (s *ListIdentityPoliciesInput) SetIdentity(v string) *ListIdentityPoliciesInput {
	s.Identity = &v
	return s
}
833684
func IsIdentityConfigFullyOverridden(c *IdentityConfigOptions) bool {
	return !anyNil(c.client, c.caConfig, c.caServerCerts, c.caClientKey, c.caClientCert, c.caKeyStorePath, c.credentialStorePath)
}
1143184
func (s *session) SetIdentity(sessionType apitypes.SessionType, identity, auth envelope.Envelope) error {
	s.mutex.Lock()
	defer s.mutex.Unlock()

	err := checkSessionType(sessionType, identity, auth)
	if err != nil {
		return err
	}

	s.identity = identity
	s.auth = auth

	return nil
}
883214
func NewIdentity(ID peer.ID, addr ma.Multiaddr, privk ci.PrivKey, pubk ci.PubKey) Identity {
	return &identity{PeerNetParams{ID: ID, Addr: addr, PrivKey: privk, PubKey: pubk}}
}
1094545
func WithIdentityConfig(identityConfigs ...interface{}) Option {
	return func(opts *options) error {
		c, err := mspImpl.BuildIdentityConfigFromOptions(identityConfigs...)
		if err != nil {
			return err
		}
		opts.IdentityConfig = c
		return nil
	}
}