# @provenanceauth/rails/mandates

@provenanceauth/rails/mandates in the Rails: 4 methods. `@provenanceauth/rails/mandates`, checking another agent's authority.

## Methods

### [grantHolderJkt](https://provenanceauth.com/docs/sdks/rails/mandates/grant-holder-jkt.md)

```ts
grantHolderJkt(payload: Record<string, unknown>): string | null | "malformed"
```

The grant's `cnf.jkt`: null for a bearer grant, `"malformed"` for a `cnf` we can't use (fails closed).

### [holderReason](https://provenanceauth.com/docs/sdks/rails/mandates/holder-reason.md)

```ts
holderReason(token: string, jkt: string, holder: MandateHolder | undefined, nowMs: number): Promise<MandateReason | null>
```

The holder check on a bound grant: null when it holds, else the reason.

### [needFits](https://provenanceauth.com/docs/sdks/rails/mandates/need-fits.md)

```ts
needFits(authority: MandateAuthority, need: MandateNeed | undefined): MandateReason | null
```

Does `need` fit `authority`?

### [verifyMandate](https://provenanceauth.com/docs/sdks/rails/mandates/verify-mandate.md)

```ts
verifyMandate(token: string, opts: { jwks: Jwks; need?: MandateNeed; online?: boolean; apiBase?: string; fetch?: typeof fetch; now?: number; holder?: MandateHolder }): Promise<MandateVerifyResult>
```

Check another agent's mandate token: signature (our JWKS), expiry, `need` against its limits, and, with `online: true`, the keyless status (`apiBase` is our API, e.g.
