{"version":3,"file":"VaultPolicy.mjs","names":[],"sources":["../../src/models/VaultPolicy.ts"],"sourcesContent":["/**\n * Vault Policy Models\n *\n * Describes access policies for vaults\n */\n\nimport type { PolicyMode } from './VaultHeader'\n\nexport interface VaultPolicyDescriptor {\n  mode: PolicyMode\n  participants?: string[] // DIDs for any-of\n  threshold?: number // t for threshold\n  totalShares?: number // n for threshold\n  allParticipants?: string[] // DIDs for all-of\n  passphrase?: boolean // Indicates passphrase-protected\n}\n\nexport interface ParticipantInfo {\n  did: string\n  connectionId?: string\n  kid?: string // Key identifier\n  publicKey?: Uint8Array // For KEM-based policies\n}\n\n/**\n * Policy validation\n */\nexport function validatePolicy(policy: VaultPolicyDescriptor): boolean {\n  switch (policy.mode) {\n    case 'passphrase':\n      return policy.passphrase === true\n\n    case 'any-of':\n      return !!policy.participants && policy.participants.length > 0\n\n    case 'all-of':\n      return !!policy.allParticipants && policy.allParticipants.length > 0\n\n    case 'threshold':\n      return (\n        !!policy.threshold &&\n        !!policy.totalShares &&\n        policy.threshold > 0 &&\n        policy.threshold <= policy.totalShares\n      )\n\n    default:\n      return false\n  }\n}\n"],"mappings":";;;;AA2BA,SAAgB,eAAe,QAAwC;AACrE,SAAQ,OAAO,MAAf;EACE,KAAK,aACH,QAAO,OAAO,eAAe;EAE/B,KAAK,SACH,QAAO,CAAC,CAAC,OAAO,gBAAgB,OAAO,aAAa,SAAS;EAE/D,KAAK,SACH,QAAO,CAAC,CAAC,OAAO,mBAAmB,OAAO,gBAAgB,SAAS;EAErE,KAAK,YACH,QACE,CAAC,CAAC,OAAO,aACT,CAAC,CAAC,OAAO,eACT,OAAO,YAAY,KACnB,OAAO,aAAa,OAAO;EAG/B,QACE,QAAO"}