Sign in safely with your existing Nostr account
Signing is how you approve an action on Nostr. You can use Amber on Android, a browser extension, or a remote signer—without giving the app your private key. This guide shows how to connect an account and how to tell whether approval really worked.
Browser extension — NIP-07
import { Nostr } from '@chaoticka/nsite-loopy-sdk';
const signer = Nostr.browserSigner(window.nostr);
const { pubkey } = await Nostr.connectIdentity(signer);
const event = await Nostr.checkedSign(
signer,
Nostr.textNote('Hello'),
pubkey
);
An unavailable or rejected window.nostr is an error, not a fallback to a bundled demo key.
Remote signing — NIP-46
const request = Nostr.nostrConnectRequest({
relays: ['wss://relay.example.net'],
name: 'Deepink',
});
const pending = request.start(); // start listening first
// Render a Copy connection action showing request.uri.
const signer = await pending; // waits for approved signer response
On one phone, let the user copy the connection URI, paste into their signer, approve, and return. Keep the same pending request while switching apps, and validate the connection secret. bunker:// signer-generated pairing is also supported through Nostr.bunkerSigner(uri); the connection URI is sensitive.
Android external signer — NIP-55
const uri = Nostr.androidIntent({
type: 'sign_event',
requestId: 'one-unique-attempt-id',
event: unsignedEvent,
currentPubkey: expectedPubkey,
callbackUrl: 'myapp://signin/return',
});
// Native host opens Amber and returns the result.
const signed = Nostr.verifyAndroidResult({
requestId: 'one-unique-attempt-id',
returnedId: response.id,
event: response.event,
template: unsignedEvent,
expectedPubkey,
rejected: response.rejected,
});
Use Adapters.androidHandoff({launch,onReturn}) only when the Android host actually supports external intents and result callbacks. A nostrsigner: link opening Amber does not prove return-path support.
Required verification
Match request/correlation ID, signer identity, original template, signed event ID and signature. Handle rejection, timeout, app-switch loss and account changes explicitly. The SDK's Android flow is source-inspected and locally tested, not verified on a physical device in this release.