DocumentGrant:delegate
methodDocumentGrant:delegate(opts: documents.GrantOptions) -> DocumentGrantA narrower grant made from this one, without opening the document. Only a grant to a network document delegates. Only this grant's receiver can delegate (bearer grants: anyone holding them). Raises on any attempted widening, and on the last grant a line can hold. Grants made each from the one before form a line that holds eight from a network document documents.create made and seven from a named or communal one; a grant past them could not sync.
local narrower = grant:delegate({
mode = "read",
prefix = "public/",
valid_days = 7,
})
print(narrower:encode())opts documents.GrantOptions options 4 keys
| Key | Type | Default | Description |
|---|---|---|---|
| to | string | a bearer grant: anyone holding the encoded string holds its authority | Receiver identity key the grant is bound to. |
| mode | "read" | "write" | "read" | Never wider than the granting handle's own mode. |
| prefix | string | the granting handle's own subtree | Narrow the grant to this key subtree. |
| valid_days | integer | 30 days; a local grant never expires | Days the grant lasts, counted from an hour before now. It never outlasts the granting handle's own access. |
In the guide: Messages, events and shared state