# keyspaceKeys

> **keyspaceKeys**(`signer`, `ref`, `options?`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyspaceKeys`](/reference/filoz/keysmith/interfaces/keyspacekeys/)\>

Defined in: [derive.ts:131](https://github.com/FilOzone/synapse-sdk/blob/68e30a2a5457180e60a5579eb5ecff90b65894b3/packages/keysmith/src/derive.ts#L131)

Sign for one keyspace and derive its key.

The signature is the root secret, and it never leaves this function: the
caller gets the keyspace key and the public commitment, and has nothing
else to guard.

For a new keyspace this signs twice and compares, which catches a
non-deterministic signer before any data depends on it, at the cost of a second
wallet prompt. For an existing one, pass the commitment its dataset records
(`foc/kc`): it signs once, and the commitment catches the same faults. See
[KeyspaceKeysOptions](/reference/filoz/keysmith/interfaces/keyspacekeysoptions/).

Only the owner's own wallet can sign: a key signed by any other wallet,
a session key included, is not the key the owner's wallet derives, and
nothing downstream could tell. Delegates receive a grant instead.

The result carries the keyspace descriptor, so an owner writes the same way
a delegate does — `writeTarget(descriptor, kk, scope)` — with the keyspace
taken from what was actually signed.

## Parameters

| Parameter | Type |
| ------ | ------ |
| `signer` | [`TypedDataSigner`](/reference/filoz/keysmith/interfaces/typeddatasigner/) |
| `ref` | [`KeyspaceRef`](/reference/filoz/keysmith/interfaces/keyspaceref/) |
| `options` | [`KeyspaceKeysOptions`](/reference/filoz/keysmith/interfaces/keyspacekeysoptions/) |

## Returns

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

## Throws

If the signer is not deterministic, is not the owner, does not produce an ECDSA signature,
or derives a key that does not match `options.commitment`.