> ## Documentation Index
> Fetch the complete documentation index at: https://klef.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Principal

> Anything in a target that can hold access.

```csharp
public sealed record Principal : IEquatable<Principal>
```

**Implements:** `IEquatable<Principal>`

## Constructors

```csharp
public Principal()
```

## Properties

**Description** `string`

A line describing it, where a field offers it as a value.

**Fields** `JsonObject` *required*

The declared fields, as the vendor reports them.

**Grants** `IReadOnlyDictionary\<String,FieldGrants\>`

**Type:** `IReadOnlyDictionary<String,FieldGrants>`

What it holds, by entitlement field.

**Id** `string` *required*

The vendor's stable id for it.

**Immutable** `bool` *required*

Whether the vendor keeps who holds it itself, so the host neither grants nor removes it.

**Keys** `IReadOnlyList\<PrincipalKey\>` *required*

**Type:** `IReadOnlyList<PrincipalKey>`

The keys other principals find it by.

**Kind** `string` *required*

The manifest object it belongs to.

**Label** `string` *required*

The name a person knows it by.

**MatchKey** `string`

The handle other systems match it on.

**MatchKeyOrId** `string` *required*

The handle cross-system reads join on.

**References** `IReadOnlyList\<PrincipalReference\>` *required*

**Type:** `IReadOnlyList<PrincipalReference>`

Field values that come from other principals.

**SupersededBy** `PrincipalKey`

The key of the principal replacing it.

**Trait** `PrincipalTrait`

What the vendor reports beyond its fields.

## Methods

### Equals()

```csharp
public bool Equals(Principal? other)
```

#### Parameters

**other** `Principal` *required*

#### Returns

`bool`

```csharp
public override bool Equals(object? obj)
```

#### Parameters

**obj** `object` *required*

#### Returns

`bool`

### GetHashCode()

```csharp
public override int GetHashCode()
```

#### Returns

`int`

### GrantOf()

```csharp
public FieldGrants GrantOf(string key)
```

Gets what it holds on one field.

#### Parameters

**key** `string` *required*

#### Returns

`FieldGrants`

### operator !=()

```csharp
public static bool operator !=(Principal? left, Principal? right)
```

#### Parameters

**left** `Principal` *required*

**right** `Principal` *required*

#### Returns

`bool`

### operator ==()

```csharp
public static bool operator ==(Principal? left, Principal? right)
```

#### Parameters

**left** `Principal` *required*

**right** `Principal` *required*

#### Returns

`bool`

### ToString()

```csharp
public override string ToString()
```

#### Returns

`string`

### With()

```csharp
public Principal With(string key, FieldGrants grant)
```

Returns a copy holding a grant on one field.

#### Parameters

**key** `string` *required*

**grant** `FieldGrants` *required*

#### Returns

`Principal`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.