Remove auto-profile creation and add auth config docs (v0.48.11)
Some checks failed
Go / build-and-release (push) Has been cancelled

- Remove createDefaultProfile() function from nostr.js that auto-created
  placeholder profiles for new users - profiles should not be auto-generated
- Add auth-required configuration caution section to CLAUDE.md documenting
  risks of enabling NIP-42 auth on production relays

Files modified:
- CLAUDE.md: Added auth-required configuration section
- app/web/src/nostr.js: Removed createDefaultProfile and auto-profile logic
- app/web/dist/bundle.js: Rebuilt with changes
- pkg/version/version: v0.48.11

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
woikos
2026-01-10 10:22:56 +01:00
parent e7bc9a4a97
commit 61f6027a64
5 changed files with 21 additions and 62 deletions

View File

@@ -480,14 +480,9 @@ export async function fetchUserProfile(pubkey) {
console.warn("Failed to fetch profile from fallback relays:", error);
}
// 4) No profile found anywhere - create a default profile for new users
console.log("No profile found for pubkey, creating default:", pubkey);
try {
return await createDefaultProfile(pubkey);
} catch (e) {
console.error("Failed to create default profile:", e);
return null;
}
// 4) No profile found anywhere
console.log("No profile found for pubkey:", pubkey);
return null;
}
// Helper to fetch profile from fallback relays
@@ -561,57 +556,6 @@ async function processProfileEvent(profileEvent, pubkey) {
return profile;
}
/**
* Create a default profile for new users
* @param {string} pubkey - The user's public key (hex)
* @returns {Promise<Object>} - The created profile
*/
async function createDefaultProfile(pubkey) {
// Generate name from first 6 chars of pubkey
const shortId = pubkey.slice(0, 6);
const defaultName = `testuser${shortId}`;
// Get the current origin for the logo URL
const logoUrl = `${window.location.origin}/orly.png`;
const profileContent = {
name: defaultName,
display_name: defaultName,
picture: logoUrl,
about: "New ORLY user"
};
const profile = {
name: defaultName,
displayName: defaultName,
picture: logoUrl,
about: "New ORLY user",
pubkey: pubkey
};
// Try to publish the profile if we have a signer
if (nostrClient.signer) {
try {
const event = {
kind: 0,
content: JSON.stringify(profileContent),
tags: [],
created_at: Math.floor(Date.now() / 1000)
};
// Sign and publish using the websocket-auth client
const signedEvent = await nostrClient.signer.signEvent(event);
await nostrClient.publish(signedEvent);
console.log("Default profile published:", signedEvent.id);
} catch (e) {
console.warn("Failed to publish default profile:", e);
// Still return the profile even if publishing fails
}
}
return profile;
}
// Fetch events
export async function fetchEvents(filters, options = {}) {
console.log(`Starting event fetch with filters:`, JSON.stringify(filters, null, 2));