diff --git a/docker-compose.yml b/docker-compose.yml index 32410ff..9237089 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,6 +47,9 @@ services: RS_REDIS_URL: redis://redis:6379/1 RS_STORAGE_URL: "http://localhost:4567" S3_ENABLED: false + NOSTR_PUBLIC_KEY: bdd76ce2934b2f591f9fad2ebe9da18f20d2921de527494ba00eeaa0a0efadcf + NOSTR_PRIVATE_KEY: 7c3ef7e448505f0615137af38569d01807d3b05b5005d5ecf8aaafcd40323cea + NOSTR_RELAY_URL: "ws://strfry:7777" depends_on: - ldap - redis @@ -123,6 +126,7 @@ services: LDAP_BIND_DN: 'cn=Directory Manager' LDAP_PASSWORD: passthebutter LDAP_SEARCH_DN: 'ou=kosmos.org,cn=users,dc=kosmos,dc=org' + WHITELIST_PUBKEYS: 'bdd76ce2934b2f591f9fad2ebe9da18f20d2921de527494ba00eeaa0a0efadcf' # phpldapadmin: # image: osixia/phpldapadmin:0.9.0 diff --git a/extras/strfry/ldap-policy.ts b/extras/strfry/ldap-policy.ts index 423c74e..03224cf 100644 --- a/extras/strfry/ldap-policy.ts +++ b/extras/strfry/ldap-policy.ts @@ -1,4 +1,4 @@ -import type { Policy } from 'https://gitlab.com/soapbox-pub/strfry-policies/-/raw/develop/mod.ts'; +import type { IterablePubkeys, Policy } from 'https://gitlab.com/soapbox-pub/strfry-policies/-/raw/develop/mod.ts'; import { Client } from 'npm:ldapts'; import { nip57 } from '@nostr/tools'; @@ -7,6 +7,7 @@ interface LdapConfig { bindDN: string; password: string; searchDN: string; + whitelistPubkeys?: IterablePubkeys; } const ldapPolicy: Policy = async (msg, opts) => { @@ -15,6 +16,12 @@ const ldapPolicy: Policy = async (msg, opts) => { let { pubkey } = msg.event; let out = { id: msg.event.id } + if (opts.whitelistPubkeys.includes(pubkey)) { + out['action'] = 'accept'; + out['msg'] = ''; + return out; + } + // Zap receipt if (kind === 9735) { const descriptionTag = tags.find(([t, v]) => t === 'description' && v); diff --git a/extras/strfry/strfry-policy.ts b/extras/strfry/strfry-policy.ts index 15fafe9..8086756 100755 --- a/extras/strfry/strfry-policy.ts +++ b/extras/strfry/strfry-policy.ts @@ -19,6 +19,7 @@ const ldapConfig = { bindDN: Deno.env.get("LDAP_BIND_DN"), password: Deno.env.get("LDAP_PASSWORD"), searchDN: Deno.env.get("LDAP_SEARCH_DN"), + whitelistPubkeys: Deno.env.get("WHITELIST_PUBKEYS")?.split(',') } for await (const msg of readStdin()) {