Delegation

v0.1.0

Grant scoped access to others: "I trust you to do X until time Y." Least-privilege by default.

Typescript

bash
npm install @human/client-sdk

Grant

Grant a delegation

Revoke

Revoke a delegation

List

List delegations

Verify

Verify delegation token

Types

typescript
interface Delegation {
/** Unique delegation ID (branded DelegationId) */
delegation_id: DelegationId;
/** Grantor passport ID (who grants access) */
from_passport_id: PassportId;
/** Grantee passport ID (who receives access) */
to_passport_id: PassportId;
/** Scopes granted */
scopes: string[];
/** When delegation expires */
expires_at?: Timestamp;
/** Whether delegation is active */
is_active: boolean;
/** When delegation was revoked (if applicable) */
revoked_at?: Timestamp;
}
interface GrantDelegationRequest {
/** Passport ID granting access */
from_passport_id: PassportId;
/** Passport ID receiving access */
to_passport_id: PassportId;
/** Scopes to grant */
scopes: string[];
/** Optional expiration date */
expires_at?: string;
/** Optional metadata */
metadata?: Record<string, string | number | boolean>;
}
interface DelegationListFilters {
/** Filter by grantor */
from_passport_id?: PassportId;
/** Filter by grantee */
to_passport_id?: PassportId;
/** Filter by active status */
is_active?: boolean;
}
interface DelegationVerificationResult {
/** Whether delegation is valid */
valid: boolean;
/** Delegation details if valid */
delegation?: Delegation;
/** Reason if invalid */
reason?: string;
}