@aap-protocol/sdk
v0.1.0
Published
Agent Accountability Protocol — TypeScript SDK
Maintainers
Readme
@aap-protocol/sdk
Agent Accountability Protocol — TypeScript SDK
npm install @aap-protocol/sdkimport { generateKeyPair, createIdentity, createAuthorization, Level,
PhysicalWorldViolation, AuditChain } from '@aap-protocol/sdk';
const supervisor = generateKeyPair();
const agent = generateKeyPair();
const identity = createIdentity('aap://acme/worker/[email protected]',
['write:files'], agent, supervisor, 'did:key:z6Mk');
const auth = createAuthorization(identity.id, Level.SUPERVISED,
['write:files'], false, supervisor, 'did:key:z6Mk');
// Physical World Rule — Level 4 on physical node → PhysicalWorldViolation
try {
createAuthorization('aap://factory/robot/[email protected]',
Level.AUTONOMOUS, ['move:arm'], true, supervisor, 'did:key:z6Mk');
} catch (e) { /* AAP-003 */ }
const chain = new AuditChain();
chain.append(identity.id, 'write:file', 'success', 'prov-1', agent, auth.level, false);
const { valid, count } = chain.verify(); // valid=true, count=1License: MIT
