# Function: onePerKey()

```ts
function onePerKey(
   secret, 
   collection, 
   onePer, 
   record
): Promise<string | null>;
```

Defined in: [packages/core/src/records/rules.ts:90](https://github.com/leifriksheim/minca/blob/main/core/src/records/rules.ts#L90)

The key a record must have under `onePer`, or null when something it names
is missing (no such link, no such field). With `@author` among the parts,
an owned key of the author's (`records/key.ts`), so no one else can write
its first version; without, a shared `one:` key.

## Parameters

| Parameter | Type |
| ------ | ------ |
| `secret` | `CryptoKey` |
| `collection` | `string` |
| `onePer` | readonly `string`[] |
| `record` | \{ `body`: `unknown`; `links`: readonly [`Link`](https://minca.dev/api/core/interfaces/Link.md)[]; `root`: `string`; \} |
| `record.body` | `unknown` |
| `record.links` | readonly [`Link`](https://minca.dev/api/core/interfaces/Link.md)[] |
| `record.root` | `string` |

## Returns

`Promise`\<`string` \| `null`\>
