Store your nsec in a secure enclave! We've spent a big part of 2024 trying to make a reliable non-custodial signer with nsec.app. It hasn't worked out perfectly - remote access to keys stored on a mobile device is still unreliable, especially on iOS. That's why we got very interested in AWS Nitro Enclaves - h/t @Marks and MapleAI team for inspiration! The idea is to have an open-source custodial signer and deploy it in an isolated environment that provides attestation for the deployed code. Anyone would be able to reproduce the code build and verify that the signer is running the correct code in a safe environment. So here it is: Each instance of a signer deployed in an enclave announces itself on Nostr. We added some Nostr to attestation provided by AWS - the report is linked to pubkeys of a person building the code image, and a person running it. This way you can choose a signer based on your own preferences. It's already integrated into nsec.app, go to Settings => Secure enclave and try to upload your keys to the server. The signer API is described in README. image DO NOT deploy your real keys just yet - it's running in a production environment, but the code hasn't been well audited yet. First we need some community members to review the code and reproduce the code image. The signer can also be used to generate throwaway keys for automated testing of nip46 implementations, check out "generate_test_key" method. Looking forward to your feedback! (Signed by my nsec from the enclave)

Replies (43)

Niel Liesmons's avatar
Niel Liesmons 8 months ago
To onboard small-ish content creators. 1) create nsec that I don't see 2) publish their stuff + a #communikey around it 3) show them the interactions + zaps 4) hand over* *eeds a part in the code that you run inside the enclave that lets the onboarded creator export the nsec and proveably tell him this is the first time this happens
Niel Liesmons's avatar
Niel Liesmons 8 months ago
Wait, do they need to? If they can export the nsec, see it its the first that happens, then we don't need a third party, no? If it's not the first time, well they should ask questions, lol.
So you create an nsec for Taylor Swift and start reposting her insta pics on nostr, those get zapped, eventually you tell her about those sats and invite to take over the nsec. Is that the set up? Wouldn't you want to prove to enclave, somehow, that it's her? Otherwise someone could front-run her?
Niel Liesmons's avatar
Niel Liesmons 8 months ago
Wait wait wait, I'd have credentials for accessing the enclave, right? The point is to pass on those credentials and not the nsec. Also, if the service provider tries to rug us than we can still see that someone already exported the nsec.
Niel Liesmons's avatar
Niel Liesmons 8 months ago
Yup :Check: If I made a noob error in that logic, tell me por favor :prayinghands: If not, I can use this!
Niel Liesmons's avatar
Niel Liesmons 8 months ago
For example, I have no idea if the service can just swap out the whole enclave for another or something. But even if that's possible, they gain nothing except a bad rep.
Sounds fine, will see what I can do. One issue at this point is that if enclave is restarted, all the state is gone, so storage of long term assets is a challenge, especially while it's not yet production ready. But we will solve that, so eventually your idea is gonna work.
If the code is well written, enclave operator can only turn it off, not mess with it in any other way.
Niel Liesmons's avatar
Niel Liesmons 8 months ago
Ow damn, yeah didn't think of that, of course. Yeah, no stress. Def don't need this tomorrow :winkwithtongue:
Dont think can exist a provable inaccesible remote secret, and past iteration like intel SGX has been praised as a solution until they repeatedly demostrated to be broken. A secret that is containerized in isolated processes on someone else machine is no more a secret, even if that "solution" brings an enanchement over non-isolated cloud data secrecy, its still a non-solution.
Nothing to prove here, if you trust AWS virtualization infrastructure, then use it, otherwise ignore. There is always some root of trust.
Maybe I am missing something, but with a tool like Amber on a device that only I control, I am sure only I can use those keys, accept requests and sign, but with this enclave thing, which is "online" and you "connect" to it using a frontend (I guess), how does this work? Is the frontend part of nsec.app running client/browser side? How can I be sure only "my device" (as long as I don't delete website data/cookies of nsec.app ?) can access those keys? How does this differ from Amber?
Amber works great for apps on the same device. Cross device it has same issues as nsec.app - Amber is killed by mobile OS and can't process requests reliably. This enclaved signer can accept your nsec and process requests to it. You still retain your nsec and can control the signer with it, that's what nsec.app does. Your local key just can't be always-online. Does it make sense?
Mmhh I get what you say about the drawbacks of an in device signer like Amber (even though I think it depends on the usage one has with a nostr client), but I don't really understand the "you still retain your nsec and can control the signer with it", but probably it's just because I didn't fully understand the overall logic flow.
Really interesting option for custodial providers:
brugeman's avatar brugeman
Store your nsec in a secure enclave! We've spent a big part of 2024 trying to make a reliable non-custodial signer with nsec.app. It hasn't worked out perfectly - remote access to keys stored on a mobile device is still unreliable, especially on iOS. That's why we got very interested in AWS Nitro Enclaves - h/t @Marks and MapleAI team for inspiration! The idea is to have an open-source custodial signer and deploy it in an isolated environment that provides attestation for the deployed code. Anyone would be able to reproduce the code build and verify that the signer is running the correct code in a safe environment. So here it is: Each instance of a signer deployed in an enclave announces itself on Nostr. We added some Nostr to attestation provided by AWS - the report is linked to pubkeys of a person building the code image, and a person running it. This way you can choose a signer based on your own preferences. It's already integrated into nsec.app, go to Settings => Secure enclave and try to upload your keys to the server. The signer API is described in README. image DO NOT deploy your real keys just yet - it's running in a production environment, but the code hasn't been well audited yet. First we need some community members to review the code and reproduce the code image. The signer can also be used to generate throwaway keys for automated testing of nip46 implementations, check out "generate_test_key" method. Looking forward to your feedback! (Signed by my nsec from the enclave)
View quoted note →
It sounds like you solved delegation on Noster. Which means brands and content, creation teams get more easily, join the movement. First delegation solution I’ve heard of and I’ve asked at several Nostr meetups! Congrats
Niel Liesmons's avatar
Niel Liesmons 8 months ago
The creators that care about their IP are :110percent: the wrong ones to onboard.
Its not on Google play, its on zapstore and F-Droid. I tried for some months creating a Dev account for Google but the SMS verification worked only after 3 months, when it worked they changed my LLC name and rejected me from the KYC step so I gave up trying I always upload the aabs to the github repo so if anyone else has a Dev account they can upload it to the play store