EnglishEspañolPortuguêsالعربيةעבריתفارسیTürkçe
Nostr npubs archive Nostr relays archive
EnglishEspañolPortuguêsالعربيةעבריתفارسیTürkçe
nostr-rs-relay.dev.fedibtc.com
nostr-rs-relay.dev.fedibtc.com

nostr-rs-relay.dev.fedibtc.com

wss://nostr-rs-relay.dev.fedibtc.com

Last Notes

2026-04-05 04:11:58 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[cfg(feature = "nostr")]
use get_file_hash_core::{get_relay_urls, publish_issue, DEFAULT_GNOSTR_KEY, DEFAULT_PICTURE_URL, DEFAULT_BANNER_URL, publish_nostr_event_if_release, get_repo_announcement_event, publish_patch_event};
#[cfg(feature = "nostr")]
#[tokio::main]
async fn main() {
use nostr_sdk::Keys;
use nostr_sdk::EventId;
use std::str::FromStr;
let keys = Keys::generate();
let relay_urls = get_relay_urls();
let d_tag = "my-gnostr-repository-issue-example"; // Repository identifier
let issue_id_1 = "issue-001"; // Unique identifier for the first issue
let issue_id_2 = "issue-002"; // Unique identifier for the second issue
let title_1 = "Bug: Application crashes on startup";
let content_1 = "The application fails to launch on macOS Ventura. It throws a 'Segmentation Fault' error immediately after execution. This was observed on version `v1.2.3`.
Steps to reproduce:
1. Download `app-v1.2.3-macos.tar.gz`
2. Extract the archive
3. Run `./app`
Expected behavior: Application launches successfully.
Actual behavior: Application crashes with 'Segmentation Fault'.";
let title_2 = "Feature Request: Dark Mode";
let content_2 = "Users have requested a dark mode option to improve readability and reduce eye strain during prolonged use. This should be toggleable in the settings menu.
Considerations:
- Adherence to system dark mode settings.
- Consistent styling across all UI components.";
// Dummy EventId for examples that require a build_manifest_event_id
const DUMMY_BUILD_MANIFEST_ID_STR: &str = "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0";
let dummy_build_manifest_id = EventId::from_str(DUMMY_BUILD_MANIFEST_ID_STR).unwrap();
// Example 1: Publish an issue without build_manifest_event_id
println!("Publishing issue '{}' without build_manifest_event_id...", title_1);
publish_issue!(
&keys,
&relay_urls,
d_tag,
issue_id_1,
title_1,
content_1
);
println!("Issue '{}' published.", title_1);
// Example 2: Publish an issue with build_manifest_event_id
println!("Publishing issue '{}' with build_manifest_event_id...", title_2);
publish_issue!(
&keys,
&relay_urls,
d_tag,
issue_id_2,
title_2,
content_2,
Some(&dummy_build_manifest_id)
);
println!("Issue '{}' published.", title_2);
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example publish_issue --features nostr");
}
2026-04-05 04:12:03 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[cfg(feature = "nostr")]
use frost_secp256k1_tr as frost;
#[cfg(feature = "nostr")]
use rand::thread_rng;
#[cfg(feature = "nostr")]
use std::collections::BTreeMap;
/// A simplified ROAST Coordinator that manages signing sessions
#[cfg(feature = "nostr")]
struct RoastCoordinator {
min_signers: u16,
_message: Vec<u8>,
commitments: BTreeMap<frost::Identifier, frost::round1::SigningCommitments>,
nonces: BTreeMap<frost::Identifier, frost::round1::SigningNonces>,
shares: BTreeMap<frost::Identifier, frost::round2::SignatureShare>,
}
#[cfg(feature = "nostr")]
impl RoastCoordinator {
fn new(min_signers: u16, message: &[u8]) -> Self {
Self {
min_signers,
_message: message.to_vec(),
commitments: BTreeMap::new(),
nonces: BTreeMap::new(),
shares: BTreeMap::new(),
}
}
/// ROAST Logic: Collect commitments until we hit the threshold.
/// In a real P2P system, this would be an async stream handler.
fn add_commitment(&mut self, id: frost::Identifier, comms: frost::round1::SigningCommitments, nonces: frost::round1::SigningNonces) {
if self.commitments.len() < self.min_signers as usize {
self.commitments.insert(id, comms);
self.nonces.insert(id, nonces);
}
}
/// ROAST Logic: Collect signature shares.
fn add_share(&mut self, id: frost::Identifier, share: frost::round2::SignatureShare) {
if self.shares.len() < self.min_signers as usize {
self.shares.insert(id, share);
}
}
fn is_ready_to_sign(&self) -> bool {
self.commitments.len() >= self.min_signers as usize
}
fn is_ready_to_aggregate(&self) -> bool {
self.shares.len() >= self.min_signers as usize
}
}
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut rng = thread_rng();
let (max_signers, min_signers) = (5, 3);
let message = b"BIP-64MOD Context: ROAST Coordination";
// 1. Setup: Generate keys (Dealer mode for simulation)
let (key_shares, pubkey_package) = frost::keys::generate_with_dealer(
max_signers,
min_signers,
frost::keys::IdentifierList::Default,
&mut rng,
)?;
let mut coordinator = RoastCoordinator::new(min_signers, message);
// 2. Round 1: Asynchronous Commitment Collection
// Simulate signers 1, 3, and 5 responding first (ROAST skips 2 and 4)
for &id_num in &[1, 3, 5] {
let id = frost::Identifier::try_from(id_num as u16)?;
let (nonces, comms) = frost::round1::commit(key_shares[&id].signing_share(), &mut rng);
// Signers store their nonces locally, send comms to coordinator
coordinator.add_commitment(id, comms, nonces);
// Note: Signer 2 was "offline", but ROAST doesn't care because we hit 3/5.
}
// 3. Round 2: Signing
if coordinator.is_ready_to_sign() {
let signing_package = frost::SigningPackage::new(coordinator.commitments.clone(), message);
let mut temp_shares = BTreeMap::new();
for &id in coordinator.commitments.keys() {
// In reality, coordinator sends signing_package to signers
// Here we simulate the signers producing shares
let nonces = &coordinator.nonces[&id];
let key_package: frost::keys::KeyPackage = key_shares[&id].clone().try_into()?;
let share = frost::round2::sign(&signing_package, &nonces, &key_package)?;
temp_shares.insert(id, share);
}
for (id, share) in temp_shares {
coordinator.add_share(id, share);
}
}
// 4. Finalization: Aggregation
if coordinator.is_ready_to_aggregate() {
let signing_package = frost::SigningPackage::new(coordinator.commitments.clone(), message);
let group_signature = frost::aggregate(
&signing_package,
&coordinator.shares,
&pubkey_package,
)?;
pubkey_package.verifying_key().verify(message, &group_signature)?;
println!("ROAST-coordinated signature verified!");
}
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example roast-experiment --features nostr");
}
2026-04-05 04:11:58 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 2023 <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.
2026-04-05 04:11:58 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
exclude = ["target/**/*.toml", "Cargo.lock"]
[formatting]
align_entries = true
indent_tables = true
reorder_keys = false
[[rule]]
include = ["**/Cargo.toml"]
keys = ["dependencies"]
formatting.reorder_keys = true
2026-04-05 04:11:57 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
�PNG

IHDR�x�� pHYs  ��sRGB���gAMA�� �a"BIDATx��-{]U��Ńa�p qm���ᒺq)� �4�M����:\���ͨ��Q�9�a}��I�^�^{�~�u_e���d��_���Rʬ͛��o�����h���;tH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$�lll�>����_�}�kV���K��o�-��ۋsM��������証|��m�)�ک����Çg�x�bv����|T��{��ZTS�T�5��Ϟ>}:�JP��j�b���C��_���j���X���x�f�_UL ܹs����Toe $���S����/�ڳg���_����6@H$���{�e���������e>P�\>��^�������^�;%}�Q��o���_-@� ����������ɓr��-S��)X����rpp0���э��p� ��k/�X�ד�:!�K�5���$�� �=����X/���X�s��)޸q�G��2*Z��a��*⫂�;��9P�r����>+���/�,�^�*���[�0�ܿ�looN�`|T/���z���,����o��|q���`G����� ���T�O��ѷ�����?B0����_���Ƣ��0���ڧ}k����0�8��3
�`^^�0
�`z���`< ,����7���� O���+FS��``���/�)`x (��� O��� 0 /�qX�`@�~�max�`x �Kj<FW`X $���ǵk�
0��?.#0,"�+FW��` ���'�p��^�Q��;�{ �` ����p��)�h����f|����4�իW�4��˗��rZ"�@��={���` ^N�s�a8 ����qe��0����0��4�'O�� 0�����xL���H�衎G��a 0���]gՏhkk��a@�kV�K���ݻw���va\1����_[o�
�GzxxX�_�^�#^��n�Z,
.�\R��>|��_Y��Ǐ�;w���>��^V��������g����o�>z���3+��~{{{������۷��� ��X�g�9�au\@��!����BNB��"@8�rљ�n��S���g �!V������i�G}T����[g�q��/���t��hM��~������ V���5cJ�� ��"@x�c}���@8���X��r|0���?_����.���,�{�m,V�;�w� � tmggg��/��ч�!#������n9ַo�;��8֗%!��YHW�˛LϬ����$��W]�c}��G+�9���)&oy�o�3�c��޽{�'�3g=�'��yF���L�)���?���,����l��Y\���ެO�>��g��ߟe��u*5�j�b��P��;^�Y.ʛ׼��9{���l��=��~���'B���כ�{W����*un��?�Y�K��k�����3g>�i���J]���X�ά���I�L�2%a&~'���ك���nڿy��PM]�R�����,�%y�Y��D���!��޻w���(�@5u�J�X�p�� �bԠ� s����e� 6�Gd���M�&PM]�RoU�0⅓U�0��5�K'�2����߭��5�j�b��������*?s��!_�oV��YŔN,^\�߾RUS�Ԣb{V�+���x�k�<^��3�='���lq�j���X�f[[[iW��umooW��������G��Uv(5Z5u���mV�>8��8Yq?[���N:�H���[4!��|�|عd���|�3�[��ƍi����
��-H/���0w����h�r��㊏����%���i|vZ�Ԑ��z\�٪a]S�フ���X�QM�X�ZUC�eq�RW��.VuRS;ַFՐ)D�p|p���ԛe ���e>�^2Z.F;>>.�����02�5 ��@�����p���(V��J��ry��e�u�V�Ł�(0
d�Ԑ��fe�=88Hk�6�n9>X����.{)z�Y� �:�:J�����-�E3iEM��;\Ր}`Yv(u�j�bՄʱ��V �����LJ���\M]��Hŋ$�V��^CK`YqXSV����i�5T���-*�zl�s��8>N�TbQ�c}ǭZXV�p��RoUS�-���_5��b]�ŁJ�UM]�j��[�jh=D9>X�?�F{��K&��? �by����^�ȱ�}s|0�`��yss�d���/"�f�!#Y���Ԝ��]�Y��M��U��)�8��/R�8P�TM]�J\��]o�0���`�a5u�*i9�w�UÔ@��Ug��Ū�ۖ��������`�CYȥ�J�X�ۖ2r�/���`z�TbQ9ʱ����^F�'Df�Z��XM]�JP���Y5���&\M]�Zs9�7o��c�r|��bY��9֗^9>�)8W,�����K��55d��V�}��E��j�u
�݊%��}*L�TM]��X��m�j^����U���ŪJ��X�0�c}/S5o��U���Ū
�X�6���r|�j���X5r9ַݪA8��Z+�Xp�/\M ��!����C���Q2�w��b�_lÂ�b����_2Z�󭭭K� W��˱�өL\����.V Xُ��mV-��uW �������j�b�@e����`�����
?�ؽ`q`���Ū+V<��!�����r���@;���.V]��;��A�|e��Xu�r�����j���`�n���.V]�<t������U�j�bՊ�y�_������a���*C9h��޽�8�$�8�/N�{��I����n�\e45\���i&j�Ss�/$'[:>�ukj�B�]1l7o����)-�ϖ�S�T���ʹ���.V�Q���<�h���U�0^eީc��4����y#-��P��۷ӮG� b=L� �85��Zh�� �'LD��g���r����Aζ\�d��G����ݲ��]�Y�h�􇋋�h7F��F ���9 �ve���X��U�5u+����0�j�b��r2��o=U�P���� �[����2Ш����l���{��`@GGG)�͈�q���mn9o���_�a-�f q�Q��8�РX��i%n��0�v�����I<�,
l�Иhh���� ��H[��ɴC`�3����}�YćLbX2J@=� ��6YĈ��?mjf�b�i˟�����rU���\5u��V�� �#͇ ��w�T @��gC�"k���^� m�ͱ��ϲ]fX�Ǒ�Жf�J�5oT�u�C?����j0���s����Nm��4 >��N��(�Wʀע����+�(@;�I+=V̷���~�T Fڨul��2��:���'ak�g��h��X�������m�>>xggg�KHlkk����?L�:C�Q������[jj��iY��u��i 7 �u���>b/��e�-^�1�IN@B�h677KM�}�v��ɓ'k�~���29��P��k����>������G�j��c:�� �N��@�p�(0����k�hr1@2��Ń z@b1`��>�9 ��*�U����/1���S�����������~ЧXXsk�i�|�dj��u4X���\h  ��s�z�зX�Sk ��u�9'�9D���˿�(�i�\�D�]�Vj���j> ,�EH�V��X�A�g�͛7 yI�iY�<x�,���O��r���(j�}� 5�jvv8����`]b1`�g��<�$j-|��QxW�i�Z�:�'$Q��F����k0���D�F�|��N�����CH�V�V��T��ϻZ�<�&$P+�����4��@@����,��@@�;����ŋ�����rxx�����"$P�1���7�i����/^�{{{U��A���~��� 01��� @C�E��� !��t�$�E�)�����|پ��$/Շ�����s�q�bM���E�����M}G=�$�5 ����x ���ݻ�{����-c�±����[o���xy޹s��,g�lmm�P�䬟�@���@~˗KC��o�[�ψ� �{KX���8l����j=#l7�AH��p��^�k�s�L�v�ڵR�)��j�a ��=�~b:��a^�~7Fr���;��������"�%�o1����X��yI����W.�����,O$���I����V��.^���Q��4�тo����P�Y���$j-����9_ ��<�L�Q�sp||\�AH�ּX ���~����b* �x�;�?@��u9Ė?�|�lnn֫���"�<�$"�Zほ^��7��ZL�^7o�,5��EH�V�p�z9�m�C�+��QA sy��Q�!��X�}��_|�����,8::*�!$RsxLX/��E���z�4���H,����֜�E��K�t�F�9�埏��O?�Tj�Fo;`]_����j�r��9G�T�ŗg����ɺj f  ����4@=5WZ�L���@Lo:( �XP+x��c��b��zj��Wkj�� �j,��� ��zjvl��IH�:������:j���w�oN@B�`|p:�jW#,�/�q��l�_^@R��j>z����Ws�������LL����q��Wk��fV'$��֩���e`5F��U�D�Z�7�r��jM8��l�����K@b���,R���8��% 1���������r����:���s�_~@r����W�T�����وL���n8O�����AH�v�� �3w<�X���?�$4�v��y��F`G��N�k����慶�iN��]@ll����<��0,��q���-z�F.N�qxN��$@#ll�Q��s��W3� �a;`� �^�0�����j����fX�b�@�����Dh����b�/����4@Cll�����^���l�l������v����V����޴Gh��m�yԳݻw�0��A^�m����f�d��@�W+����B�����m�����"��E�����˿M@cll[�� u��~( ������$4�v��x[�������V��@���ضx����)^��aE�u��d;`�b@�I�,5��-lm�� �����/=�����8j�[A�]@�ll_|�k�^�i���pxS��F�8 �ND���G��k�v_�l��(���֭[]� ���П�8���f;�4D���믻XIg ����s���R����'4�v�鈇��C@��s�Na<N�c@�l��XP5�/����¸��Ǫf��z��ᬆ/^4u_Z�yn�����T4u�[�Zσ��}Q'����J�5O��r$`
c���5ۨ��4��9'Գ\��*�Ƹ}��Y��e45d�ޯ��!�[�/S��Kt֒ǏϾ�⋦�������Z�~�Q��?hX&���Sj��C�o4���^_���W��:!,����~�X�S��:���r�M�ί]�����:�����O�N1 ͤur��,�9�{���:[��k>��r�`���
�Vq��ܹ���g^���}UgVS�N�y���4�/����s����/�]������6��#v��t�ՙ��ŪS�����Dh�ގ���kA`�{��\E��^t�m6��Z����j�b�)���I^��W��� �;��3#7���o��oi��]�Z����p"bQ���_Z ��Kq^^,�aq&�e��].茯����ǧ�&��"�8��oj��?GO�0!2�_ż7�8D�'c�n��|�z���P��x����pbo�ݻw'�.�o��O?-LK3�����ߟMI g�wK���b]K�s�g9::j�w��/'N��N�^�|�qQS�`�������ɝ�����&d�ssq�|���d�������������p^{��-O�����������cad�lS�l�w�}��W��`��/���L�rX�C�,�?Z%4��3�����_ ���G�Z��^W�4n�ѡ9�D���?���2Ш{�Z�m��6�O���A>�}��W��IR������6�A����絘�|��U����
�M�{���.�4f*NJmww�9�N�;��׮�-�\;;;3N �|�N�U��ٴ���@#����?��>��p�X��Ǣ$����O�k��6"M�l��d)C��.N�k�5 ���=|..>4ų�Y�o5�_;L$��"�uqq������pe��괿v�H.>�a5��7n�gϞ�,��r��6H,z���b�����O.C��<�� �${k���ٳ�eiW���g )��a|���_~)�
�o�_nF����,\��֖\�L����������j8��H+�Y��7 �/7# Şcsgùy�f��������%$�f '�rᢴ�aiy ���� O��IH&������"��qh9 ��}�Ã����ơ��$$#)��Ý�h������|����8�[΢��˽�GHD��g��ƥ��#$�4.{�9��7.�/  d\1��s�����v�Za\V"s�o|�_.@"�� �r�o|�_.@"@�s�9����ǹ������Ƨ��"@�����`=��\�@W�?^����r�C@"Ϟ=+���˗N���O��EHD���<���Ƨ��"$�q��C��h���r�@f|O�<)p�o|�_.@"Ǹ����i��qi��x����,�>����#$br\���{��h����������8�[΢��˽�GHFJ����ƣ��#$sttT^�?Z��y��qh9 �DJ�P��������ơ��$$�� Oώ�������$$�� +���梴�aiy �ֽ{�
\��7,�// )�f�vq��0���������Bù�Y��7 �/��WH�?�(������F��nݺ�A�ʴ�ah�HL/�j�>�4��j����$�r5z\��w5�_~F�� ��~�A�+��.G�k�������lnn.&<������V����@b.�V���}�v��h����!4"������mk���]��ז�5+4!�! '���7nxP3
��l�_{�hȿ����駟������x����/���� �A�;���&# z��I�EG>�B �����6YРhl�ؼ[�<|�E�{��׶�j�����ӧOg����k����Q�ߟ��櫩�UoT�!�������}����U�T�!���?�x5u����!��2�����.V�R�|�����p6e/^��moo7�{Q}�����.V�S�Χ(zXׯ_o�w��+�O5VM]��@mllLjHr��j�w��-�O5TM]��`ż�����e1丹���}W*J�S�TS�V�V{#zj
������ŪKV,�i�A����E贈{��y������Ū+V�Q<x���ҽTj���T�j�b�@�h��s��j�P�ꭴ?����X5p�p_͇Q<tb~QoC)�O��|���{�ϜFݼy�\�~�\U|'����<z��<y�d�����?j8S<�潔���?^�����Q�?���x���gS��?�$@�����CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���CtH� �!:$@���C���1}Kq�IEND�B`�
2026-04-05 04:11:49 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[tokio::main]
#[cfg(feature = "nostr")]
#[allow(unused_imports)]
async fn main() {
use get_file_hash_core::repository_announcement;
use get_file_hash_core::get_file_hash;
use nostr_sdk::Keys;
use sha2::{Digest, Sha256};
use nostr_sdk::EventId;
use std::str::FromStr;
let keys = Keys::generate();
let relay_urls = get_file_hash_core::get_relay_urls();
let project_name = "my-awesome-repo-example";
let description = "A fantastic new project example.";
let clone_url = "[email protected]:user/my-awesome-repo-example.git";
// Dummy EventId for examples that require a build_manifest_event_id
const DUMMY_BUILD_MANIFEST_ID_STR: &str = "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0";
let dummy_build_manifest_id = EventId::from_str(DUMMY_BUILD_MANIFEST_ID_STR).unwrap();
// Example 1: Without build_manifest_event_id
println!("Publishing repository announcement without build_manifest_event_id...");
repository_announcement!(
&keys,
&relay_urls,
project_name,
description,
clone_url,
"../Cargo.toml" // Use a known file in your project
);
println!("Repository announcement without build_manifest_event_id published.");
// Example 2: With build_manifest_event_id
println!("Publishing repository announcement with build_manifest_event_id...");
repository_announcement!(
&keys,
&relay_urls,
project_name,
description,
clone_url,
"../Cargo.toml", // Use a known file in your project
Some(&dummy_build_manifest_id)
);
println!("Repository announcement with build_manifest_event_id published.");
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example repository_announcement --features nostr");
}
2026-04-05 04:11:46 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
�PNG

IHDR�x�� pHYs  ��sRGB���gAMA�� �a�IDATx�ݏ�G��7��ql��,Pc�I0�@� �,`dZ ��8 ��@: ��D;�OU�˪h��6�4����|�*X���W���9l�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �Al�$� �A��8��h�Q�o�8�i�/����}l�\��z��ʤ�]��3��ǫѪ,c<>q��z5
0����n�ǫQ���&�1�R�]M[�H�,�t���c��(W�EvC����� �� $2֧��Ǘ���?ٕ����
$Q&����u'�5zYV~
(���X�S���-�����8�2�?��~�V �.NN������B��'�����!�8N����!�8 ���C��)!�������"�M�����~+��������������4 ���@#e�{U>΃/��,N���^>^_3�zh�,�.�?nc�+h�
,�����
�� �����7�]Jx�bl�����Ͼ��}�`!���qp_j`A,�i�V`A,�N\�࡬�BX���yX��0�z��<��w�N���9=-���`f��������i
��3����`nB�L�y�%��� 0�� ��Uf"��LR��0fR��w�R��l����e��������#�|v������[�4�,0���ty�c����K�0 �����DȂ�@O�3�Y@O�/�Y@O�`���tC�������� �B���+X�U����� �B�� ��ޞ��Y��0�C�$[,0#fR�N��G��C�`&�8>����|ǻfq���Ii��.�y���\O�j �<@}"}]��A+C��/!�m�f �L�Ӥ&��v�zS��gܛ�P&���8��S���]�` �N:A���=�n��2�O�~���Bq ܉�P+��b�}��Bܚ��Z��&L����X�]_%�\���=x�R�8��ܠL"O��eЫ�e;�>K��P�S�������F[�UBq |B�J[�UB�`��"@�?'m}�k��G6����킵�>*[lZ� ~,/���,�O��e����� �8� �m}�f!��R��h��_�B�`6J`3�����I�P�������Z� �z���2�Oz� ��%�e�c�ތ��ߗ��U�&�ZS�_�^Eޞ��$8�M'^�6 q������g_.!�G�ͻ\SqWVӞ����+���z]����c^��c�=����1�������� ?s��W@v�f�W0�������]����y�'�*7�Ǽ�P������j���/K�����{2�lW�9g�n|@AY��>�
W��ε�u*�|=�5Օ�����՘�4a<��q<>O��Ƽ��{N���y�����/������3g[�g����>�t�h��|��V���L��Z.�&��)}�=�1����@�V�M�阷��{�GC�q�|l�0.����� ���n�c^��6��x'0�o�t5:!@g�� c���C[�f�qߵ��vB���Wo�ӛ��#�����4I�J�ބ]�!�}0]H������K���/�A廾(ߗ+�w���J����'��x,6{ǛjF?�'R+���U�8n�d45�RHj)���q|��XX5=yN��������˓��c�?$%�N�if�\�8�����!`Z �-r��)$%�4j����Ǭ��S���~�L�SF�-��W���H�������U������Ł?EN�8jL'W�MM�����E�\΃�j]Fֺ�����@�8�r3|y'�����dI'j}F��@!��8�z�����C��/��\;!��3�^k�) ����,����S=���@Sc}�K�m�{m}WE�`�<�f:i��D[���vB@�`���֗SK~B`�}0M ,N[_��u�C,�>�h�K�Ñ�"���������0�A`׊�Ҷ� �?�gq`����Y]k뛵��}[_��|PC�T��wB�`#0m}�U�����I�`f'0 m}���l����cK����rK��%�V+��%�� t��/��}0[ p/� d�췏����A���h��{%�&pg����Cd����@�`�M�N��ek�f�nM[_�J�`�H�j�߫�֗ �>����km}�#'m}i������������y5L�Y�_)�k>+y[߉���T������[�蠭�7�������L�#����hL����������J@[_�I�����N[_�W�/26�����k�K����Fu���I=f]�>����騭�J��}0� ��/�F탯��`#����J�>x���vC� (�zj����O������ ��V��ב�����l���d!�Xm}�Q��] �s2�J�Jm}!�zB@�`NFX�k=��#'m}��_�"bVFX��g7M���酶����w!���.S�_�A:=����n��}��� !`]���{���g�cs����Z��C�#������y䣭/�Q-�V2N!���u:W'���G[_x���w�t�*�Kq����0���wq�9�c@�j��8���%n��6�S@���yLO(O����]�8D.ϼ@�_@���J�!���,�� �_#����$t�������B���y�*|2 �П��C[_8��탧z���+@G���.r��N(a����E�D��m}!��택
�Џ�qzCh� �\;!p���;��e@����~�����P����������>�����:P�rN}B`���t@H�$��8m៶�Б$��
����)��_(���$hl�@b'~�7�C���
�����8 �?���C�U������}�g��NQ` 1 �S��L��>�B@k���$$T�w��P�X�����8�V&_!�4M����~p�֭�?�u��ǵ��9�N��[�l�E�/
l���-ɜ��o(��6�6�j��g ! �}����?lK]��-�yd  ��Iy�f?ج� ���@���죝S�48���ײ �6@2@"���<�S�O�U�G�Ɖ$�\Z.�y�����-Wl$"���h��?��e���r�G��?k�ƷA@eo�q��k��?� u�y좍A�?�/.���;|���>�8�5��m��<Z�3>�j�ս���h���C|�m�a  ���}��ϩ�A-����ql���*�}by���� �]��p�V�  �V�a�� ц������LK��z^�ߣ����z]��`��hCH@ȡ�`h��o4uS+׫��i⿈�7��.���� �:������H}�&�w�:��څ �66Dؖ!�V�d��_���A`@H�.�_�?���{��rM!�y� �X}�}�G�����X ���m��(�ϑ���&Sg˫Ư��@�Go:P ��%�gѷ]�����A/v�����C��[ ��"u���������!@��r}�_���Ѕ]��a@C�� ��N�\�H�������C�4� +�Z��K���5��9;;����@ �ýQui�����x�`>�ߤE �ג'!�1��y�ʥ�{\Ķ���*Ȧս��@��ýR�O\�c�����ҪG�'�hu��+�<�h�� �릥�]l�϶R�G�  �V�b��q3N�N|灭����>4� �V`�����U0��� N�ٿ��ٙ"�$�$ʠ�]q�� � �<�ȸ���Ծ�6A@.�hC3����c��8���jUP`"@.��6�=?��ݻ�~ Ne���!�r�v��)��>�Pz2�V�V�!HCH�Ǵ�h��GU�Z��Ml�4VO���C����?�����)��2GT��G;�����#3!����˦���d[-��T�|юm�FWZ�Lhkm��G�IDH���m�ٶ�nC(m�q��V[�܁�S���8`;��p;�X�N���rR�>���A �B��oN@Bu�l�6<�.�V�{���]��Z���6AJ@^��v^ɺ8��ݨX^˕?���� �ζߍ�ky�V����// �:hZu� �,+w� Ӹ#e���p@n��t`#�R��G;��r;D�Ԗ� �C�?�rS�mmt��MH�qW@u�r��W��>����kUD�8 �_�R����юm�e�:�_��6t����〫 ܑ����w,좍C�����6w!0-c������h�q�e���f�����8`���Ϳ�Y����p�ou?�*��������:!��q��Y�=���Z{�@?юm��Y�=`~�h�PW,�� ��wn�2���7z������;�8���2?��|�ЗC��8�2���:����Ơ�S_��8�7�ۗ�5�̫q�?�7�:�8`��6���`n-�����?���6�� aYB� ?����?�h�6��^�b��Q�?��[�����q�ou��������ю�� }r�oV>�B��"�F;��;@�ц� ���x��r]���}mؾ��'�;Wn��*�!����}����S@�\��b�.���e�����tI�〝+���қ���!l�,imh��1�_�h�6�B6��c%��]�?o���)�W���V��i�_ӟ���ǭ}spjMǓ����_��{,��hC��� };D�.�.��=�Z~�g�bt��.��9�"�(p�!`��σ�����:wt�$��h3��(7��
W_��:�r-���H���X���пV)�Q�.fa�V��� ����y�_��hg4q�&��*�i�M���N��է�V{ƭ���c(�tD���9���7��5�r|����Y���75��1ژ���Ը��������I`��������.�z��cO��K�S=Ȯ\���p�����smL/�ytOX��7y�����Ô����<��C����^jț���~y��O��%�V�>)���A�U����7���DA��B�Cpg5�OK���ϩ�o�쭃�-���h���0����t� ����W����~����˴����Qn*�ƾ]���[��v͗�z7.�j<��i }��V����}�׫`5���x�?|�;�q���=��FB�8.-��~�a?tNo{;ı��v�=���4�>�~��n�Ī�z+Rn4S��:\���Y���&�P=~�$4�q�������~*��9�1.u]`Eƶ�[�.:RW���}��t��;AVD#�uY[w�]�^M����
�է�7��Ιk��l��"+ޛ;/�U�ۆ�����?��i���j@VFX�� �\ob�v�zS~���\�b�^�`�>���颬v����2��й �|>xYnB?���G���m����e� �pƟ��;5�r�y�]AS��{�_����|��$Z2�>b�u�@�V��o.^QJ��g�Й�� ��>,������!+)lj�+e�l���5,av��W a�u�
@'��E�%�rُdv�߭�����N��Tt�n�+K���w'�_'�t��|����.^�W�ƒwf�uBH�.=ZV��]��';��� � ���^�Ƿ�q7S!�T�4ܓ�wo�_����ǻྴ*�ތ�3������LJ9�7q���a�������9�^$wf����KL��`OU$s��<�����~ �0�|<�pW��<�����Jbއ~�s�6�����I 9= 洯7u� �o^�_R@N����o~�  ������2$_e�-��KH����2�����o�_B@>��r����o9�_2@"5!?���F���|��� ��tǗ�2��rqZ�.�f�߲vA*@.�`I����/�K2��r�{�4�����[������<˼���[������|������|lj�삥�q�]�4�/6H`k�����A[�N��KD� r����yC�4�/ �cyC����4�\�`in��d�f�%"�@fyo>��[�������?���<�p�oY�_2@.n@����%~?���MF�e���7�%����C��C� ����T�|������[�!HE��` o q ��2����d� 9���K�5�+��� 9,��d�m�3�r2X�5-?�c����KJH�2��~ �%�ov�_R@^�<��>��y� y� O!s���#�`����KLH����p/���������������c�%'$�)��<}po�߃� �y
���>���w?�_΂��q</������f`�ݙ�� +(��2���fb�ݙ�� �Ӡ��u��F.0'��v�����HY���|�n2��oc ��W a�u�
@G���z��J�����͇�_d�u�
@�ʓ�U���}_oа(�ﳌ�Y���q\n�腛 3�:%t�.�= 7��t�h������1[+K���1-G�b��|8����й ߄�|89㏞ +�����i�J �
Ԟ�ߔk�8���n>db��+++S�F.���X�!�G��$e�'UnB�r���e�t`4��S*vW�˱o�����Е��Nm��i�S��?���`>��]�ǪjX���Nm�{#�*�>`�F�8��x#�Ok�c�-5�1����x,Vjy3�n:���>`�?NI�4�����\����!�r��\o���|���5�/*7��&��v�g|���P?�U�<�x��.i�=@b�@�K4��IEND�B`�
2026-04-05 04:11:42 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
/lmdb
/target
/relay_base
.rustc_info.json
bin/CACHEDIR.TAG
bin/config.toml
bin/debug/
bin/lmdb/
bin/logs.log
2026-04-05 04:11:40 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
use frost_secp256k1_tr as frost;
use frost::{Identifier, round1, round2};
use rand_chacha::ChaCha20Rng;
use rand_chacha::rand_core::SeedableRng;
use std::collections::BTreeMap;
use std::fs;
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. Load the persistent KeyPackage
let p1_json = fs::read_to_string("p1_key.json")?;
let p1_key_pkg: frost::keys::KeyPackage = serde_json::from_str(&p1_json)?;
let p1_id = *p1_key_pkg.identifier();
println!("--- BIP-64MOD: Batch Nonce Management ---");
// 2. BATCH GENERATION (The "Public Offer")
let mut rng = ChaCha20Rng::from_seed([88u8; 32]);
let mut public_commitments = BTreeMap::new();
let mut secret_nonce_vault = BTreeMap::new();
for i in 0..5 {
let (nonces, commitments) = round1::commit(p1_key_pkg.signing_share(), &mut rng);
public_commitments.insert(i, commitments);
secret_nonce_vault.insert(i, nonces);
}
// Save the vault (Private)
fs::write("p1_batch_vault.json", serde_json::to_string(&secret_nonce_vault)?)?;
println!("✅ Signer: Generated 5 nonces and saved to p1_batch_vault.json");
// 3. COORDINATOR REQUEST (Choosing Index #3)
let message = b"gnostr-gcc-batch-commit-hash-003";
let selected_index: u64 = 3;
let mut commitments_map = BTreeMap::new();
// Coordinator uses P1's commitment at the specific index
commitments_map.insert(p1_id, public_commitments[&selected_index]);
// Mock P2 to satisfy threshold
let mock_p2_id = Identifier::try_from(2u16)?;
let (_, p2_commitments) = round1::commit(p1_key_pkg.signing_share(), &mut rng);
commitments_map.insert(mock_p2_id, p2_commitments);
let signing_package = frost::SigningPackage::new(commitments_map, message);
println!("\n🚀 Coordinator: Requesting signature for Index #{}", selected_index);
// 4. SIGNER: Selective Fulfillment
let mut current_vault: BTreeMap<u64, round1::SigningNonces> =
serde_json::from_str(&fs::read_to_string("p1_batch_vault.json")?)?;
// Extract only the requested nonce
if let Some(p1_nonces) = current_vault.remove(&selected_index) {
let p1_share = round2::sign(&signing_package, &p1_nonces, &p1_key_pkg)?;
// Save the updated vault (Index 3 is now GONE)
fs::write("p1_batch_vault.json", serde_json::to_string(&current_vault)?)?;
println!("✅ Signer: Signed message using Index #{}", selected_index);
println!("✅ Signer: Partial Signature: {}", hex::encode(p1_share.serialize()));
println!("🛡️ Signer: Index #{} purged from vault. {} nonces remain.",
selected_index, current_vault.len());
} else {
println!("❌ Error: Nonce index {} has already been used!", selected_index);
}
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() { println!("Enable nostr feature."); }
2026-04-05 04:11:39 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
[package]
name = "n34-relay"
description = "A nostr GRASP relay implementation"
version = "0.1.1"
edition = "2024"
license = "AGPL-3.0-or-later"
authors = ["Awiteb <[email protected]>"]
readme = "README.md"
repository = "https://github.com/gnostr-org/get_file_hash.git"
documentation = "https://relay.n34.dev/docs.html"
homepage = "https://relay.n34.dev"
keywords = ["nostr", "NIP-34", "GRASP"]
rust-version = "1.88.0"
[features]
gen-protos = []
[package.metadata.wix]
upgrade-guid = "036A2A4F-DA54-4FE2-B2D8-8C58D5814874"
path-guid = "97D3207D-71DB-4DD0-B548-E43E8C664B7D"
license = false
eula = false
documentation = "https://relay.n34.dev/docs.html"
homepage = "https://relay.n34.dev"
[[bin]]
name = "nip34_relay"
path = "src/main.rs"
[dependencies]
rhai = { version = "1.23.4", features = [
"no_position",
"sync",
"serde",
"decimal",
] }
tokio = { version = "1.47.1", features = [
"macros",
"rt-multi-thread",
"signal",
"fs",
"process",
] }
tonic = { version = "0.14.2", features = [
"tls-ring",
"tls-webpki-roots",
"gzip",
"deflate",
] }
tower-http = { version = "0.6.6", features = [
"cors",
"decompression-br",
"decompression-deflate",
"decompression-gzip",
"decompression-zstd",
"trace",
"timeout",
] }
axum = { version = "0.8.6", features = ["http2", "ws"] }
base64 = "0.22.1"
chrono = "0.4.42"
config = { version = "0.15.15", default-features = false, features = ["toml"] }
const_format = "0.2.34"
convert_case = "0.8.0"
easy-ext = "1.0.2"
either = "1.15.0"
flume = "0.11.1"
futures = "0.3.31"
hyper = "1.7.0"
hyper-util = "0.1.17"
parking_lot = { version = "0.12.5", features = ["serde"] }
prost = "0.14.1"
serde = { version = "1.0.219", features = ["rc"] }
serde_json = "1.0.145"
serde_with = "3.15.0"
sha1 = "0.10.6"
sha2 = "0.10.9"
strum = { version = "0.27.2", features = ["derive"] }
thiserror = "2.0.16"
tokio-util = { version = "0.7.17", features = ["io"] }
toml = "0.9.5"
tonic-prost = "0.14.2"
tower = { version = "0.5.2", features = ["limit"] }
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
dirs = "6.0.0"
# We frequently switch between stable and unstable versions; this will make the
# process easier.
[dependencies.nostr]
default-features = false
features = ["std"]
git = "https://git.4rs.nl/mirrors/nostr.git"
rev = "27a1947d3"
# version = "0.45.0"
[dependencies.nostr-database]
default-features = false
git = "https://git.4rs.nl/mirrors/nostr.git"
rev = "27a1947d3"
# version = "0.45.0"
[dependencies.nostr-lmdb]
default-features = false
git = "https://git.4rs.nl/mirrors/nostr.git"
rev = "27a1947d3"
# version = "0.45.0"
[dependencies.nostr-relay-builder]
default-features = false
git = "https://git.4rs.nl/mirrors/nostr.git"
rev = "27a1947d3"
# version = "0.45.0"
[build-dependencies]
tonic-prost-build = "0.14.2"
[target.'cfg(not(windows))'.build-dependencies]
protobuf-src = "2.1.0"
# [profile.release]
# lto = "fat"
# opt-level = 3
2026-04-05 04:11:38 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[tokio::main]
#[cfg(feature = "nostr")]
async fn main() {
use get_file_hash_core::publish_repository_state;
use nostr_sdk::Keys;
let keys = Keys::generate();
let relay_urls = get_file_hash_core::get_relay_urls();
let d_tag = "my-awesome-repo-example";
let branch_name = "main";
let commit_id = "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0";
println!("Publishing repository state...");
publish_repository_state!(
&keys,
&relay_urls,
d_tag,
branch_name,
commit_id
);
println!("Repository state published.");
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example publish_repository_state --features nostr");
}
2026-04-05 04:11:35 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
<svg width="38" height="38" viewBox="0 0 38 38" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="38" height="38" rx="12" fill="#4434FF"/>
<path d="M10.6731 30.6348C8.83687 30.6346 7.34885 29.1458 7.34885 27.3096C7.34891 26.2473 7.84783 25.303 8.62326 24.6943C8.21265 23.3055 7.86571 22.049 7.45334 20.6758C6.90247 18.8412 7.4492 16.8197 8.93576 15.5605L15.7512 9.78906C15.6931 9.54286 15.6614 9.28642 15.6613 9.02246C15.6613 7.51617 16.6628 6.24465 18.0363 5.83594L18.0363 -1.11215e-06C18.511 0.000462658 18.4612 0.000975391 18.9856 0.000975533C19.5102 0.000975578 19.5802 -1.11589e-06 19.9367 -9.46012e-07L19.9367 5.83594C21.3097 6.24503 22.3108 7.5166 22.3108 9.02246C22.3107 9.29118 22.2792 9.55249 22.219 9.80273L29.0783 15.6123C30.5229 16.8359 31.1022 18.8013 30.5539 20.6133L29.3254 24.6758C30.1142 25.2837 30.6232 26.2367 30.6233 27.3096C30.6233 29.1459 29.1344 30.6348 27.2981 30.6348C25.4619 30.6346 23.9738 29.1458 23.9738 27.3096C23.974 25.4734 25.4619 23.9846 27.2981 23.9844C27.3814 23.9844 27.4643 23.9891 27.5461 23.9951L28.7356 20.0625C29.0645 18.9753 28.7166 17.7966 27.8498 17.0625L21.2424 11.4648C20.8746 11.8048 20.4294 12.0622 19.9367 12.209L19.9367 18.9258C21.0425 19.3175 21.836 20.3694 21.8362 21.6094C21.8362 23.1834 20.5596 24.46 18.9856 24.46C17.4117 24.4598 16.136 23.1833 16.136 21.6094C16.1361 20.3689 16.93 19.3172 18.0363 18.9258L18.0363 12.21C17.5395 12.0622 17.0916 11.801 16.7219 11.457L10.1643 17.0107C9.27919 17.7605 8.93068 18.9867 9.27365 20.1289C9.68708 21.5056 10.0175 22.7009 10.3986 23.998C10.4892 23.9906 10.5806 23.9844 10.6731 23.9844C12.5093 23.9844 13.9981 25.4733 13.9983 27.3096C13.9983 29.1459 12.5094 30.6348 10.6731 30.6348Z" fill="white"/>
</svg>
2026-04-05 04:11:24 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
# Grasp - Git Relays Authorized via Signed-Nostr Proofs
Status: DRAFT - expect breaking changes
Contributions to open-source projects shouldn't be permissioned by a platform like GitHub. Git repoistory hosting should be distributed. Grasp is a protocol like blossom, but for git.
## Overview
There may be many grasp servers anywhere -- like Blossom servers -- that host repositories from anyone (maybe they'll ask for a pre-payment, maybe they will have a free quota for some Nostr users and so on) that you can just push your repositories to. And your pushes are pre-authorized by publishing a Nostr event beforehand that says what is your repository state (branch=commit, HEAD=branch or something like that).
Then when announcing your repository you can include multiple git+http URLs to these servers that people can clone the project from. And Git-enabled Nostr clients can contact these servers to download and display source code and Git history data.
## Specification
GRASP-01 is required. Everything else is optional.
* GRASP-01 - Core Service Requirements
* GRASP-02 - Proactive Sync
* GRASP-05 - Archive
Reference implementation - [ngit-relay](https://gitworkshop.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-relay)
TODO:
- Service Announcements and Discovery
2026-04-05 04:11:30 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#!/usr/bin/env sh
N34_RELAY_BASE_DIR=./bin RUST_LOG=debug cargo run -p n34-relay
2026-04-05 04:11:29 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
use frost_secp256k1_tr as frost;
use frost::{Identifier, round1, round2};
use rand_chacha::ChaCha20Rng;
use rand_chacha::rand_core::SeedableRng;
use std::fs;
use std::collections::BTreeMap;
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. SETUP: Reload the KeyPackage we saved in the last example
let p1_json = fs::read_to_string("p1_key.json")
.map_err(|_| "Run example 6 first to generate p1_key.json")?;
let p1_key_pkg: frost::keys::KeyPackage = serde_json::from_str(&p1_json)?;
let p1_id = *p1_key_pkg.identifier();
println!("--- BIP-64MOD: Distributed Handshake Simulation ---");
// 2. SIGNER: Round 1 (Generate and Vault)
// In a real app, the Signer does this and sends the Commitment to a Nostr Relay.
let mut rng = ChaCha20Rng::from_seed([42u8; 32]);
let (p1_nonces, p1_commitments) = round1::commit(p1_key_pkg.signing_share(), &mut rng);
// Securely "vault" the secret nonces (Simulating a local DB or protected file)
let nonce_json = serde_json::to_string(&p1_nonces)?;
fs::write("p1_nonce_vault.json", nonce_json)?;
println!("✅ Signer: Generated Nonce and saved to p1_nonce_vault.json");
println!("✅ Signer: Shared Public Commitment: {}", hex::encode(p1_commitments.serialize()?));
// 3. COORDINATOR: Create Signing Request
// The Coordinator sees the commitment and asks the group to sign a Git Commit.
let message = b"gnostr-gcc-distributed-commit-xyz123";
let mut commitments_map = BTreeMap::new();
commitments_map.insert(p1_id, p1_commitments);
// We mock P2's commitment here to satisfy the 2-of-3 threshold
let mock_p2_id = Identifier::try_from(2u16)?;
let mut rng2 = ChaCha20Rng::from_seed([7u8; 32]);
let (_, p2_commitments) = round1::commit(p1_key_pkg.signing_share(), &mut rng2); // Mocking
commitments_map.insert(mock_p2_id, p2_commitments);
let signing_package = frost::SigningPackage::new(commitments_map, message);
println!("\n🚀 Coordinator: Created Signing Request for message: {:?}",
String::from_utf8_lossy(message));
// 4. SIGNER: Round 2 (Fulfill Request)
// Signer receives the SigningPackage, reloads their secret nonce, and signs.
let vaulted_nonce_json = fs::read_to_string("p1_nonce_vault.json")?;
let p1_reloaded_nonces: round1::SigningNonces = serde_json::from_str(&vaulted_nonce_json)?;
let p1_share = round2::sign(&signing_package, &p1_reloaded_nonces, &p1_key_pkg)?;
println!("✅ Signer: Fulfilled request with Signature Share: {}",
hex::encode(p1_share.serialize()));
// IMPORTANT: Delete the secret nonce after use to prevent reuse attacks!
fs::remove_file("p1_nonce_vault.json")?;
println!("🛡️ Signer: Secret nonce deleted from vault (Reuse Protection).");
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() { println!("Enable nostr feature."); }
2026-04-05 04:11:26 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
exclude = ["target/**/*.toml", "Cargo.lock"]
[formatting]
align_entries = true
indent_tables = true
reorder_keys = false
[[rule]]
include = ["**/Cargo.toml"]
keys = ["dependencies"]
formatting.reorder_keys = true
2026-04-05 04:11:19 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[cfg(feature = "nostr")]
use frost_secp256k1_tr as frost;
#[cfg(feature = "nostr")]
use rand::thread_rng;
#[cfg(feature = "nostr")]
use std::collections::BTreeMap;
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut rng = thread_rng();
let max_signers = 3;
let min_signers = 2;
////////////////////////////////////////////////////////////////////////////
// Round 0: Key Generation (Trusted Dealer)
////////////////////////////////////////////////////////////////////////////
// In a real P2P setup, you'd use Distributed Key Generation (DKG).
// For local testing/simulations, the trusted dealer is faster.
let (shares, pubkey_package) = frost::keys::generate_with_dealer(
max_signers,
min_signers,
frost::keys::IdentifierList::Default,
&mut rng,
)?;
// Verifying the public key exists
let group_public_key = pubkey_package.verifying_key();
println!("Group Public Key: {:?}", group_public_key);
////////////////////////////////////////////////////////////////////////////
// Round 1: Commitment
////////////////////////////////////////////////////////////////////////////
let message = b"BIP-64MOD Consensus Proposal";
let mut signing_commitments = BTreeMap::new();
let mut participant_nonces = BTreeMap::new();
// Participants 1 and 2 decide to sign
for i in 1..=min_signers {
let identifier = frost::Identifier::try_from(i as u16)?;
// Generate nonces and commitments
let (nonces, commitments) = frost::round1::commit(
shares[&identifier].signing_share(),
&mut rng,
);
signing_commitments.insert(identifier, commitments);
participant_nonces.insert(identifier, nonces);
}
////////////////////////////////////////////////////////////////////////////
// Round 2: Signing
////////////////////////////////////////////////////////////////////////////
let mut signature_shares = BTreeMap::new();
let signing_package = frost::SigningPackage::new(signing_commitments, message);
for i in 1..=min_signers {
let identifier = frost::Identifier::try_from(i as u16)?;
let nonces = &participant_nonces[&identifier];
// Each participant produces a signature share
let key_package: frost::keys::KeyPackage = shares[&identifier].clone().try_into()?;
let share = frost::round2::sign(&signing_package, nonces, &key_package)?;
signature_shares.insert(identifier, share);
}
////////////////////////////////////////////////////////////////////////////
// Finalization: Aggregation
////////////////////////////////////////////////////////////////////////////
let group_signature = frost::aggregate(
&signing_package,
&signature_shares,
&pubkey_package,
)?;
// Verification
group_public_key.verify(message, &group_signature)?;
println!("Threshold signature verified successfully!");
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example trusted-dealer --features nostr");
}
2026-04-05 04:11:23 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[tokio::main]
#[cfg(feature = "nostr")]
async fn main() {
use get_file_hash_core::publish_pull_request;
use nostr_sdk::Keys;
use nostr_sdk::EventId;
use std::str::FromStr;
let keys = Keys::generate();
let relay_urls = get_file_hash_core::get_relay_urls();
let d_tag = "my-awesome-repo-example";
let commit_id = "0123456789abcdef0123456789abcdef01234567";
let clone_url = "[email protected]:user/my-feature-branch.git";
let title = Some("Feat: Add new awesome feature example");
// Dummy EventId for examples that require a build_manifest_event_id
const DUMMY_BUILD_MANIFEST_ID_STR: &str = "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0";
let dummy_build_manifest_id = EventId::from_str(DUMMY_BUILD_MANIFEST_ID_STR).unwrap();
// Example 1: Without title and build_manifest_event_id
println!("Publishing pull request without title and build_manifest_event_id...");
publish_pull_request!(
&keys,
&relay_urls,
d_tag,
commit_id,
clone_url
);
println!("Pull request without title and build_manifest_event_id published.");
// Example 2: With title but without build_manifest_event_id
println!("Publishing pull request with title but without build_manifest_event_id...");
publish_pull_request!(
&keys,
&relay_urls,
d_tag,
commit_id,
clone_url,
title
);
println!("Pull request with title but without build_manifest_event_id published.");
// Example 3: With build_manifest_event_id but without title
println!("Publishing pull request with build_manifest_event_id but without title...");
publish_pull_request!(
&keys,
&relay_urls,
d_tag,
commit_id,
clone_url,
None, // Explicitly pass None for title
Some(&dummy_build_manifest_id)
);
println!("Pull request with build_manifest_event_id but without title published.");
// Example 4: With title and build_manifest_event_id
println!("Publishing pull request with title and build_manifest_event_id...");
publish_pull_request!(
&keys,
&relay_urls,
d_tag,
commit_id,
clone_url,
title,
Some(&dummy_build_manifest_id)
);
println!("Pull request with title and build_manifest_event_id published.");
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example publish_pull_request --features nostr");
}
2026-04-05 04:11:18 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
use frost_secp256k1_tr as frost;
use frost::{Identifier, keys::IdentifierList, round1, round2};
use rand_chacha::ChaCha20Rng;
use rand_chacha::rand_core::SeedableRng;
use std::fs;
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. SETUP: Initial Key Generation (The "Genesis" event)
let mut dealer_rng = ChaCha20Rng::from_seed([0u8; 32]);
let min_signers = 2;
let (shares, pubkey_package) = frost::keys::generate_with_dealer(
3, min_signers, IdentifierList::Default, &mut dealer_rng
)?;
// 2. PERSISTENCE: Save Participant 1's KeyPackage to a file
let p1_id = Identifier::try_from(1u16)?;
let p1_key_pkg = frost::keys::KeyPackage::new(
p1_id,
*shares[&p1_id].signing_share(),
frost::keys::VerifyingShare::from(*shares[&p1_id].signing_share()),
*pubkey_package.verifying_key(),
min_signers,
);
// Serialize to JSON (standard for many Nostr/Git tools)
let p1_json = serde_json::to_string_pretty(&p1_key_pkg)?;
fs::write("p1_key.json", p1_json)?;
let pub_json = serde_json::to_string_pretty(&pubkey_package)?;
fs::write("group_public.json", pub_json)?;
println!("--- BIP-64MOD: Key Persistence ---");
println!("✅ Saved p1_key.json and group_public.json to disk.");
// 3. RELOAD: Simulate a Signer waking up later
let p1_loaded_json = fs::read_to_string("p1_key.json")?;
let p1_reloaded_pkg: frost::keys::KeyPackage = serde_json::from_str(&p1_loaded_json)?;
println!("✅ Reloaded KeyPackage for Participant: {:?}", p1_reloaded_pkg.identifier());
// 4. SIGN: Use the reloaded key to sign a new Git Commit Hash
let mut rng = ChaCha20Rng::from_seed([100u8; 32]); // Fresh seed for this specific signing session
let (nonces, commitments) = round1::commit(p1_reloaded_pkg.signing_share(), &mut rng);
println!("\nGenerated Nonce for new session:");
println!(" Commitment: {}", hex::encode(commitments.serialize()?));
// Cleanup files for the example
// fs::remove_file("p1_key.json")?;
// fs::remove_file("group_public.json")?;
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() { println!("Enable nostr feature."); }
2026-04-05 04:11:14 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
/lmdb
/target
/relay_base
.rustc_info.json
bin/CACHEDIR.TAG
bin/config.toml
bin/debug/
bin/lmdb/
bin/logs.log
2026-04-05 04:11:14 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
MIT License
Copyright (c) 2025 DanConwayDev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2026-04-05 04:11:07 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
use frost_secp256k1_tr as frost;
use frost::{Identifier, keys::IdentifierList, round1, round2};
use rand_chacha::ChaCha20Rng;
use rand_chacha::rand_core::SeedableRng;
use std::collections::BTreeMap;
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. RECREATE CONTEXT (Same as Signer)
let mut dealer_rng = ChaCha20Rng::from_seed([0u8; 32]);
let min_signers = 2;
let (shares, pubkey_package) = frost::keys::generate_with_dealer(
3, min_signers, IdentifierList::Default, &mut dealer_rng
)?;
let p1_id = Identifier::try_from(1u16)?;
let p2_id = Identifier::try_from(2u16)?;
// 2. SIMULATE SIGNING (Round 1 & 2)
let mut rng1 = ChaCha20Rng::from_seed([1u8; 32]);
let (p1_nonces, p1_commitments) = round1::commit(shares[&p1_id].signing_share(), &mut rng1);
let mut rng2 = ChaCha20Rng::from_seed([2u8; 32]);
let (p2_nonces, p2_commitments) = round1::commit(shares[&p2_id].signing_share(), &mut rng2);
let message = b"gnostr-gcc-verification-test";
let mut commitments_map = BTreeMap::new();
commitments_map.insert(p1_id, p1_commitments);
commitments_map.insert(p2_id, p2_commitments);
let signing_package = frost::SigningPackage::new(commitments_map, message);
// Generate shares (using the KeyPackage method we perfected)
let p1_key_pkg = frost::keys::KeyPackage::new(p1_id, *shares[&p1_id].signing_share(),
frost::keys::VerifyingShare::from(*shares[&p1_id].signing_share()),
*pubkey_package.verifying_key(), min_signers);
let p2_key_pkg = frost::keys::KeyPackage::new(p2_id, *shares[&p2_id].signing_share(),
frost::keys::VerifyingShare::from(*shares[&p2_id].signing_share()),
*pubkey_package.verifying_key(), min_signers);
let p1_sig_share = round2::sign(&signing_package, &p1_nonces, &p1_key_pkg)?;
let p2_sig_share = round2::sign(&signing_package, &p2_nonces, &p2_key_pkg)?;
// 3. COORDINATOR: AGGREGATION
println!("--- BIP-64MOD: Coordinator Aggregation ---");
let mut shares_map = BTreeMap::new();
shares_map.insert(p1_id, p1_sig_share);
shares_map.insert(p2_id, p2_sig_share);
let final_signature = frost::aggregate(
&signing_package,
&shares_map,
&pubkey_package
)?;
let sig_bytes = final_signature.serialize()?;
println!("✅ Aggregation Successful!");
println!("Final Signature (Hex): {}", hex::encode(&sig_bytes));
// 4. VERIFICATION (The moment of truth)
pubkey_package.verifying_key().verify(message, &final_signature)?;
println!("🛡️ Signature Verified against Group Public Key!");
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() { println!("Enable nostr feature."); }
2026-04-05 04:11:07 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[tokio::main]
#[cfg(feature = "nostr")]
async fn main() {
use get_file_hash_core::publish_pr_update;
use nostr_sdk::Keys;
use nostr_sdk::EventId;
use std::str::FromStr;
let keys = Keys::generate();
let relay_urls = get_file_hash_core::get_relay_urls();
let d_tag = "my-awesome-repo-example";
let pr_event_id = EventId::from_str("f6e4d6a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9").unwrap(); // Example PR Event ID
let updated_commit_id = "z9y8x7w6v5u4t3s2r1q0p9o8n7m6l5k4j3i2h1g0";
let updated_clone_url = "[email protected]:user/my-feature-branch-v2.git";
// Dummy EventId for examples that require a build_manifest_event_id
const DUMMY_BUILD_MANIFEST_ID_STR: &str = "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0";
let dummy_build_manifest_id = EventId::from_str(DUMMY_BUILD_MANIFEST_ID_STR).unwrap();
// Example 1: Without build_manifest_event_id
println!("Publishing PR update without build_manifest_event_id...");
publish_pr_update!(
&keys,
&relay_urls,
d_tag,
&pr_event_id,
updated_commit_id,
updated_clone_url
);
println!("PR update without build_manifest_event_id published.");
// Example 2: With build_manifest_event_id
println!("Publishing PR update with build_manifest_event_id...");
publish_pr_update!(
&keys,
&relay_urls,
d_tag,
&pr_event_id,
updated_commit_id,
updated_clone_url,
Some(&dummy_build_manifest_id)
);
println!("PR update with build_manifest_event_id published.");
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example publish_pr_update --features nostr");
}
2026-04-05 04:11:07 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[cfg(feature = "nostr")]
use frost_secp256k1_tr as frost;
#[cfg(feature = "nostr")]
use rand::thread_rng;
#[cfg(feature = "nostr")]
use std::collections::BTreeMap;
/// A simplified ROAST Coordinator that manages signing sessions
#[cfg(feature = "nostr")]
struct RoastCoordinator {
min_signers: u16,
_message: Vec<u8>,
commitments: BTreeMap<frost::Identifier, frost::round1::SigningCommitments>,
nonces: BTreeMap<frost::Identifier, frost::round1::SigningNonces>,
shares: BTreeMap<frost::Identifier, frost::round2::SignatureShare>,
}
#[cfg(feature = "nostr")]
impl RoastCoordinator {
fn new(min_signers: u16, message: &[u8]) -> Self {
Self {
min_signers,
_message: message.to_vec(),
commitments: BTreeMap::new(),
nonces: BTreeMap::new(),
shares: BTreeMap::new(),
}
}
/// ROAST Logic: Collect commitments until we hit the threshold.
/// In a real P2P system, this would be an async stream handler.
fn add_commitment(&mut self, id: frost::Identifier, comms: frost::round1::SigningCommitments, nonces: frost::round1::SigningNonces) {
if self.commitments.len() < self.min_signers as usize {
self.commitments.insert(id, comms);
self.nonces.insert(id, nonces);
}
}
/// ROAST Logic: Collect signature shares.
fn add_share(&mut self, id: frost::Identifier, share: frost::round2::SignatureShare) {
if self.shares.len() < self.min_signers as usize {
self.shares.insert(id, share);
}
}
fn is_ready_to_sign(&self) -> bool {
self.commitments.len() >= self.min_signers as usize
}
fn is_ready_to_aggregate(&self) -> bool {
self.shares.len() >= self.min_signers as usize
}
}
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut rng = thread_rng();
let (max_signers, min_signers) = (5, 3);
let message = b"BIP-64MOD Context: ROAST Coordination";
// 1. Setup: Generate keys (Dealer mode for simulation)
let (key_shares, pubkey_package) = frost::keys::generate_with_dealer(
max_signers,
min_signers,
frost::keys::IdentifierList::Default,
&mut rng,
)?;
let mut coordinator = RoastCoordinator::new(min_signers, message);
// 2. Round 1: Asynchronous Commitment Collection
// Simulate signers 1, 3, and 5 responding first (ROAST skips 2 and 4)
for &id_num in &[1, 3, 5] {
let id = frost::Identifier::try_from(id_num as u16)?;
let (nonces, comms) = frost::round1::commit(key_shares[&id].signing_share(), &mut rng);
// Signers store their nonces locally, send comms to coordinator
coordinator.add_commitment(id, comms, nonces);
// Note: Signer 2 was "offline", but ROAST doesn't care because we hit 3/5.
}
// 3. Round 2: Signing
if coordinator.is_ready_to_sign() {
let signing_package = frost::SigningPackage::new(coordinator.commitments.clone(), message);
let mut temp_shares = BTreeMap::new();
for &id in coordinator.commitments.keys() {
// In reality, coordinator sends signing_package to signers
// Here we simulate the signers producing shares
let nonces = &coordinator.nonces[&id];
let key_package: frost::keys::KeyPackage = key_shares[&id].clone().try_into()?;
let share = frost::round2::sign(&signing_package, &nonces, &key_package)?;
temp_shares.insert(id, share);
}
for (id, share) in temp_shares {
coordinator.add_share(id, share);
}
}
// 4. Finalization: Aggregation
if coordinator.is_ready_to_aggregate() {
let signing_package = frost::SigningPackage::new(coordinator.commitments.clone(), message);
let group_signature = frost::aggregate(
&signing_package,
&coordinator.shares,
&pubkey_package,
)?;
pubkey_package.verifying_key().verify(message, &group_signature)?;
println!("ROAST-coordinated signature verified!");
}
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example roast-experiment --features nostr");
}
2026-04-05 04:11:03 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#!/usr/bin/env sh
N34_RELAY_BASE_DIR=./bin RUST_LOG=debug cargo run -p n34-relay
2026-04-05 04:11:02 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
# GRASP-05 Archive
Status: DRAFT - expect breaking changes
Purpose: to backup or mirror an existing repository.
MAY accept [git repository announcements](https://nips.nostr.com/34#repository-announcements) that do not list the service in both `clone` and `relays` tags.
MUST implement GRASP-02.
2026-04-05 04:10:54 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
use rand_chacha::ChaCha20Rng;
use rand_chacha::rand_core::SeedableRng;
use frost_secp256k1_tr as frost;
use frost::{Identifier, keys::IdentifierList, round1, round2};
use std::collections::BTreeMap;
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut dealer_rng = ChaCha20Rng::from_seed([0u8; 32]);
let min_signers = 2;
let (shares, pubkey_package) = frost::keys::generate_with_dealer(
3, min_signers, IdentifierList::Default, &mut dealer_rng
)?;
// 1. Setup Signer (P1) and peer (P2)
let p1_id = Identifier::try_from(1u16)?;
let p2_id = Identifier::try_from(2u16)?;
// 2. Round 1: Both signers generate nonces (Simulating P2's contribution)
let mut rng1 = ChaCha20Rng::from_seed([1u8; 32]);
let (p1_nonces, p1_commitments) = round1::commit(shares[&p1_id].signing_share(), &mut rng1);
let mut rng2 = ChaCha20Rng::from_seed([2u8; 32]);
let (_p2_nonces, p2_commitments) = round1::commit(shares[&p2_id].signing_share(), &mut rng2);
// 3. Coordinator: Create a valid SigningPackage with 2 signers
let message = b"gnostr-gcc-verification-test";
let mut commitments_map = BTreeMap::new();
commitments_map.insert(p1_id, p1_commitments);
commitments_map.insert(p2_id, p2_commitments); // Added P2 to satisfy threshold
let signing_package = frost::SigningPackage::new(commitments_map, message);
println!("--- BIP-64MOD Round 2: Signer Validation ---");
// 4. SIGNER-SIDE CHECK (Manual)
if !signing_package.signing_commitments().contains_key(&p1_id) {
return Err("Validation Failed: My commitment is missing!".into());
}
let commitment_count = signing_package.signing_commitments().len() as u16;
if commitment_count < min_signers {
return Err(format!("Validation Failed: Only {} commitments provided, need {}.", commitment_count, min_signers).into());
}
println!("✅ Signing Package validated ({} signers).", commitment_count);
println!("Proceeding to sign message: {:?}", String::from_utf8_lossy(message));
// 5. Generate the Share
let p1_verifying_share = frost::keys::VerifyingShare::from(*shares[&p1_id].signing_share());
let p1_key_package = frost::keys::KeyPackage::new(
p1_id,
*shares[&p1_id].signing_share(),
p1_verifying_share,
*pubkey_package.verifying_key(),
min_signers,
);
let p1_signature_share = round2::sign(&signing_package, &p1_nonces, &p1_key_package)?;
println!("\nPartial Signature Share for P1:");
println!("{}", hex::encode(p1_signature_share.serialize()));
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() { println!("Enable nostr feature."); }
2026-04-05 04:10:54 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[tokio::main]
#[cfg(feature = "nostr")]
#[allow(unused_imports)]
async fn main() {
use get_file_hash_core::repository_announcement;
use get_file_hash_core::get_file_hash;
use nostr_sdk::Keys;
use sha2::{Digest, Sha256};
use nostr_sdk::EventId;
use std::str::FromStr;
let keys = Keys::generate();
let relay_urls = get_file_hash_core::get_relay_urls();
let project_name = "my-awesome-repo-example";
let description = "A fantastic new project example.";
let clone_url = "[email protected]:user/my-awesome-repo-example.git";
// Dummy EventId for examples that require a build_manifest_event_id
const DUMMY_BUILD_MANIFEST_ID_STR: &str = "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0";
let dummy_build_manifest_id = EventId::from_str(DUMMY_BUILD_MANIFEST_ID_STR).unwrap();
// Example 1: Without build_manifest_event_id
println!("Publishing repository announcement without build_manifest_event_id...");
repository_announcement!(
&keys,
&relay_urls,
project_name,
description,
clone_url,
"../Cargo.toml" // Use a known file in your project
);
println!("Repository announcement without build_manifest_event_id published.");
// Example 2: With build_manifest_event_id
println!("Publishing repository announcement with build_manifest_event_id...");
repository_announcement!(
&keys,
&relay_urls,
project_name,
description,
clone_url,
"../Cargo.toml", // Use a known file in your project
Some(&dummy_build_manifest_id)
);
println!("Repository announcement with build_manifest_event_id published.");
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example repository_announcement --features nostr");
}
2026-04-05 04:10:53 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[cfg(feature = "nostr")]
use get_file_hash_core::{get_relay_urls, publish_patch, publish_metadata_event, DEFAULT_PICTURE_URL, DEFAULT_BANNER_URL};
#[cfg(feature = "nostr")]
#[tokio::main]
async fn main() {
use nostr_sdk::Keys;
use nostr_sdk::EventId;
use std::str::FromStr;
let keys = Keys::generate();
let relay_urls = get_relay_urls();
let d_tag = "my-gnostr-repository-patch-with-metadata-example"; // Repository identifier
let commit_id = "f1e2d3c4b5a6f7e8d9c0b1a2f3e4d5c6b7a8f9e0"; // Example commit ID
// Metadata for NIP-01 event
let picture_url = DEFAULT_PICTURE_URL;
let banner_url = DEFAULT_BANNER_URL;
let metadata_file_path = "./README.md"; // Using README.md content for metadata
// Dummy EventId for examples that require a build_manifest_event_id
const DUMMY_BUILD_MANIFEST_ID_STR: &str = "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0";
let dummy_build_manifest_id = EventId::from_str(DUMMY_BUILD_MANIFEST_ID_STR).unwrap();
println!("Publishing NIP-01 Metadata Event...");
publish_metadata_event(
&keys,
&relay_urls,
picture_url,
banner_url,
metadata_file_path
).await;
println!("NIP-01 Metadata Event published.");
println!("
Publishing NIP-34 Patch Event without build_manifest_event_id...");
publish_patch!(
&keys,
&relay_urls,
d_tag,
commit_id,
"../Cargo.toml" // Use an existing file for the patch content
);
println!("NIP-34 Patch Event without build_manifest_event_id published.");
println!("
Publishing NIP-34 Patch Event with build_manifest_event_id...");
publish_patch!(
&keys,
&relay_urls,
d_tag,
commit_id,
"../Cargo.toml", // Use an existing file for the patch content
Some(&dummy_build_manifest_id)
);
println!("NIP-34 Patch Event with build_manifest_event_id published.");
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example publish_patch_with_metadata --features nostr");
}
2026-04-05 04:10:51 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
# GRASP-02 Proactive Sync
Status: DRAFT - expect breaking changes
MUST proactively sync nostr events from other relays listed in `relays` tag of [git repository announcement](https://nips.nostr.com/34#repository-announcements) no less than once every 1h.
MUST proactively sync missing git data from latest
[repo state announcement](https://nips.nostr.com/34#repository-state-announcements) from other git servers listed in `clone` no less than every 1h.
MUST proactively fetch git data related to accepted [git PR event](https://nips.nostr.com/34#pull-requests) or [git PR update event](https://nips.nostr.com/34#pull-request-updates) no less than every 1h and serve from `/refs/nostr/<event-id>`.
2026-04-05 04:10:43 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[cfg(feature = "nostr")]
use frost_secp256k1_tr as frost;
#[cfg(feature = "nostr")]
use rand::thread_rng;
#[cfg(feature = "nostr")]
use std::collections::BTreeMap;
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut rng = thread_rng();
let max_signers = 3;
let min_signers = 2;
////////////////////////////////////////////////////////////////////////////
// Round 0: Key Generation (Trusted Dealer)
////////////////////////////////////////////////////////////////////////////
// In a real P2P setup, you'd use Distributed Key Generation (DKG).
// For local testing/simulations, the trusted dealer is faster.
let (shares, pubkey_package) = frost::keys::generate_with_dealer(
max_signers,
min_signers,
frost::keys::IdentifierList::Default,
&mut rng,
)?;
// Verifying the public key exists
let group_public_key = pubkey_package.verifying_key();
println!("Group Public Key: {:?}", group_public_key);
////////////////////////////////////////////////////////////////////////////
// Round 1: Commitment
////////////////////////////////////////////////////////////////////////////
let message = b"BIP-64MOD Consensus Proposal";
let mut signing_commitments = BTreeMap::new();
let mut participant_nonces = BTreeMap::new();
// Participants 1 and 2 decide to sign
for i in 1..=min_signers {
let identifier = frost::Identifier::try_from(i as u16)?;
// Generate nonces and commitments
let (nonces, commitments) = frost::round1::commit(
shares[&identifier].signing_share(),
&mut rng,
);
signing_commitments.insert(identifier, commitments);
participant_nonces.insert(identifier, nonces);
}
////////////////////////////////////////////////////////////////////////////
// Round 2: Signing
////////////////////////////////////////////////////////////////////////////
let mut signature_shares = BTreeMap::new();
let signing_package = frost::SigningPackage::new(signing_commitments, message);
for i in 1..=min_signers {
let identifier = frost::Identifier::try_from(i as u16)?;
let nonces = &participant_nonces[&identifier];
// Each participant produces a signature share
let key_package: frost::keys::KeyPackage = shares[&identifier].clone().try_into()?;
let share = frost::round2::sign(&signing_package, nonces, &key_package)?;
signature_shares.insert(identifier, share);
}
////////////////////////////////////////////////////////////////////////////
// Finalization: Aggregation
////////////////////////////////////////////////////////////////////////////
let group_signature = frost::aggregate(
&signing_package,
&signature_shares,
&pubkey_package,
)?;
// Verification
group_public_key.verify(message, &group_signature)?;
println!("Threshold signature verified successfully!");
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example trusted-dealer --features nostr");
}
2026-04-05 04:10:43 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
use rand_chacha::ChaCha20Rng;
use rand_chacha::rand_core::SeedableRng;
use frost_secp256k1_tr as frost;
use frost::{Identifier, keys::IdentifierList, round1};
use std::collections::BTreeMap;
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. Setup deterministic dealer (Genesis State)
let mut dealer_rng = ChaCha20Rng::from_seed([0u8; 32]);
let (shares, _pubkey_package) = frost::keys::generate_with_dealer(
3, 2, IdentifierList::Default, &mut dealer_rng
)?;
// 2. Setup Participant 1
let p1_id = Identifier::try_from(1u16)?;
let p1_share = &shares[&p1_id];
// 3. Setup Nonce RNG
let mut nonce_rng = ChaCha20Rng::from_seed([1u8; 32]);
println!("--- BIP-64MOD Round 1: Batch Nonce Generation ---");
println!("Participant: {:?}", p1_id);
println!("Generating 10 Nonce Pairs...\n");
let mut batch_commitments = BTreeMap::new();
let mut batch_secrets = Vec::new();
for i in 0..10 {
// Generate a single pair
let (nonces, commitments) = round1::commit(p1_share.signing_share(), &mut nonce_rng);
// Store the secret nonces locally (index i)
batch_secrets.push(nonces);
// Store the public commitments in a map to share with the Coordinator
batch_commitments.insert(i, commitments);
println!("Nonce Pair [{}]:", i);
println!(" Hiding: {}", hex::encode(commitments.hiding().serialize()?));
println!(" Binding: {}", hex::encode(commitments.binding().serialize()?));
}
// 4. Persistence Simulation
// In a real GCC app, you would save `batch_secrets` to an encrypted file
// and send `batch_commitments` to a Nostr Relay (Kind 1351).
println!("\n✅ Batch generation complete.");
println!("Ready to sign up to 10 independent Git commits.");
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() { println!("Run with --features nostr"); }
2026-04-05 04:10:40 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
# GRASP-01 - Core Service Requirements
Status: DRAFT - expect breaking changes
## Nostr Relay
MUST serve a [NIP-01](https://nips.nostr.com/1) compliant nostr relay at `/` that accepts [git repository announcements](https://nips.nostr.com/34#repository-announcements) and their corresponding [repo state announcements](https://nips.nostr.com/34#repository-state-announcements).
MUST reject [git repository announcements](https://nips.nostr.com/34#repository-announcements) that do not list the service in both `clone` and `relays` tags unless implementing `GRASP-05`.
MAY reject [git repository announcements](https://nips.nostr.com/34#repository-announcements) based on other criteria such as pre-payment, quotas, WoT, whitelist, SPAM prevention, etc.
MUST accept other events that tag, or are tagged by, either:
1. accepted [git repository announcements](https://nips.nostr.com/34#repository-announcements); or
2. accepted [issues](https://nips.nostr.com/34#issues) or [patches](https://nips.nostr.com/34#patches)
MAY reject or delete events for generic SPAM prevention reasons or curation eg. WoT, whitelist, user bans and banned topics.
MUST serve a [NIP-11](https://nips.nostr.com/11) document:
1. MUST list each supported GRASP under `supported_grasps` in format `GRASP-XX` eg `GRASP-01` as a string array
2. MUST list repository acceptance criteria under `repo_acceptance_criteria` as a human readable string
3. MUST list brief summary of curation policy under `curation` if events are curated beyond generic SPAM prevention; otherwise `curation` MUST be ommitted
## Git Smart HTTP Service
MUST serve a git repository via an unauthenticated [git smart http service](https://github.com/git/git/blob/master/Documentation/gitprotocol-http.adoc) at `/<npub>/<identifier>.git` for each accepted [git repository announcement](https://nips.nostr.com/34#repository-announcements).
MUST accept pushes via this service that match the latest [repo state announcement](https://nips.nostr.com/34#repository-state-announcements) on the relay, respecting the recursive maintainer set.
MUST set repository HEAD per [repo state announcement](https://nips.nostr.com/34#repository-state-announcements) as soon as the git data related to that branch has been received.
MUST accept pushes via this service to `refs/nostr/<event-id>` but SHOULD reject if event exists on relay listing a different tip and MAY reject based on criteria such as size, SPAM prevention, etc. SHOULD delete and MAY garbage collect these refs if no corresponding [git PR event](https://nips.nostr.com/34#pull-requests) or [git PR update event](https://nips.nostr.com/34#pull-request-updates), with a `c` tag that matches the ref tip, is accepted by relay with 20 minutes.
MUST include `allow-reachable-sha1-in-want` and `allow-tip-sha1-in-want` in advertisement and serve available oids.
SHOULD serve a webpage at the same endpoint linking to git nostr client(s) to browse the repository and a 404 page for repositories it doesn't host.
### CORS Support
To enable cross-origin access for web-based Git clients, implementations MUST support the following CORS configuration:
1. Set `Access-Control-Allow-Origin: *` on ALL responses
2. Set `Access-Control-Allow-Methods: GET, POST` on ALL responses
3. Set `Access-Control-Allow-Headers: Content-Type` on ALL responses
4. Respond to OPTIONS requests with 204 No Content
2026-04-05 04:10:36 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[tokio::main]
#[cfg(feature = "nostr")]
async fn main() {
use get_file_hash_core::publish_repository_state;
use nostr_sdk::Keys;
let keys = Keys::generate();
let relay_urls = get_file_hash_core::get_relay_urls();
let d_tag = "my-awesome-repo-example";
let branch_name = "main";
let commit_id = "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0";
println!("Publishing repository state...");
publish_repository_state!(
&keys,
&relay_urls,
d_tag,
branch_name,
commit_id
);
println!("Repository state published.");
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example publish_repository_state --features nostr");
}
2026-04-05 04:10:33 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[cfg(feature = "nostr")]
use get_file_hash_core::{get_git_tracked_files, DEFAULT_GNOSTR_KEY, DEFAULT_PICTURE_URL, DEFAULT_BANNER_URL, publish_nostr_event_if_release, get_repo_announcement_event, publish_patch_event};
#[cfg(feature = "nostr")]
#[tokio::main]
async fn main() {
use get_file_hash_core::publish_patch;
use nostr_sdk::Keys;
use nostr_sdk::EventId;
use std::str::FromStr;
let keys = Keys::generate();
let relay_urls = get_file_hash_core::get_relay_urls();
let d_tag = "my-awesome-repo-example";
let commit_id = "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"; // Example commit ID
// Dummy EventId for examples that require a build_manifest_event_id
const DUMMY_BUILD_MANIFEST_ID_STR: &str = "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0";
let dummy_build_manifest_id = EventId::from_str(DUMMY_BUILD_MANIFEST_ID_STR).unwrap();
// Example 1: Without build_manifest_event_id
println!("Publishing patch without build_manifest_event_id...");
publish_patch!(
&keys,
&relay_urls,
d_tag,
commit_id,
"../Cargo.toml" // Use an existing file for the patch content
);
println!("Patch without build_manifest_event_id published.");
// Example 2: With build_manifest_event_id
println!("Publishing patch with build_manifest_event_id...");
publish_patch!(
&keys,
&relay_urls,
d_tag,
commit_id,
"../Cargo.toml", // Use an existing file for the patch content
Some(&dummy_build_manifest_id)
);
println!("Patch with build_manifest_event_id published.");
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example publish_patch --features nostr");
}
2026-04-05 04:10:31 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
use rand_chacha::ChaCha20Rng;
use rand_chacha::rand_core::SeedableRng;
use frost_secp256k1_tr as frost;
use frost::{Identifier, keys::IdentifierList, round1, round2};
use std::collections::BTreeMap;
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. Dealer Setup
let mut dealer_rng = ChaCha20Rng::from_seed([0u8; 32]);
let min_signers = 2;
let (shares, pubkey_package) = frost::keys::generate_with_dealer(
3, min_signers, IdentifierList::Default, &mut dealer_rng
)?;
// 2. Setup Participant Identifiers
let p1_id = Identifier::try_from(1u16)?;
let p2_id = Identifier::try_from(2u16)?;
// 3. Construct KeyPackages manually for RC.0
let p1_verifying_share = frost::keys::VerifyingShare::from(*shares[&p1_id].signing_share());
let p1_key_package = frost::keys::KeyPackage::new(
p1_id,
*shares[&p1_id].signing_share(),
p1_verifying_share,
*pubkey_package.verifying_key(),
min_signers,
);
let p2_verifying_share = frost::keys::VerifyingShare::from(*shares[&p2_id].signing_share());
let p2_key_package = frost::keys::KeyPackage::new(
p2_id,
*shares[&p2_id].signing_share(),
p2_verifying_share,
*pubkey_package.verifying_key(),
min_signers,
);
// 4. Round 1: Commitments
let mut rng1 = ChaCha20Rng::from_seed([1u8; 32]);
let (p1_nonces, p1_commitments) = round1::commit(p1_key_package.signing_share(), &mut rng1);
let mut rng2 = ChaCha20Rng::from_seed([2u8; 32]);
let (p2_nonces, p2_commitments) = round1::commit(p2_key_package.signing_share(), &mut rng2);
// 5. Coordinator: Signing Package
let message = b"gnostr-commit-7445bd727dbce5bac004861a45c35ccd4f4a195bfb1cc39f2a7c9fd3aa3b6547";
let mut commitments_map = BTreeMap::new();
commitments_map.insert(p1_id, p1_commitments);
commitments_map.insert(p2_id, p2_commitments);
let signing_package = frost::SigningPackage::new(commitments_map, message);
// 6. Round 2: Partial Signatures
let p1_signature_share = round2::sign(&signing_package, &p1_nonces, &p1_key_package)?;
let p2_signature_share = round2::sign(&signing_package, &p2_nonces, &p2_key_package)?;
// 7. Aggregation
let mut signature_shares = BTreeMap::new();
signature_shares.insert(p1_id, p1_signature_share);
signature_shares.insert(p2_id, p2_signature_share);
let group_signature = frost::aggregate(&signing_package, &signature_shares, &pubkey_package)?;
println!("--- BIP-64MOD Aggregated Signature ---");
println!("Final Signature (Hex): {}", hex::encode(group_signature.serialize()?));
// Final Verification
pubkey_package.verifying_key().verify(message, &group_signature)?;
println!("🛡️ Signature is valid for the 2nd generation group!");
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() { println!("Run with --features nostr"); }
2026-04-05 04:10:31 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[cfg(feature = "nostr")]
use frost_secp256k1_tr as frost;
#[cfg(feature = "nostr")]
use rand::thread_rng;
#[cfg(feature = "nostr")]
use std::collections::BTreeMap;
/// A simplified ROAST Coordinator that manages signing sessions
#[cfg(feature = "nostr")]
struct RoastCoordinator {
min_signers: u16,
_message: Vec<u8>,
commitments: BTreeMap<frost::Identifier, frost::round1::SigningCommitments>,
nonces: BTreeMap<frost::Identifier, frost::round1::SigningNonces>,
shares: BTreeMap<frost::Identifier, frost::round2::SignatureShare>,
}
#[cfg(feature = "nostr")]
impl RoastCoordinator {
fn new(min_signers: u16, message: &[u8]) -> Self {
Self {
min_signers,
_message: message.to_vec(),
commitments: BTreeMap::new(),
nonces: BTreeMap::new(),
shares: BTreeMap::new(),
}
}
/// ROAST Logic: Collect commitments until we hit the threshold.
/// In a real P2P system, this would be an async stream handler.
fn add_commitment(&mut self, id: frost::Identifier, comms: frost::round1::SigningCommitments, nonces: frost::round1::SigningNonces) {
if self.commitments.len() < self.min_signers as usize {
self.commitments.insert(id, comms);
self.nonces.insert(id, nonces);
}
}
/// ROAST Logic: Collect signature shares.
fn add_share(&mut self, id: frost::Identifier, share: frost::round2::SignatureShare) {
if self.shares.len() < self.min_signers as usize {
self.shares.insert(id, share);
}
}
fn is_ready_to_sign(&self) -> bool {
self.commitments.len() >= self.min_signers as usize
}
fn is_ready_to_aggregate(&self) -> bool {
self.shares.len() >= self.min_signers as usize
}
}
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut rng = thread_rng();
let (max_signers, min_signers) = (5, 3);
let message = b"BIP-64MOD Context: ROAST Coordination";
// 1. Setup: Generate keys (Dealer mode for simulation)
let (key_shares, pubkey_package) = frost::keys::generate_with_dealer(
max_signers,
min_signers,
frost::keys::IdentifierList::Default,
&mut rng,
)?;
let mut coordinator = RoastCoordinator::new(min_signers, message);
// 2. Round 1: Asynchronous Commitment Collection
// Simulate signers 1, 3, and 5 responding first (ROAST skips 2 and 4)
for &id_num in &[1, 3, 5] {
let id = frost::Identifier::try_from(id_num as u16)?;
let (nonces, comms) = frost::round1::commit(key_shares[&id].signing_share(), &mut rng);
// Signers store their nonces locally, send comms to coordinator
coordinator.add_commitment(id, comms, nonces);
// Note: Signer 2 was "offline", but ROAST doesn't care because we hit 3/5.
}
// 3. Round 2: Signing
if coordinator.is_ready_to_sign() {
let signing_package = frost::SigningPackage::new(coordinator.commitments.clone(), message);
let mut temp_shares = BTreeMap::new();
for &id in coordinator.commitments.keys() {
// In reality, coordinator sends signing_package to signers
// Here we simulate the signers producing shares
let nonces = &coordinator.nonces[&id];
let key_package: frost::keys::KeyPackage = key_shares[&id].clone().try_into()?;
let share = frost::round2::sign(&signing_package, &nonces, &key_package)?;
temp_shares.insert(id, share);
}
for (id, share) in temp_shares {
coordinator.add_share(id, share);
}
}
// 4. Finalization: Aggregation
if coordinator.is_ready_to_aggregate() {
let signing_package = frost::SigningPackage::new(coordinator.commitments.clone(), message);
let group_signature = frost::aggregate(
&signing_package,
&coordinator.shares,
&pubkey_package,
)?;
pubkey_package.verifying_key().verify(message, &group_signature)?;
println!("ROAST-coordinated signature verified!");
}
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example roast-experiment --features nostr");
}
2026-04-05 04:10:29 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
nixpkgs,
rust-overlay,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
in
with pkgs;
{
devShells.default = mkShell {
packages = [
cargo-msrv
git-cliff
just
nushell
protobuf
taplo
];
nativeBuildInputs = [
(lib.hiPrio rust-bin.nightly."2026-02-21".rustfmt)
(rust-bin.stable.latest.default.override {
extensions = [ "llvm-tools-preview" ];
})
rust-analyzer
];
shellHook = ''
export N34_RELAY_BASE_DIR=relay_base
export RUST_LOG=debug
'';
};
packages.default =
let
manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
in
with pkgs;
rustPlatform.buildRustPackage {
pname = manifest.name;
version = manifest.version;
cargoLock.lockFile = ./Cargo.lock;
src = lib.cleanSource ./.;
nativeBuildInputs = [ protobuf ];
meta = {
inherit (manifest) description homepage;
license = lib.licenses.agpl3Plus;
};
};
}
);
}
2026-04-05 04:10:25 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[tokio::main]
#[cfg(feature = "nostr")]
async fn main() {
use get_file_hash_core::publish_pull_request;
use nostr_sdk::Keys;
use nostr_sdk::EventId;
use std::str::FromStr;
let keys = Keys::generate();
let relay_urls = get_file_hash_core::get_relay_urls();
let d_tag = "my-awesome-repo-example";
let commit_id = "0123456789abcdef0123456789abcdef01234567";
let clone_url = "[email protected]:user/my-feature-branch.git";
let title = Some("Feat: Add new awesome feature example");
// Dummy EventId for examples that require a build_manifest_event_id
const DUMMY_BUILD_MANIFEST_ID_STR: &str = "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0";
let dummy_build_manifest_id = EventId::from_str(DUMMY_BUILD_MANIFEST_ID_STR).unwrap();
// Example 1: Without title and build_manifest_event_id
println!("Publishing pull request without title and build_manifest_event_id...");
publish_pull_request!(
&keys,
&relay_urls,
d_tag,
commit_id,
clone_url
);
println!("Pull request without title and build_manifest_event_id published.");
// Example 2: With title but without build_manifest_event_id
println!("Publishing pull request with title but without build_manifest_event_id...");
publish_pull_request!(
&keys,
&relay_urls,
d_tag,
commit_id,
clone_url,
title
);
println!("Pull request with title but without build_manifest_event_id published.");
// Example 3: With build_manifest_event_id but without title
println!("Publishing pull request with build_manifest_event_id but without title...");
publish_pull_request!(
&keys,
&relay_urls,
d_tag,
commit_id,
clone_url,
None, // Explicitly pass None for title
Some(&dummy_build_manifest_id)
);
println!("Pull request with build_manifest_event_id but without title published.");
// Example 4: With title and build_manifest_event_id
println!("Publishing pull request with title and build_manifest_event_id...");
publish_pull_request!(
&keys,
&relay_urls,
d_tag,
commit_id,
clone_url,
title,
Some(&dummy_build_manifest_id)
);
println!("Pull request with title and build_manifest_event_id published.");
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example publish_pull_request --features nostr");
}
2026-04-05 04:10:20 UTC npub1u7lcmtfkpq50q2ym0d975xsm628td4xk2gh6zlu40cxlhqu770dslk7jgm by npub1u7l…7jgm
Block 943717
1 - high priority
1 - medium priority
1 - low priority
1 - no priority
1 - purging
#bitcoinfees #mempool
2026-04-05 04:10:20 UTC npub17q7l84qnggcyyrxl0t9mxhuk5f2zgfpyd2c99w3ycmlvdfx57emqazk5dk by npub17q7…k5dk
Block 943717
1 - high priority
1 - medium priority
1 - low priority
1 - no priority
1 - purging
#bitcoinfees #mempool
2026-04-05 04:10:20 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[cfg(feature = "nostr")]
use get_file_hash_core::{get_relay_urls, publish_issue, DEFAULT_GNOSTR_KEY, DEFAULT_PICTURE_URL, DEFAULT_BANNER_URL, publish_nostr_event_if_release, get_repo_announcement_event, publish_patch_event};
#[cfg(feature = "nostr")]
#[tokio::main]
async fn main() {
use nostr_sdk::Keys;
use nostr_sdk::EventId;
use std::str::FromStr;
let keys = Keys::generate();
let relay_urls = get_relay_urls();
let d_tag = "my-gnostr-repository-issue-example"; // Repository identifier
let issue_id_1 = "issue-001"; // Unique identifier for the first issue
let issue_id_2 = "issue-002"; // Unique identifier for the second issue
let title_1 = "Bug: Application crashes on startup";
let content_1 = "The application fails to launch on macOS Ventura. It throws a 'Segmentation Fault' error immediately after execution. This was observed on version `v1.2.3`.
Steps to reproduce:
1. Download `app-v1.2.3-macos.tar.gz`
2. Extract the archive
3. Run `./app`
Expected behavior: Application launches successfully.
Actual behavior: Application crashes with 'Segmentation Fault'.";
let title_2 = "Feature Request: Dark Mode";
let content_2 = "Users have requested a dark mode option to improve readability and reduce eye strain during prolonged use. This should be toggleable in the settings menu.
Considerations:
- Adherence to system dark mode settings.
- Consistent styling across all UI components.";
// Dummy EventId for examples that require a build_manifest_event_id
const DUMMY_BUILD_MANIFEST_ID_STR: &str = "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0";
let dummy_build_manifest_id = EventId::from_str(DUMMY_BUILD_MANIFEST_ID_STR).unwrap();
// Example 1: Publish an issue without build_manifest_event_id
println!("Publishing issue '{}' without build_manifest_event_id...", title_1);
publish_issue!(
&keys,
&relay_urls,
d_tag,
issue_id_1,
title_1,
content_1
);
println!("Issue '{}' published.", title_1);
// Example 2: Publish an issue with build_manifest_event_id
println!("Publishing issue '{}' with build_manifest_event_id...", title_2);
publish_issue!(
&keys,
&relay_urls,
d_tag,
issue_id_2,
title_2,
content_2,
Some(&dummy_build_manifest_id)
);
println!("Issue '{}' published.", title_2);
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example publish_issue --features nostr");
}
2026-04-05 04:10:19 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1774106199,
"narHash": "sha256-US5Tda2sKmjrg2lNHQL3jRQ6p96cgfWh3J1QBliQ8Ws=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6c9a78c09ff4d6c21d0319114873508a6ec01655",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1744536153,
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1774408260,
"narHash": "sha256-Jn9d9r85dmf3gTMnSRt6t+DP2nQ5uJns/MMXg2FpzfM=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "d6471ee5a8f470251e6e5b83a20a182eb6c46c9b",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
2026-04-05 04:10:18 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
use rand_chacha::ChaCha20Rng;
use rand_chacha::rand_core::SeedableRng;
use frost_secp256k1_tr as frost;
use frost::{Identifier, keys::IdentifierList};
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. We need the dealer setup first to get a real SigningShare
let dealer_seed = [0u8; 32];
let mut dealer_rng = ChaCha20Rng::from_seed(dealer_seed);
let (shares, _pubkey_package) = frost::keys::generate_with_dealer(
3, 2, IdentifierList::Default, &mut dealer_rng
)?;
// 2. Setup nonce RNG
let nonce_seed = [1u8; 32];
let mut rng = ChaCha20Rng::from_seed(nonce_seed);
// 3. Get Participant 1's share
let p1_id = Identifier::try_from(1u16)?;
let p1_share = shares.get(&p1_id).ok_or("Share not found")?;
////////////////////////////////////////////////////////////////////////////
// Round 1: Commitments & Nonces
////////////////////////////////////////////////////////////////////////////
// In RC.0, commit() requires the secret share reference
let (p1_nonces, p1_commitments) = frost::round1::commit(p1_share.signing_share(), &mut rng);
println!("--- BIP-64MOD Round 1: Nonce Generation ---");
println!("Participant Identifier: {:?}", p1_id);
// 4. Handle Results for serialization
println!("\nPublic Signing Commitments (To be shared):");
println!(" Hiding: {}", hex::encode(p1_commitments.hiding().serialize()?));
println!(" Binding: {}", hex::encode(p1_commitments.binding().serialize()?));
// Keep nonces in memory for the next step
let _p1_secret_nonces = p1_nonces;
println!("\n✅ Nonces generated and tied to Participant 1's share.");
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("Run with --features nostr to enable this example.");
}
2026-04-05 04:10:17 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[tokio::main]
#[cfg(feature = "nostr")]
#[allow(unused_imports)]
async fn main() {
use get_file_hash_core::repository_announcement;
use get_file_hash_core::get_file_hash;
use nostr_sdk::Keys;
use sha2::{Digest, Sha256};
use nostr_sdk::EventId;
use std::str::FromStr;
let keys = Keys::generate();
let relay_urls = get_file_hash_core::get_relay_urls();
let project_name = "my-awesome-repo-example";
let description = "A fantastic new project example.";
let clone_url = "[email protected]:user/my-awesome-repo-example.git";
// Dummy EventId for examples that require a build_manifest_event_id
const DUMMY_BUILD_MANIFEST_ID_STR: &str = "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0";
let dummy_build_manifest_id = EventId::from_str(DUMMY_BUILD_MANIFEST_ID_STR).unwrap();
// Example 1: Without build_manifest_event_id
println!("Publishing repository announcement without build_manifest_event_id...");
repository_announcement!(
&keys,
&relay_urls,
project_name,
description,
clone_url,
"../Cargo.toml" // Use a known file in your project
);
println!("Repository announcement without build_manifest_event_id published.");
// Example 2: With build_manifest_event_id
println!("Publishing repository announcement with build_manifest_event_id...");
repository_announcement!(
&keys,
&relay_urls,
project_name,
description,
clone_url,
"../Cargo.toml", // Use a known file in your project
Some(&dummy_build_manifest_id)
);
println!("Repository announcement with build_manifest_event_id published.");
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example repository_announcement --features nostr");
}
2026-04-05 04:10:12 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[tokio::main]
#[cfg(feature = "nostr")]
async fn main() {
use get_file_hash_core::publish_pr_update;
use nostr_sdk::Keys;
use nostr_sdk::EventId;
use std::str::FromStr;
let keys = Keys::generate();
let relay_urls = get_file_hash_core::get_relay_urls();
let d_tag = "my-awesome-repo-example";
let pr_event_id = EventId::from_str("f6e4d6a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9").unwrap(); // Example PR Event ID
let updated_commit_id = "z9y8x7w6v5u4t3s2r1q0p9o8n7m6l5k4j3i2h1g0";
let updated_clone_url = "[email protected]:user/my-feature-branch-v2.git";
// Dummy EventId for examples that require a build_manifest_event_id
const DUMMY_BUILD_MANIFEST_ID_STR: &str = "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0";
let dummy_build_manifest_id = EventId::from_str(DUMMY_BUILD_MANIFEST_ID_STR).unwrap();
// Example 1: Without build_manifest_event_id
println!("Publishing PR update without build_manifest_event_id...");
publish_pr_update!(
&keys,
&relay_urls,
d_tag,
&pr_event_id,
updated_commit_id,
updated_clone_url
);
println!("PR update without build_manifest_event_id published.");
// Example 2: With build_manifest_event_id
println!("Publishing PR update with build_manifest_event_id...");
publish_pr_update!(
&keys,
&relay_urls,
d_tag,
&pr_event_id,
updated_commit_id,
updated_clone_url,
Some(&dummy_build_manifest_id)
);
println!("PR update with build_manifest_event_id published.");
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example publish_pr_update --features nostr");
}
2026-04-05 04:10:07 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
//! Plugins Service Example
//!
//! A basic guide to designing your plugins service. Feel free to refine or
//! improve this approach.
use std::{
collections::HashMap,
net::{Ipv4Addr, SocketAddr, SocketAddrV4},
str::FromStr,
sync::Arc,
time::{SystemTime, UNIX_EPOCH},
};
use axum::Extension;
use parking_lot::{Mutex, RwLock};
use strum::{AsRefStr, EnumIter, EnumString, IntoEnumIterator};
use tonic::{Code, Request, Response, Status, transport::Server};
use self::plugins_api::{
Empty,
PluginInfo,
PluginPriority,
PluginRequest,
PluginResponse,
PluginType,
ServicePlugins,
plugin_request::PluginRequestBody,
plugin_response::PluginResponseBody,
plugins_service_server::{PluginsService, PluginsServiceServer},
};
mod plugins_api {
tonic::include_proto!("plugins");
}
struct Service;
struct PluginsState {
max_tags_count: usize,
events_per_day: usize,
last_db_wibed: RwLock<u64>,
db: Mutex<HashMap<String, usize>>,
}
impl PluginsState {
/// Initialize the state
fn new() -> Self {
Self {
max_tags_count: 30,
events_per_day: 5,
last_db_wibed: RwLock::new(current_time()),
db: Mutex::new(HashMap::new()),
}
}
}
/// Service plugins.
#[derive(Debug, EnumIter, EnumString, AsRefStr)]
#[strum(serialize_all = "snake_case")]
enum Plugins {
/// Restricts the number of tags allowed per event.
TagsLimit,
/// Sets a daily limit on the number of events that can be broadcasted for
/// each public key.
EventsPerDay,
/// Prevents the listing of relay kind 1 events (text notes).
NoKindOne,
}
impl Plugins {
/// Returns the plugins info
fn plugins_info() -> Vec<PluginInfo> {
let mut plugins = Vec::new();
for plugin in Self::iter() {
plugins.push(PluginInfo {
name: plugin.as_ref().to_owned(),
plugin_type: plugin.plugin_type() as i32,
priority: plugin.plugin_priority() as i32,
});
}
plugins
}
/// Returns the plugin type
#[inline]
fn plugin_type(&self) -> PluginType {
match self {
Self::TagsLimit => PluginType::Write,
Self::EventsPerDay => PluginType::Write,
Self::NoKindOne => PluginType::Query,
}
}
/// Returns the plugin priority
#[inline]
fn plugin_priority(&self) -> PluginPriority {
PluginPriority::All
}
/// Run write plugin
async fn run_write(
&self,
event: plugins_api::Event,
state: Arc<PluginsState>,
) -> Result<(), String> {
assert_eq!(self.plugin_type(), PluginType::Write);
match self {
Self::TagsLimit => run_tags_limit(event, state).await,
Self::EventsPerDay => run_events_per_day(event, state).await,
_ => unreachable!(), // You must make sure to include all write plugins
}
}
/// Run query plugin
async fn run_query(
&self,
filter: plugins_api::Filter,
_state: Arc<PluginsState>,
) -> Result<(), String> {
assert_eq!(self.plugin_type(), PluginType::Query);
match self {
Self::NoKindOne => run_no_kind_one(filter).await,
_ => unreachable!(), // You must make sure to include all query plugins
}
}
}
#[tonic::async_trait]
impl PluginsService for Service {
async fn run_plugin(
&self,
request: Request<PluginRequest>,
) -> Result<Response<PluginResponse>, Status> {
let state = Arc::clone(request.extensions().get::<Arc<PluginsState>>().unwrap());
let request = request.into_inner();
let Ok(plugin) = Plugins::from_str(&request.plugin_name) else {
return Err(Status::new(
Code::InvalidArgument,
format!("Unknown plugin: {}", request.plugin_name),
));
};
let Some(body) = request.plugin_request_body else {
return Err(Status::new(
Code::InvalidArgument,
"Missing the request body",
));
};
let result = match body {
PluginRequestBody::Event(event) => {
if matches!(plugin.plugin_type(), PluginType::Query) {
return Err(Status::new(
Code::InvalidArgument,
format!(
"plugin '{}' is query plugin but received an event",
plugin.as_ref()
),
));
}
plugin.run_write(event, state).await
}
PluginRequestBody::Filter(filter) => {
if matches!(plugin.plugin_type(), PluginType::Write) {
return Err(Status::new(
Code::InvalidArgument,
format!(
"plugin '{}' is write plugin but received a filter",
plugin.as_ref()
),
));
}
plugin.run_query(filter, state).await
}
};
match result {
Ok(()) => {
Ok(Response::new(PluginResponse {
plugin_response_body: Some(PluginResponseBody::Accept(Empty {})),
}))
}
Err(reject_msg) => {
Ok(Response::new(PluginResponse {
plugin_response_body: Some(PluginResponseBody::RejectMsg(reject_msg)),
}))
}
}
}
async fn get_plugins(&self, _: Request<Empty>) -> Result<Response<ServicePlugins>, Status> {
Ok(Response::new(ServicePlugins {
plugins: Plugins::plugins_info(),
}))
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let address = SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::LOCALHOST, 8080));
println!("Service Address: 127.0.0.1:8080");
Server::builder()
.layer(Extension(Arc::new(PluginsState::new())))
.add_service(PluginsServiceServer::new(Service))
.serve(address)
.await?;
Ok(())
}
fn current_time() -> u64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.map(|d| d.as_secs())
.unwrap_or(u64::MAX)
}
// --- Plugins --- //
async fn run_tags_limit(event: plugins_api::Event, state: Arc<PluginsState>) -> Result<(), String> {
if event.tags.len() > state.max_tags_count {
return Err(format!(
"Too many tags in the event, the limit is {}",
state.max_tags_count
));
}
Ok(())
}
async fn run_events_per_day(
event: plugins_api::Event,
state: Arc<PluginsState>,
) -> Result<(), String> {
let mut db = state.db.lock();
let count = db.entry(event.public_key).or_insert(1);
if *count >= state.events_per_day {
return Err("You exceeded your daily limit".to_owned());
}
*count += 1;
// For testing purposes, the DB is cleared every 5 minutes. In a production
// environment, this operation should occur every 24 hours, and a persistent
// database should be used instead of an in-memory one. :)
let now_time = current_time();
if { now_time - *state.last_db_wibed.read() } >= 60 * 5 {
*state.last_db_wibed.write() = now_time;
*db = HashMap::new();
}
Ok(())
}
async fn run_no_kind_one(filter: plugins_api::Filter) -> Result<(), String> {
if filter.ids.is_empty() && filter.authors.is_empty() && filter.kinds.contains(&1) {
return Err("Exploring relay notes is not permitted".to_owned());
}
Ok(())
}
2026-04-05 04:10:06 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
use frost_secp256k1_tr as frost;
use frost::{Identifier, round1, round2};
use rand_chacha::ChaCha20Rng;
use rand_chacha::rand_core::SeedableRng;
use std::collections::BTreeMap;
use std::fs;
#[cfg(feature = "nostr")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. Load the persistent KeyPackage
let p1_json = fs::read_to_string("p1_key.json")?;
let p1_key_pkg: frost::keys::KeyPackage = serde_json::from_str(&p1_json)?;
let p1_id = *p1_key_pkg.identifier();
println!("--- BIP-64MOD: Batch Nonce Management ---");
// 2. BATCH GENERATION (The "Public Offer")
let mut rng = ChaCha20Rng::from_seed([88u8; 32]);
let mut public_commitments = BTreeMap::new();
let mut secret_nonce_vault = BTreeMap::new();
for i in 0..5 {
let (nonces, commitments) = round1::commit(p1_key_pkg.signing_share(), &mut rng);
public_commitments.insert(i, commitments);
secret_nonce_vault.insert(i, nonces);
}
// Save the vault (Private)
fs::write("p1_batch_vault.json", serde_json::to_string(&secret_nonce_vault)?)?;
println!("✅ Signer: Generated 5 nonces and saved to p1_batch_vault.json");
// 3. COORDINATOR REQUEST (Choosing Index #3)
let message = b"gnostr-gcc-batch-commit-hash-003";
let selected_index: u64 = 3;
let mut commitments_map = BTreeMap::new();
// Coordinator uses P1's commitment at the specific index
commitments_map.insert(p1_id, public_commitments[&selected_index]);
// Mock P2 to satisfy threshold
let mock_p2_id = Identifier::try_from(2u16)?;
let (_, p2_commitments) = round1::commit(p1_key_pkg.signing_share(), &mut rng);
commitments_map.insert(mock_p2_id, p2_commitments);
let signing_package = frost::SigningPackage::new(commitments_map, message);
println!("\n🚀 Coordinator: Requesting signature for Index #{}", selected_index);
// 4. SIGNER: Selective Fulfillment
let mut current_vault: BTreeMap<u64, round1::SigningNonces> =
serde_json::from_str(&fs::read_to_string("p1_batch_vault.json")?)?;
// Extract only the requested nonce
if let Some(p1_nonces) = current_vault.remove(&selected_index) {
let p1_share = round2::sign(&signing_package, &p1_nonces, &p1_key_pkg)?;
// Save the updated vault (Index 3 is now GONE)
fs::write("p1_batch_vault.json", serde_json::to_string(&current_vault)?)?;
println!("✅ Signer: Signed message using Index #{}", selected_index);
println!("✅ Signer: Partial Signature: {}", hex::encode(p1_share.serialize()));
println!("🛡️ Signer: Index #{} purged from vault. {} nonces remain.",
selected_index, current_vault.len());
} else {
println!("❌ Error: Nonce index {} has already been used!", selected_index);
}
Ok(())
}
#[cfg(not(feature = "nostr"))]
fn main() { println!("Enable nostr feature."); }
2026-04-05 04:10:06 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[tokio::main]
#[cfg(feature = "nostr")]
async fn main() {
use get_file_hash_core::publish_repository_state;
use nostr_sdk::Keys;
let keys = Keys::generate();
let relay_urls = get_file_hash_core::get_relay_urls();
let d_tag = "my-awesome-repo-example";
let branch_name = "main";
let commit_id = "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0";
println!("Publishing repository state...");
publish_repository_state!(
&keys,
&relay_urls,
d_tag,
branch_name,
commit_id
);
println!("Repository state published.");
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example publish_repository_state --features nostr");
}
2026-04-05 04:10:00 UTC npub127u525u3l674p6l40c72u4ptxvumhfa0hu4pyjztnrw7vpppmvrqun5r64 by npub127u…5r64
#[cfg(feature = "nostr")]
use get_file_hash_core::{get_relay_urls, publish_patch, publish_metadata_event, DEFAULT_PICTURE_URL, DEFAULT_BANNER_URL};
#[cfg(feature = "nostr")]
#[tokio::main]
async fn main() {
use nostr_sdk::Keys;
use nostr_sdk::EventId;
use std::str::FromStr;
let keys = Keys::generate();
let relay_urls = get_relay_urls();
let d_tag = "my-gnostr-repository-patch-with-metadata-example"; // Repository identifier
let commit_id = "f1e2d3c4b5a6f7e8d9c0b1a2f3e4d5c6b7a8f9e0"; // Example commit ID
// Metadata for NIP-01 event
let picture_url = DEFAULT_PICTURE_URL;
let banner_url = DEFAULT_BANNER_URL;
let metadata_file_path = "./README.md"; // Using README.md content for metadata
// Dummy EventId for examples that require a build_manifest_event_id
const DUMMY_BUILD_MANIFEST_ID_STR: &str = "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0";
let dummy_build_manifest_id = EventId::from_str(DUMMY_BUILD_MANIFEST_ID_STR).unwrap();
println!("Publishing NIP-01 Metadata Event...");
publish_metadata_event(
&keys,
&relay_urls,
picture_url,
banner_url,
metadata_file_path
).await;
println!("NIP-01 Metadata Event published.");
println!("
Publishing NIP-34 Patch Event without build_manifest_event_id...");
publish_patch!(
&keys,
&relay_urls,
d_tag,
commit_id,
"../Cargo.toml" // Use an existing file for the patch content
);
println!("NIP-34 Patch Event without build_manifest_event_id published.");
println!("
Publishing NIP-34 Patch Event with build_manifest_event_id...");
publish_patch!(
&keys,
&relay_urls,
d_tag,
commit_id,
"../Cargo.toml", // Use an existing file for the patch content
Some(&dummy_build_manifest_id)
);
println!("NIP-34 Patch Event with build_manifest_event_id published.");
}
#[cfg(not(feature = "nostr"))]
fn main() {
println!("This example requires the 'nostr' feature. Please run with: cargo run --example publish_patch_with_metadata --features nostr");
}
Open in
Open in Your default app native
Open in Nostur ios
Open in Yakihonne android
Open in Yakihonne ios
Open in Jumble web
Open in YakiHonne web
Open in chachi web
Open in Nosotros web
Open in Lumilumi web
Open in Coracle web
Open in relay.tools web
Open in Nostter web
Open in Your default web app web
the source code for this service is free and open
this website is part of nostr.net