nips icon indicating copy to clipboard operation
nips copied to clipboard

Code snippet license

Open Aspie96 opened this issue 1 month ago • 2 comments

Currently the license tag of kind:1337 code snippets in NIP-C0 is specified to contain a reference to the license of the script.

No clue is given, however, as to how this must be written.

I suggest, for licenses that have a SPDX identifier, that the value of the license tag should be the SPDX identifier. When multiple licenses need to be written in OR (such as "MIT OR Apache-2.0"), indicating dual licensing (the user can use the script under the terms of either license of choice), this should be done through two license tags. This is useful for searching: a script dual-licensed under the MIT and the Apache 2.0 license should be found by all users who are looking for scripts under the MIT license as well as those looking for scripts under the Apache 2.0 license, since, in dual licensing, the user is allowed to ignore the license they do not pick.

Also consider that not all licenses have a SPDX identifier. In addition, there are many version of some licenses (for example, there are multiple variants of the MIT license). I suggest that an optional parameter should be allowed for the license tag, containing a link to the actual text of the license.

Aspie96 avatar Nov 24 '25 04:11 Aspie96

Yes, can you open a PR modifying the NIP text to mention the SPDX thing and the possibility of dual licenses?

Another option is to get rid of the "license" tag and write in the NIP that all code snippets are licensed to the public domain automatically.

fiatjaf avatar Nov 24 '25 14:11 fiatjaf

Thanks. Before I do, I'd like to comment on this point.

Another option is to get rid of the "license" tag and write in the NIP that all code snippets are licensed to the public domain automatically.

I see a few issues with it.

One is that old events already exist with the license tag, so users shouldn't rely on the fact that the events they find are in the public domain.

But even for new events, consider that NIPs aren't laws and that the law, almost anywhere, is maximal copyright protection by default. Licenses don't impose restrictions, they allow what would otherwise be forbidden.

Now, I am not a lawyer. If we wrote in the NIP that code snippets are in the public domain, does that make it so? I don't know, I guess it would depend on whether, in practice, it can be expected that the author of the snippet willingly placed in the public domain. If Nostr were a centralized platforms, this could be achieved through its TOS and an interface which makes placing all snippets in the public domain clearly intentional. Since it isn't, I don't know what the general expectation would be.

I think an explicit "license" tag is more clearly intentional, and thus reliable, unless clients just start attaching licenses without prompting the user, but at that point those clients would just be misbehaving and there isn't much I can do about it. Users should use better clients.

I would, of course, like for snippets to be in the public domain, but it seems to me that attempting to make it a silent default could bring legal risks for those receiving those scripts.

In addition, the option of posting a script without releasing it in the public domain allows posting third-party scripts, or ones that one, for some reason, cannot place in the public domain.

Aspie96 avatar Nov 25 '25 05:11 Aspie96