Skip to content

PolicyGatedSigner

Defined in: src/signer/types.ts:155

A signer that signs an EIP-3009 PaymentIntent iff owner policy approves it, with a first-class, type-visible EnforcementLevel.

E is covariant (it appears only in the readonly enforcement output position), so PolicyGatedSigner<"advisory"> is not assignable to PolicyGatedSigner<NonBypassableEnforcement> — the basis of the type-gate.

Example

import { createLocalPolicyGatedSigner } from "kawasekit/signer";
import { requireNonBypassable } from "kawasekit/signer";
const local = createLocalPolicyGatedSigner({ account, policy, asset, acknowledgeAdvisory: true });
// local: PolicyGatedSigner<"advisory">
// A bounded flow demands non-bypassable enforcement:
// requireNonBypassable(local); // ✗ compile error — "advisory" not assignable
const result = await local.sign(intent);
if (result.ok) {
// result.signature is a valid EIP-3009 authorization
} else {
console.warn(`payment refused: ${result.rejection.reason}`);
}

Type Parameters

E

E extends EnforcementLevel = EnforcementLevel

Properties

enforcement

readonly enforcement: E

Defined in: src/signer/types.ts:157

First-class, visible enforcement strength. Covariant in E (drives the type-gate).


from

readonly from: `0x${string}`

Defined in: src/signer/types.ts:159

The EOA whose authorization this signer produces; intent.from must equal this.

Methods

describe()

describe(): SignerDescription

Defined in: src/signer/types.ts:163

Non-secret description for audit/telemetry.

Returns

SignerDescription


sign()

sign(intent): Promise<SignResult>

Defined in: src/signer/types.ts:161

Sign iff owner policy approves the decoded intent; never throws on a policy denial.

Parameters

intent

PaymentIntent

Returns

Promise<SignResult>