Skip to main content

Policy

The root object of a PD-REL policy.

A Policy is a container for rules that define how an asset may be used. It represents a complete rights expression that can be attached to digital assets, smart contracts, or any identifiable resource. Policies are designed to be machine-readable while maintaining human comprehensibility.

Per the PD-REL v1.0 specification: "The root object containing a set of rules and the context in which they apply. A Policy is uniquely identified by a URI (policyURI)."

Examples

// Basic policy allowing usage with attribution
const basicPolicy: Policy = {
policyURI: 'ipfs://QmPolicy123...',
profile: 'PD-REL-v1.0',
target: 'ipfs://QmAsset456...',
rules: [
{
action: 'USE',
effect: 'permit',
duties: [{
type: 'ATTRIBUTION',
value: 'Created by Alice, licensed under PD-REL'
}]
}
]
};

// Complex policy with multiple rules and OR logic
const complexPolicy: Policy = {
policyURI: 'ar://PolicyABC789',
profile: 'PD-REL-v1.0',
legalContract: 'https://legal.example.com/contracts/123',
target: 'caip19:eip155:1/erc1155:0xabc.../42',
logic: 'OR', // Any rule can grant permission
rules: [
{
action: 'TRANSFER',
effect: 'permit',
description: 'NFT holders can transfer',
constraints: [{
type: 'TOKEN_GATED',
value: {
chainId: 1,
contractAddress: '0xNFT...',
minBalance: 1
}
}]
},
{
action: 'TRANSFER',
effect: 'permit',
description: 'Or pay to transfer',
duties: [{
type: 'PAYMENT',
value: {
amount: '100.00',
currency: 'USDC',
recipient: '0xCreator...'
}
}]
},
{
action: 'COMMERCIALIZE',
effect: 'prohibit',
description: 'No commercial use allowed'
}
]
};

// Policy for a collection with mixed permissions
const collectionPolicy: Policy = {
policyURI: 'https://policies.example.com/collection-v2',
profile: 'PD-REL-v1.0',
legalContract: 'ipfs://QmLegal...',
// No default target - each rule specifies its own
rules: [
{
action: 'DISPLAY',
effect: 'permit',
target: 'ipfs://QmImage1...',
description: 'First image can be displayed freely'
},
{
action: 'DISPLAY',
effect: 'permit',
target: 'ipfs://QmImage2...',
description: 'Second image requires payment',
duties: [{
type: 'PAYMENT',
value: { amount: '5.00', currency: 'USD', recipient: 'creator' }
}]
}
]
};

Definition

interface Policy {
/**
* A unique, persistent URI identifying this specific policy. Should ideally point to this policy document on a content-addressed network (e.g., Arweave, IPFS) for immutability and verifiability. This URI serves as the policy's identity and reference point.
*/
policyURI: string;
/**
* The PD-REL profile version this policy conforms to. Currently only 'PD-REL-v1.0' is supported. This field ensures compatibility and proper interpretation of the policy structure.
*/
profile: 'PD-REL-v1.0';
/**
* URI pointing to the full, human-readable legal contract. This contract represents the ultimate source of truth in disputes. The policy is a machine-readable expression of this legal document.
*/
legalContract?: string;
/**
* The default asset identifier that all rules apply to. Can be any URI or identifier format (e.g., IPFS, Arweave, CAIP-19). Individual rules can override this with their own target field. If omitted, each rule must specify its own target.
*/
target?: string;
/**
* The logical operator for evaluating the rules array. - `'AND'` (default): All rules must be satisfied - `'OR'`: At least one rule must be satisfied
*/
logic?: 'AND' | 'OR';
/**
* An array of rules defining the terms of the policy. Must contain at least one rule. Rules define what actions are permitted or prohibited, under what conditions, and with what obligations. The order of rules does not affect evaluation.
*/
rules: Rule[];
}

Properties

policyURI

A unique, persistent URI identifying this specific policy.

Should ideally point to this policy document on a content-addressed network (e.g., Arweave, IPFS) for immutability and verifiability. This URI serves as the policy's identity and reference point.

Type: string

Examples

policyURI: 'ipfs://QmXxx...'     // IPFS content hash
policyURI: 'ar://abc123...' // Arweave transaction ID
policyURI: 'https://policies.example.com/policy/v1' // HTTPS URL

profile

The PD-REL profile version this policy conforms to.

Currently only 'PD-REL-v1.0' is supported. This field ensures compatibility and proper interpretation of the policy structure.

Type: 'PD-REL-v1.0'

legalContract

URI pointing to the full, human-readable legal contract.

This contract represents the ultimate source of truth in disputes. The policy is a machine-readable expression of this legal document.

Type: string

Optional

Examples

legalContract: 'https://legal.example.com/contracts/abc123'
legalContract: 'ipfs://QmLegalDoc...'
legalContract: 'ar://LegalTransaction123'

target

The default asset identifier that all rules apply to.

Can be any URI or identifier format (e.g., IPFS, Arweave, CAIP-19). Individual rules can override this with their own target field. If omitted, each rule must specify its own target.

Type: string

Optional

Examples

target: 'ipfs://QmAsset...'      // IPFS hash
target: 'ar://AssetID...' // Arweave ID
target: 'caip19:eip155:1/erc721:0x06012.../1' // CryptoKitty #1
target: 'https://api.example.com/assets/123' // API resource

logic

The logical operator for evaluating the rules array.

  • 'AND' (default): All rules must be satisfied
  • 'OR': At least one rule must be satisfied

Type: 'AND' | 'OR'

Optional

Examples

// AND logic: User must satisfy all rules
logic: 'AND' // Must have token AND pay fee AND during time window

// OR logic: User can choose how to gain permission
logic: 'OR' // Can either have token OR pay fee OR be whitelisted

rules

An array of rules defining the terms of the policy.

Must contain at least one rule. Rules define what actions are permitted or prohibited, under what conditions, and with what obligations. The order of rules does not affect evaluation.

Type: Rule[]

See Also

Since

Version 1.0.0