Skip to content

deriveGroupKey

deriveGroupKey(signer, ref, options?): Promise<DerivedGroupKey>

Defined in: derive.ts:204

Sign for one group key and derive its key.

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

For a new group key 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 DeriveGroupKeyOptions.

With options.password, the key also depends on that password, so a phished signature alone no longer yields it. Lose the password and the group key is lost: nothing else can recover it. Only a recorded commitment can tell a wrong password from a right one, so reopen a protected group key with both password and commitment, and have the user confirm the password when creating one: a typo there silently roots the group key under the typo.

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 group key descriptor, so an owner writes the same way a delegate does — writeTarget(descriptor, groupKey, group) — with the group key taken from what was actually signed.

Parameter Type
signer TypedDataSigner
ref GroupKeyRef
options? DeriveGroupKeyOptions

Promise<DerivedGroupKey>

Before any signing, if options.password is empty or not well-formed Unicode, or options.commitment is not a commitment in format v2. After signing, 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 (with a password, most often a wrong password).