# KeyAuthorization.hash

Computes the hash for an [`KeyAuthorization.KeyAuthorization`](/tempo/reference/KeyAuthorization/types#keyauthorization).

## Imports

:::code-group
```ts [Named]
import { KeyAuthorization } from 'ox/tempo'
```

```ts [Entrypoint]
import * as KeyAuthorization from 'ox/tempo/KeyAuthorization'
```
:::

## Examples

```ts twoslash
import { KeyAuthorization } from 'ox/tempo'
import { Value } from 'ox'

const authorization = KeyAuthorization.from({
  address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
  chainId: 4217n,
  expiry: 1234567890,
  type: 'secp256k1',
  limits: [
    {
      token: '0x20c0000000000000000000000000000000000001',
      limit: Value.from('10', 6)
    }
  ]
})

const hash = KeyAuthorization.hash(authorization) // [!code focus]
```

## Definition

```ts
function hash(
  authorization: KeyAuthorization.KeyAuthorization,
): Hex.Hex
```

**Source:** [src/tempo/KeyAuthorization.ts](https://github.com/wevm/ox/blob/main/src/tempo/KeyAuthorization.ts#L1190)

## Parameters

### authorization

* **Type:** `KeyAuthorization.KeyAuthorization`

The [`KeyAuthorization.KeyAuthorization`](/tempo/reference/KeyAuthorization/types#keyauthorization).

#### authorization.account

* **Type:** `abitype_Address`

Account address this authorization is bound to.

#### authorization.address

* **Type:** `abitype_Address`

Address derived from the public key of the key type.

#### authorization.chainId

* **Type:** `bigintType`

Chain ID for replay protection.

#### authorization.expiry

* **Type:** `numberType`
* **Optional**

Unix timestamp when key expires (undefined = never expires).

#### authorization.isAdmin

* **Type:** `boolean`

Whether this authorization provisions an admin access key.

#### authorization.limits

* **Type:** `readonly TokenLimit[]`
* **Optional**

TIP20 spending limits for this key.

#### authorization.scopes

* **Type:** `readonly Scope[]`
* **Optional**

Call scopes restricting which contracts/selectors this key can call.

* `undefined` = unrestricted key (any call allowed)
* `[]` = scoped mode with no calls allowed
* `[...]` = only listed contract+selector combinations allowed

#### authorization.signature

* **Type:** `SignatureEnvelope`
* **Optional**

#### authorization.type

* **Type:** `"secp256k1" | "p256" | "webAuthn"`

Key type. (secp256k1, P256, WebAuthn).

#### authorization.witness

* **Type:** `0x${string}`
* **Optional**

Optional 32-byte witness bound into the signing hash.

Applications use this to bind a single signature to an arbitrary offchain
context (e.g. a server-issued challenge), or as a revocation handle that
can be burned onchain to invalidate the authorization before submission.

[TIP-1053 Specification](https://tips.sh/1053)

## Return Type

The hash.

`Hex.Hex`
