# readPieceMetadata

> **readPieceMetadata**(`envelopeMetadata`): [`PieceMetadataView`](/reference/filoz/keysmith/interfaces/piecemetadataview/)

Defined in: [derive.ts:466](https://github.com/FilOzone/synapse-sdk/blob/ef6c62c2d5e01c004a5cdb1a12bfa58ab9ee1834/packages/keysmith/src/derive.ts#L466)

Read a piece's envelope metadata (`foc/v` 2: `foc/gkid`, `foc/group`) into one canonical shape.

Takes the metadata as FEE returns it (`info.appMetadata`), unvalidated.

## Parameters

| Parameter | Type |
| ------ | ------ |
| `envelopeMetadata` | [`PieceMetadataV2`](/reference/filoz/keysmith/type-aliases/piecemetadatav2/) \| [`Readonly`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype)\<[`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `unknown`\>\> \| `undefined` |

## Returns

[`PieceMetadataView`](/reference/filoz/keysmith/interfaces/piecemetadataview/)

## Throws

If `foc/v` is not 2 (an envelope from keysmith 0.1.0 is `foc/v` 1, or `foc/ks`), or a field is malformed.