GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||
GeezerVison is showing developer.litprotocol.com — Groups - Documentation Can this action use this key? A group is how your account answers that question. Here is one concrete case. Usage key K has execute permission in group 7. Group 7 lists the action QmABC and the PKP pkp_001. When K sends the code whose CID is QmABC, the action runs, and it may sign with pkp_001. If K sends different code, the CID is different and the request is refused. If the action asks for a PKP that group 7 doesn’t list, that call fails.
The group holds the actions and the PKPs. The permission to use a group lives on the usage key, as a scope that names the group. Every request checks both:
Every request takes this path. A group answers “Can this action use this PKP?” A usage key’s scopes answer “Can this caller use this group?” A wildcard key (execute_in_groups: [0]) passes the first check for any code, but it still needs a group to use a PKP.
What is a Group?A group is the core organizing unit in Lit Chipotle. It binds together three things:
Why Groups ExistWithout groups, every usage key would have access to every wallet and every action in your account. Groups let you:
How Groups Connect to Everything
Common PatternsOne group per dAppAll-access key for developmentCreate a usage key withexecute_in_groups: [0] (wildcard). This key can run arbitrary action code, including code pasted into the Dashboard Action Runner, without registering a CID or creating a group.
Execution permission and PKP wallet permission are separate. If the action requests a PKP private key or uses PKP encryption/decryption, a group in the key’s own account must permit both the action CID and the requested wallet. They must match the same group. Wildcard execution skips the individual group grants on the key; it does not skip this resource check or grant access to another account’s wallets. Group membership is not proof of wallet ownership: listing a foreign wallet address can satisfy the group check, but the node separately resolves the wallet in the caller’s account and verifies the derived key’s address before releasing or using it.
For example, console.log("hello") needs no group with a wildcard key. An action using wallet A requires a group containing wallet A and that action’s CID (or the group’s all-actions wildcard). Changing the code changes its CID, so update the permitted CID or deliberately allow all actions for that group.
Use a scoped key when you want to restrict which code can execute. Expired and revoked keys do not gain access through wildcard permissions.
Delegating group managementThe group-management permissions on a usage key (add_pkp_to_groups, remove_pkp_from_groups, manage_ipfs_ids_in_groups) are scoped by group, not by wallet or action. Treat a key holding them as an administrator of those groups:
g combined with execute rights in g, whether held by one key or by two, give effective access to every wallet in the account. This is by design. If some wallets must stay out of a delegate’s reach, keep them in a separate account, or keep wallet membership changes on the account key and give delegates only execute_in_groups.
Updating keys with legacy management grants[0] is a wildcard only in execute_in_groups. It grants no access in manage_ipfs_ids_in_groups, add_pkp_to_groups, or remove_pkp_from_groups. The Dashboard offers All Groups only for execution and labels saved management entries of 0 as no management access. Editing a key preserves saved entries until you change them.
For a key that previously created populated groups using can_create_groups and [0] management grants, use the account key to create and fill the group, or:
execute_in_groups: [0] only if wildcard execution is intended.
The Account Master WalletPOST /new_account creates one wallet for the account, listed as “Account Master Wallet”. It is not an ordinary PKP: the account key is this wallet’s private key, base64-encoded, and the wallet is the account’s admin on chain. Lit Actions run only under usage keys (the account key cannot run actions), so any usage key that could export this wallet’s key would hold the account key.
Lit.Actions.getPrivateKey therefore never returns the private key of the account’s admin wallet or its billing wallet, whatever the key and whatever the groups say: listing the wallet in a group, or the all-wallets entry (zero address), does not change this. The action gets an error instead. Lit.Actions.Encrypt and Lit.Actions.Decrypt still accept the wallet through groups like any other wallet, because they never reveal its key. To sign from an action, create a separate wallet with POST /core/v1/create_wallet and add it to the group. Existing keys, addresses and derivation paths are unchanged.
In a ChainSecured account the admin wallet is the user’s own wallet, which the TEE cannot derive, so the rule only matters if the admin or billing wallet is one of the account’s PKPs. Converting an account to ChainSecured makes the user’s wallet the admin but keeps the original Account Master Wallet as the billing wallet. Its key is still the old account key, which still passes billing-owner checks, so the rule keeps covering it.
Usage-key walletsUsage keys created through the API-modeadd_usage_api_key endpoint also have a backing wallet, initially listed as “API Key Wallet” with description “Usage API Key Wallet”. That wallet’s private key is the usage API credential, base64-encoded. Unlike the account’s admin and billing wallets, usage-key wallets are subject to the ordinary group rules for getPrivateKey.
Granting access to a usage-key wallet can grant access to the credential itself. The all-wallets wildcard includes these wallets, including ones created later. Wallet names and descriptions are labels, not security boundaries.
Shared wallets across groupsA single wallet can belong to multiple groups. This is useful when multiple dApps need to sign with the same address but run different actions.Group Lifecycle
Revocation during a running actionEach PKP private-key request and PKP AES encrypt/decrypt operation checks wallet permission through the shared blockchain cache, including repeated operations in the same action execution. An execution does not retain its first permission decision for its entire lifetime. Revocation is not instantaneous. API mutation hooks and the on-chain account-event listener selectively invalidate affected cache entries; the listener polls every 10 seconds. Cached grants expire after 300 seconds without a hit; each hit renews that window, but never past the calling usage key’s expiration. Cached denials expire 30 seconds after insertion or update, without extension on reads. Both grants and denials are invalidated by relevant events: once a grant event is processed successfully, the next lookup can observe the new permission without waiting for the denial TTL. This is not instantaneous; mining, polling, RPC visibility, and usage-key invalidation affect propagation. A usage key’s expiration emits no event, so it is enforced by the cache itself: when a grant is cached, the server reads the calling key’s expiration from chain and does not serve the grant from cache at or after that time, however often it is used. The next lookup goes back to the chain, which rejects the expired key. The expiration is compared with the server’s clock, which can differ from block timestamps by a few seconds. If the expiration cannot be read, the grant is not cached, and the read is retried after 30 seconds. There is no hard maximum age for a continuously used grant of a key without an expiration. If the listener misses an event or invalidation is incomplete, a hot stale grant can remain usable indefinitely, or until the key expires if it has an expiration. Denials retain their short TTL as a fallback. Once a fresh lookup is required, lookup errors stop the operation rather than falling back to an old grant. Wallet-derivation caching retains its separate fixed five-minute TTL. An operation whose permission check started before invalidation may still finish. Revocation does not erase a private key already returned to action code, terminate the running action, or revoke access granted through another matching group.Permission Flags on GroupsWhen creating a group, two convenience flags control default access:
pkp_ids_permitted and cid_hashes_permitted arrays in the API. On-chain, these flags are not separate booleans: they are encoded using wildcard values in the arrays:
Further Reading
Was this page helpful? | ||||||||||
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |