Skip to content

writeTarget

writeTarget(grant, nodeKey, group?): WriteTarget

Defined in: derive.ts:682

Everything a delegate needs to write a piece, taken from the grant that delegated it: the group key to record, the group to label it with, and the key to derive its piece key from.

The grant decides what is allowed. A group key grant may write under any group or none; a group grant only under its own group or a group beneath it, and defaults to its own group. A piece grant cannot write at all: its key belongs to one existing piece, and FEE needs a fresh key for every object. Anything else is refused here, before a piece is encrypted under a key its intended readers could never derive.

Parameter Type
grant GrantDescriptor
nodeKey Uint8Array
group? string

WriteTarget

If the grant’s v is present and not 2 (as holdingOf), the grant is a piece grant, the group lies outside the grant’s subtree, or the key is not 32 bytes.