Docs/API/createPolicyRegistry

createPolicyRegistry

functionPolicy versioning (HCS-2)

Create an HCS-2 indexed registry topic for policy versions, with an owner-only submit key.

signature
createPolicyRegistry(client: Client, ttl?: number): Promise<string>

The submit key is set to the operator’s key so ONLY the owner can publish policy versions — otherwise anyone could inject a fake policy (e.g. huge caps).

Parameters

NameTypeDescription
clientreqClientHedera operator client (its key becomes the submit key).
ttl= 86400numberHCS-2 cache TTL (seconds), encoded in the topic memo.

Returns

Promise<string>

The new HCS-2 registry topic id.

Example

example
const policyTopicId = await createPolicyRegistry(client);
VERIFIABLE SPEND-CONTROL   ·   ENFORCED ON-CHAIN   ·   AGENTS CAN PAY — NOW THEY CAN’T OVERSPEND   ·   CURB × HEDERA   ·   VERIFIABLE SPEND-CONTROL   ·   ENFORCED ON-CHAIN   ·   AGENTS CAN PAY — NOW THEY CAN’T OVERSPEND   ·   CURB × HEDERA   ·