[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/protocol](https://jsprismarine.dev/api/@jsprismarine/protocol/index.md) / Skin

# Class: Skin

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:250](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L250)

The client's `SerializedSkin` data: image, cape, geometry, animations, and persona metadata.
JWT fields are decoded here and the protocol layout writes the resulting values to the player
list. Geometry and animation documents remain opaque strings for the client to interpret.

## Constructors

### Constructor

> **new Skin**(): `Skin`

#### Returns

`Skin`

## Properties

### fullId

> **fullId**: `string`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:274](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L274)

Full skin ID, computed because
not sent on JWT.

***

### isTrusted

> **isTrusted**: `boolean` = `true`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:275](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L275)

## Methods

### getAnimationData()

> **getAnimationData**(): `string`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:563](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L563)

#### Returns

`string`

***

### getAnimations()

> **getAnimations**(): `Set`\<[`SkinAnimation`](https://jsprismarine.dev/api/@jsprismarine/protocol/classes/SkinAnimation.md)\>

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:559](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L559)

#### Returns

`Set`\<[`SkinAnimation`](https://jsprismarine.dev/api/@jsprismarine/protocol/classes/SkinAnimation.md)\>

***

### getArmSize()

> **getArmSize**(): `string`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:583](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L583)

#### Returns

`string`

***

### getCape()

> **getCape**(): [`SkinCape`](https://jsprismarine.dev/api/@jsprismarine/protocol/classes/SkinCape.md)

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:615](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L615)

#### Returns

[`SkinCape`](https://jsprismarine.dev/api/@jsprismarine/protocol/classes/SkinCape.md)

***

### getColor()

> **getColor**(): `string`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:579](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L579)

#### Returns

`string`

***

### getFullId()

> **getFullId**(): `string`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:534](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L534)

#### Returns

`string`

***

### getGeometry()

> **getGeometry**(): `string`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:591](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L591)

#### Returns

`string`

***

### getGeometryDataEngineVersion()

> **getGeometryDataEngineVersion**(): `string`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:596](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L596)

The `GeometryDataMinEngineVersion` string; `0.0.0` for a skin built from login data.

#### Returns

`string`

***

### getId()

> **getId**(): `string`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:530](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L530)

#### Returns

`string`

***

### getImage()

> **getImage**(): [`SkinImage`](https://jsprismarine.dev/api/@jsprismarine/protocol/classes/SkinImage.md)

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:555](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L555)

#### Returns

[`SkinImage`](https://jsprismarine.dev/api/@jsprismarine/protocol/classes/SkinImage.md)

***

### getPersonaData()

> **getPersonaData**(): [`SkinPersona`](https://jsprismarine.dev/api/@jsprismarine/protocol/classes/SkinPersona.md)

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:587](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L587)

#### Returns

[`SkinPersona`](https://jsprismarine.dev/api/@jsprismarine/protocol/classes/SkinPersona.md)

***

### getPlayFabId()

> **getPlayFabId**(): `string`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:538](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L538)

#### Returns

`string`

***

### getProfileHash()

> **getProfileHash**(): `string`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:611](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L611)

The wire's `ProfileHash` string; empty for a skin built from login data.

#### Returns

`string`

***

### getResourcePatch()

> **getResourcePatch**(): `string`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:551](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L551)

#### Returns

`string`

***

### isCapeOnClassicSkin()

> **isCapeOnClassicSkin**(): `boolean`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:575](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L575)

#### Returns

`boolean`

***

### isPersona()

> **isPersona**(): `boolean`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:567](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L567)

#### Returns

`boolean`

***

### isPremium()

> **isPremium**(): `boolean`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:571](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L571)

#### Returns

`boolean`

***

### isPrimaryUser()

> **isPrimaryUser**(): `boolean`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:601](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L601)

The wire's `IsPrimaryUser` flag. False for a skin built from login data.

#### Returns

`boolean`

***

### networkSerialize()

> **networkSerialize**(`stream`, `layout?`): `void`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:389](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L389)

Writes the skin as protocol 2193 carries it.

The layout had drifted years out of date - it was still the 748-era shape, which is
exactly the sort of thing that only shows up against a real client, because this
server's own client decoded it with the same stale reader. Checked field for field
against gophertunnel's `protocol/skin.go` and against the bytes protocol 2193's pinned
Bedrock Dedicated Server puts on the wire. What was wrong:

- The animation, persona-piece and tint counts were fixed 32-bit little-endian ints;
  they are unsigned varints, like every other list.
- The arm size was a string; it is a single byte (`slim` 0, `wide` 1).
- The skin color was a string; it is four bytes, B, G, R, A.
- The tail was missing two fields the client reads: `trusted`, sent as the string
  `"true"`/`"false"`, and a profile hash string. Without them the entry after this one
  in the player list is read from the wrong place, and the client drops the join.

The persona branch was missed by that pass and found the same way, by a 1.26.51 client
with a character-creator skin dropping the join with `InitialConnection-90` (#2582).
A piece's type and pack id went out as strings; the type is a uint32 and the pack id a
16-byte UUID. A tint's colors went out as a counted list of strings; they are exactly
four colors of four bytes each, with no count, under the piece type's lower-case member
name (`facialhair`, not the client data's `facial_hair`; see `PIECE_TYPE_NAMES_2193`).

#### Parameters

##### stream

[`BinaryStream`](https://jsprismarine.dev/api/@jsprismarine/binaryutils/classes/BinaryStream.md)

##### layout?

[`SkinWireLayout`](https://jsprismarine.dev/api/@jsprismarine/protocol/index.md#skinwirelayout) = `SKIN_WIRE_2193`

#### Returns

`void`

***

### overridesAppearance()

> **overridesAppearance**(): `boolean`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:606](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L606)

The wire's `OverridesPlayerAppearance` flag. True for a skin built from login data.

#### Returns

`boolean`

***

### setPlayFabId()

> **setPlayFabId**(`playFabId`): `void`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:547](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L547)

Puts the PlayFab id back on a skin read under the 2225 layout, where it arrived on the
enclosing player list entry rather than inside the skin.

#### Parameters

##### playFabId

`string`

the id the entry carried.

#### Returns

`void`

***

### fromJWT()

> `static` **fromJWT**(`jwt`): `Skin`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:283](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L283)

Loads a skin from a JSON file containing skin data
using minecraft bedrock login fields.

(loads the skin persona)

#### Parameters

##### jwt

[`JWT`](https://jsprismarine.dev/api/@jsprismarine/protocol/index.md#jwt)

#### Returns

`Skin`

***

### networkDeserialize()

> `static` **networkDeserialize**(`stream`, `layout?`): `Skin`

Defined in: [protocol/src/bedrock/wire/structures/skin/Skin.ts:472](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/skin/Skin.ts#L472)

Reads a skin as protocol 2193 carries it, field for field the inverse of
[networkSerialize](#networkserialize).

Wire values are stored the way the client data would have given them, so a skin read
here and written again produces the same bytes: the arm size byte becomes `slim` or
`wide`, colors become `#aarrggbb`, and a piece's pack id becomes its UUID string. Persona
piece types are kept by their wire name (`body`, `hands`), which the writer accepts as it
is. A piece type above the known range reads as `unknown`. The persona pieces and tints
arrive before the `IsPersona` flag, so they are read for every skin and kept only when
the flag is set. `TrustedSkinFlag` is compared case-insensitively: the docs spell it
`"True"`, gophertunnel writes `true`.

#### Parameters

##### stream

[`BinaryStream`](https://jsprismarine.dev/api/@jsprismarine/binaryutils/classes/BinaryStream.md)

##### layout?

[`SkinWireLayout`](https://jsprismarine.dev/api/@jsprismarine/protocol/index.md#skinwirelayout) = `SKIN_WIRE_2193`

#### Returns

`Skin`
