> ## Documentation Index
> Fetch the complete documentation index at: https://trust-link-tsn.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# decodeTinsIdentityRegistry — Decode TIN registry bytes

> Decode a serialized TIN identity registry account into typed identity, social-link, and sensitive-field records.

## What it does

This pure decoder reads the binary account layout returned by Solana and converts it into a `TinIdentityRegistry` object. It performs no network request and no transaction.

## How the flow works

<Steps>
  <Step title="Caller invokes the function">The caller supplies the raw account data bytes.</Step>
  <Step title="Validation">The decoder reads the fixed header, strings, counts, and variable-length byte fields; truncated optional data is rejected.</Step>
  <Step title="Main work">It decodes identity metadata, social identities, and sensitive-field records including proof hashes and timestamps.</Step>
  <Step title="Result">The typed registry object is returned for local inspection or presentation.</Step>
</Steps>

## Signature

```ts theme={null}
export function decodeTinsIdentityRegistry(data: Uint8Array): TinIdentityRegistry
```

<ParamField path="data" type="Uint8Array" required>Serialized TIN identity registry account data.</ParamField>

## Result and errors

Returns `TinIdentityRegistry`, including `version`, `status`, `tin`, `authority`, `name`, `socialIdentities`, and `sensitiveFields`. It throws `TIP identity registry data is truncated` when optional data ends before its count field.

```ts theme={null}
const registry = decodeTinsIdentityRegistry(account.data);
```

Source: [`tins.ts:1183-1260`](https://github.com/Trustlink-Labs/TSN-Protocol/blob/main/tsn-protocol/sdks/tsn-sdk/src/tins.ts#L1183-L1260)
