# wrapTo

> **wrapTo**(`recipientPublicKey`, `key`, `input`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Grant`](/reference/filoz/keysmith/interfaces/grant/)\>

Defined in: [wrap.ts:90](https://github.com/FilOzone/synapse-sdk/blob/840d7b2c6263846ac51b7558000e62dd68d33a44/packages/keysmith/src/wrap.ts#L90)

Wrap a node key — a group key, a group's key, or one piece's key — to a recipient.

The descriptor is authenticated, so a grant cannot be relabelled as one
naming a different group key, group or piece. The result is inert without the
recipient's private key, so it can be delivered or stored anywhere.

The grant carries the descriptor in canonical form, whoever built it, and
nothing else: add informational fields to the returned grant if needed.

## Parameters

| Parameter | Type |
| ------ | ------ |
| `recipientPublicKey` | `` `0x${string}` `` |
| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
| `input` | [`GrantDescriptor`](/reference/filoz/keysmith/interfaces/grantdescriptor/) |

## Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Grant`](/reference/filoz/keysmith/interfaces/grant/)\>