# findAuthorizers

> **findAuthorizers**(`client`, `options`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`OutputType`](/reference/filoz/synapse-core/session-key/namespaces/findauthorizers/type-aliases/outputtype/)\>

Defined in: [packages/synapse-core/src/session-key/find-authorizers.ts:121](https://github.com/FilOzone/synapse-sdk/blob/5989c4b03ed2fe4cf8b1ef29efe1d4ff1ad4c7bc/packages/synapse-core/src/session-key/find-authorizers.ts#L121)

Find every wallet (identity) that authorized a session key.

Scans `AuthorizationsUpdated` events on the session key registry from `toBlock` back to `fromBlock`,
in windows of `blockRange` blocks, and returns one entry per distinct identity that authorized
`signer`, ordered by its most recent authorization (newest first). Revocations (zero expiry) and
authorizations with no permissions are ignored.

**Treat more than one result as a red flag.** `SessionKeyRegistry.login` needs no consent from the
signer, so any wallet that knows the session key address can authorize it, for instance after seeing
the real authorization on-chain. Another wallet can add an authorization but cannot remove yours, so
for a freshly created key exactly one result is expected. When there are several, do not pick one:
stop, or ask the user which wallet is theirs. Even with one result, show the address to the user to
confirm before binding to it or sending data to the account it controls.

The registry does not index `signer`, so the match happens locally and the whole range is scanned.
Keep `fromBlock` close to the block when the session key was created to limit the number of requests.

The result does not say which permissions are still valid; use [authorizationExpiry](/reference/filoz/synapse-core/session-key/namespaces/authorizationexpiry/toc/) or
[getExpirations](/reference/filoz/synapse-core/session-key/namespaces/getexpirations/toc/) for that.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `client` | `Client`\<`Transport`, `Chain`\> | The client to use to read the logs. |
| `options` | [`OptionsType`](/reference/filoz/synapse-core/session-key/namespaces/findauthorizers/type-aliases/optionstype/) | [findAuthorizers.OptionsType](/reference/filoz/synapse-core/session-key/namespaces/findauthorizers/type-aliases/optionstype/) |

## Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`OutputType`](/reference/filoz/synapse-core/session-key/namespaces/findauthorizers/type-aliases/outputtype/)\>

The wallets that authorized the session key [findAuthorizers.OutputType](/reference/filoz/synapse-core/session-key/namespaces/findauthorizers/type-aliases/outputtype/)

## Throws

Errors [findAuthorizers.ErrorType](/reference/filoz/synapse-core/session-key/namespaces/findauthorizers/type-aliases/errortype/)

## Example

```ts
import { findAuthorizers } from '@filoz/synapse-core/session-key'
import { createPublicClient, http } from 'viem'
import { calibration } from '@filoz/synapse-core/chains'

const client = createPublicClient({
  chain: calibration,
  transport: http(),
})

const authorizers = await findAuthorizers(client, {
  signer: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd',
  fromBlock: 3_000_000n,
})

if (authorizers.length !== 1) {
  throw new Error(`Expected one authorizing wallet, found ${authorizers.length}`)
}
const root = authorizers[0].identity
```