@abstraxn/policy-core
v0.1.3
Published
Form DSL types and secure-enclave policy compiler for Abstraxn wallet policies
Downloads
644
Keywords
Readme
@abstraxn/policy-core
Form DSL types and secure-enclave policy compiler for Abstraxn wallet policies.
Pass simple rule objects (CreatePolicyInput). Abstraxn compiles them into policies that run inside a secure enclave at sign time — so your backend, a compromised app server, or even the user session cannot sign a transaction that breaks the rules. Only the wallet owner (by changing or removing the policy) can bypass them.
import {
validateCreatePolicyInput,
buildPoliciesFromForm,
} from '@abstraxn/policy-core';
const input = {
name: 'mainnet-guard',
walletId: 'wallet-abc',
blockchain: 'evm' as const,
chainIds: [1],
enforcement: 'enforced' as const,
rules: {
recipientBlacklist: [
{ addresses: ['0x000000000000000000000000000000000000dead'] },
],
nativeAmountLimits: [{ max: '1000000000000000000' }],
},
};
validateCreatePolicyInput(input);
const enclavePolicies = buildPoliciesFromForm(input);Enforcement modes
| Mode | Meaning |
|------|---------|
| enforced (default) | Installed in the secure enclave. Signing is rejected if the rule is violated. |
| advisory | Stored for your app/UI only — not installed in the enclave. |
See also
Wallet docs: Wallet policies in Abstraxn docs (guides/wallets/wallet-policies).
