Create an enforcement gate for NIP-5D NAP message handlers.
Unlike createEnforceGate (which resolves identity by pubkey), this factory resolves identity by windowId — necessary for NIP-5D sessions where pubkey is ''.
NAP enforcement configuration
An enforceNap function that resolves identity by windowId and delegates to the ACL check.
const gate = createNapEnforceGate({ checkAcl: aclStore.check, resolveIdentityByWindowId: (wid) => sessionRegistry.getEntryByWindowId(wid), onAclCheck: hooks.onAclCheck,});const result = gate('win-1', 'relay:write', { type: 'relay.publish' });// result.allowed === true | false Copy
const gate = createNapEnforceGate({ checkAcl: aclStore.check, resolveIdentityByWindowId: (wid) => sessionRegistry.getEntryByWindowId(wid), onAclCheck: hooks.onAclCheck,});const result = gate('win-1', 'relay:write', { type: 'relay.publish' });// result.allowed === true | false
Create an enforcement gate for NIP-5D NAP message handlers.
Unlike createEnforceGate (which resolves identity by pubkey), this factory resolves identity by windowId — necessary for NIP-5D sessions where pubkey is ''.