30817:e5da1175-b80e-46fc-a457-0f0eae903b4a
NIP-SKD
NIP-SKD adds two signer capabilities: deriving app-scoped sub-keys from a user’s identity key in three forms (self, shared, and blinded), and operating as those sub-keys without ever exposing their private material to the client. The result is a private, deterministic keyspace of per-context identities, reproducible on any device holding the root key, unlinkable in public, and usable through remote or browser signers.
A release post was published for this: https://nostr-ps.top/s1inn863mrxnuddgjqwzcreuerriwek814mxztdza1uc454d16o58ece1
Abstract
NIP-SKD (Sub-Key Derivation) defines two signer capabilities:
- Deterministic derivation of application-scoped keys from the user's identity key, via HKDF (optionally combined with ECDH to a peer), under a fixed, versioned salt. Three forms are defined — a self key (from the root alone), a shared key (a fresh key both parties to an ECDH derive in full), and a blinded key (the root key blinded so the peer can derive its public key to verify, but never its private key).
- Operating as those derived keys ("sub-keys") without ever exposing their private material to the client.
Together they let an application give a user a private, deterministic keyspace: per-purpose, per-context identities (and other keyed constructs such as shared wallets) that are reproducible on any device holding the root key, unlinkable in public, and usable through remote/browser signers — because nothing sensitive ever crosses the signer boundary.
Motivation
Today's signers expose getPublicKey, signEvent, and NIP-04/44 encrypt/decrypt. They
compute ECDH(priv, peer) and HKDF internally for encryption, but expose neither a
scoped derivation nor a way to act as a derived key. Applications that need a stable,
unlinkable, per-context pseudonym (or any app-scoped key) therefore cannot support
remote/browser signers at all — the only value the signer will emit is a randomized
ciphertext.
Deterministic sub-keys deliberately trade some privacy for operability. They are less private than NIP-17 giftwraps — a stable per-context key is linkable within that context, where a giftwrap uses a fresh ephemeral key and a randomized timestamp every time. But that same randomness is exactly what makes giftwraps a moderation and spam-resistance nightmare: with no stable author and jittered timestamps, there is nothing to ban, rate, or order. A deterministic sub-key keeps a stable, verifiable pseudonymous identity — bannable, attestable, sortable — while still hiding the real key from the public. It is not a replacement for giftwraps but a different point on the tradeoff curve, useful wherever an application needs accountable pseudonymity rather than maximal unlinkability.
A group-chat protocol is the driving consumer: each member acts under a per-group pseudonym derived from their key (a blinded key, so the group owner can verify a pseudonym belongs to a member without being able to act as them), and each group is authored under a derived owner pseudonym (a self key), so that real identities never appear in public. But the mechanism is general: any app can carve out its own deterministic sub-keyspace.
Terminology
- root key — the user's active identity keypair (
root_priv,root_pub). - context — an application-supplied, non-empty, namespaced string identifying the purpose of a derivation. Public, not secret.
- form — one of
self,shared,blinded(§1). The form is part of the domain separation (it is folded into the HKDFinfo) and each form has its own operations (§2). - sub-key — a keypair deterministically derived from the root key and a context (and, for
the
sharedandblindedforms, a peer public key). Covers all three forms; where the distinction matters,blindedkeys are called out explicitly. - blinded key — a sub-key of the
blindedform:root_pub + t·Gwheretis a scalar derived from the two-party ECDH secret. The root holder can compute its private key (root_priv + t); the peer can compute only its public key (verify, not impersonate).
1. Derivation
Three forms, all HKDF-SHA256 (RFC 5869), all under the fixed salt "nip-skd-v1". The
HKDF info is domain-separated by form so no two forms ever share a seed on the same
inputs:
info(form, context) = "nip-skd:" ‖ form ‖ 0x1F ‖ context // form ∈ { "self", "shared", "blinded" }
0x1F is the ASCII unit separator; it makes the form/context boundary unforgeable — no
context value (even one literally starting with "blinded:") can impersonate another form's
prefix. salt, the form tag, and context are all UTF-8; 0x1F is a single raw byte.
Let reduce(seed) be the 48-byte (384-bit) HKDF output interpreted as a big-endian integer,
reduced mod n (the secp256k1 order), with the ~2^-384 case 0 pinned to 1 (see the note
below). xonly(·) is the x-coordinate (BIP-340). G is the generator, n the group order.
Self derivation (no peer) — an independent sub-key from your own root:
seed = HKDF-SHA256(IKM = root_priv, salt = "nip-skd-v1", info = info("self", context), L = 48)
sub_priv = reduce(seed)
sub_pub = xonly(sub_priv · G)
Shared derivation (peer public key) — an independent sub-key from the two-party ECDH secret;
both parties derive the identical keypair (ecdh_x is symmetric):
shared = secp256k1_ecdh_x(root_priv, peer_pub) // 32-byte X-coordinate, as NIP-44 uses
seed = HKDF-SHA256(IKM = shared, salt = "nip-skd-v1", info = info("shared", context), L = 48)
sub_priv = reduce(seed)
sub_pub = xonly(sub_priv · G)
Blinded derivation (peer public key) — the root key blinded by the two-party ECDH secret. The root holder gets the private key; the peer can derive only the public key (to verify a binding, never to sign as it):
shared = secp256k1_ecdh_x(root_priv, peer_pub)
seed = HKDF-SHA256(IKM = shared, salt = "nip-skd-v1", info = info("blinded", context), L = 48)
t = reduce(seed) // blinding scalar (tweak); reduce() pins t away from 0
blinded_priv = (root_priv_evenY + t) mod n
if blinded_priv == 0: blinded_priv = 1 // ~2^-256 invalid-key edge (t ≡ -root_priv)
blinded_pub = xonly( lift_even_y(root_pub) + t·G )
- Both directions land on the same
blinded_pub. The root holder derives it as above. A peer who holds the other ECDH private key derives the same key from the peer's side — see §2 (getPeerBlindedPubkeywhen that peer verifies as its root, or the composedgetPeerBlindedPubkeyVia{Self,Blinded}of §1.2 when it verifies as one of its sub-keys) becauseecdh_xis symmetric and the base is the root holder's key in both computations. The peer never obtainsblinded_priv; recovering it would requireroot_priv(a discrete log fromroot_pub).
The reduce pins. reduce(seed) maps the wide seed to [1, n-1], pinning 0 → 1. This keeps
every form total and deterministic:
- For self and shared,
reduce(seed)is the sub-key private scalar; the0 → 1pin is pure totality (which valid scalar the ~2^-384 case maps to is immaterial). - For blinded,
reduce(seed)is the tweakt, and the0pin is a hard requirement, not just totality:t = 0would makeblinded = root(the pseudonym would equal the real key, leaking it). Pinningtaway from0prevents that. The additionalblinded_priv == 0pin covers the other ~2^-256 edge,t ≡ -root_priv, which would otherwise yield an invalid key.
Even-y normalization (blinded only). Nostr/BIP-340 public keys are x-only and denote the even-y point, so the blinded key must be computed on that convention identically on both sides (the Taproot / BIP-341 key-tweak rule):
lift_even_y(root_pub)reconstructs the even-y point02‖xfrom the x-onlyroot_pub.root_priv_evenYis the scalar whose point is that even-y point:root_privifroot_priv·Galready has eveny, elsen − root_priv.
The root holder MUST add t to root_priv_evenY (not to the raw stored key), and the verifier MUST
add t·G to lift_even_y(root_pub) — otherwise an odd-y root_pub makes the two sides compute
different blinded_pub. (BIP-340 signing then handles the parity of blinded_pub itself, as usual.)
Why 48 bytes (wide reduction). Reducing exactly 256 bits
mod nwould be very slightly biased becausenis a hair below2^256. Per RFC 9380 §5, the seed isL = ceil((ceil(log2(n)) + k) / 8) = ceil((256 + 128) / 8) = 48bytes (a 128-bit security margin), which makesmod nunbiased by construction (statistical distance ≈ 2^-256). Implementations MUST take exactly 48 bytes from HKDF — the reduction is defined on that width.
Byte encodings (also pinned by the §8 test vectors — an implementation that reproduces §8 satisfies all of these by construction):
salt("nip-skd-v1"), the form tag, andcontextare encoded as UTF-8; the0x1Fseparator is a single raw byte between the form tag andcontext.- The 48-byte HKDF
seedis interpreted as a big-endian unsigned integer forreduce. - In the shared and blinded forms,
peer_pubis a 32-byte x-only key (BIP-340). It is reconstructed as the even-ypoint (02‖x) before the ECDH, andsecp256k1_ecdh_xis the raw 32-byte x-coordinate of the resulting shared point — the same value NIP-44 feeds into its KDF, not itssha256. - In the blinded form the base is
lift_even_y(root_pub)(even-y02‖x), the output isxonly(base + t·G)(elliptic-curve point addition, then x-only), and the private tweak is applied toroot_priv_evenYas above.
All forms are deterministic in (root key, form, context[, peer]) and reproduce identically
anywhere the root key is available. HKDF's two stages carry the separation:
- salt (
"nip-skd-v1") — scheme separation. It differs from NIP-44's"nip44-v2", so no NIP-SKD output can reproduce a NIP-44 conversation key, even on the same ECDH input. - info (form + context) — purpose and form separation. Distinct contexts yield independent
keys; the form tag additionally guarantees the three forms never share a
seedon the same inputs. This is essential for shared vs blinded: they use the sameIKM = ecdh_x(R,O)and the samecontext, so without the form tag they would compute the identicalseed. An observer who then saw bothshared_pub = seed·Gandblinded_pub = root_pub + seed·Gfor that pair could recoverroot_pub = blinded_pub − shared_pub— deanonymizing the root. The distinctinfomakes the two seeds independent, soblinded_pub − shared_pubis a random point and the leak is closed by construction.
1.1 The context (info) rules
context is the application-supplied portion of info; the derivation prepends the fixed
"nip-skd:" ‖ form ‖ 0x1F domain tag (§1). The rules below govern context:
- MUST be non-empty.
- SHOULD be namespaced by the consuming standard/protocol (e.g.
"example-chat:v2:..."), not by the app. An interoperable derived key must be reproducible by every app that implements the standard, so baking an app name into the context (an app-specific prefix instead of the standard's shared one) would make two apps derive different keys for the same purpose and break interop, e.g. a member on one client and a member on another could no longer derive the same group pseudonym or verify each other. Namespace by the app only for a key a single app deliberately keeps private and never expects another implementation to reproduce. - MUST be stable per purpose — the derived key depends on it; changing the string changes the key.
The same context MAY be used with more than one form (the form tag keeps the seeds independent),
but a consumer SHOULD still pick one form per purpose to avoid confusion.
1.2 Composed verification (the ECDH identity is a sub-key, not the root)
The verifier-side blinded derivation computes, for a peer's real key peer:
t = reduce(HKDF(ecdh_x(K, peer), salt = "nip-skd-v1", info = info("blinded", context), L = 48))
blinded_pub = xonly( lift_even_y(peer) + t·G )
where K is the verifier's own private key on the ECDH. In the simple case K = root_priv — this is
getPeerBlindedPubkey (§2), which verifies a peer who blinded toward your root.
But a peer may blind toward one of your sub-keys rather than your root, e.g. a group-chat protocol
where a member blinds toward the owner's pseudonym O (a self key), not the owner's real key, and a
facilitated user blinds toward the facilitator's member pseudonym (a blinded key). To verify such a
binding, the verifier must use that sub-key's private scalar as K:
- ViaSelf —
K = self(root_priv, viaContext). Owner verifying a member:viaContext= the owner pseudonym,context= the member pseudonym,peer= the member's real keyR. - ViaBlinded —
K = blinded(root_priv, viaContext, viaPeer)(its private scalar). Facilitator verifying a vouched user:viaContext↦viaPeer= the facilitator's member pseudonym toward the ownerO,context= the facilitated pseudonym,peer= the vouched user's real keyR_f.
The result is a public key — the same pseudonym the peer computed from its own side (ECDH symmetry), and
identical whether the verifier used a local key or a signer. The intermediate key K is a derived sub-key
and therefore root-sensitive (§3): a self K fully controls its pseudonym, a blinded K is
root-equivalent. So a local-key client derives K directly, but a signer MUST derive K internally and
return only the resulting blinded_pub — never K itself. Because a conforming signer never exposes any
derived private key, the composed ops (§2) are the only way a remote/browser signer can support a
verifier whose identity is a pseudonym, i.e. a group owner or facilitator. Without them, those roles
are local-key-only.
2. Operations (sub-signer)
A conforming signer MUST NOT return the seed, any sub-key or blinded private key, the raw
ECDH result, or HKDF(root_priv, ·) to the client. It exposes operations that use the derived
key internally. Each form has its own method names — self, shared, and blinded are never selected
by the presence/absence of an argument, so a call site's form is explicit and a mistaken (or forgotten)
peer can never silently derive the wrong key.
Self (no peer):
getSelfSubkeyPubkey(context) → sub_pubsignAsSelfSubkey(context, event) → eventnip44EncryptAsSelfSubkey(context, recipient, plaintext),nip44DecryptAsSelfSubkey(context, sender, ciphertext)(+nip04*equivalents for NIP-04 signers)
Shared (peer required; both parties derive the identical keypair):
getSharedSubkeyPubkey(context, peer) → sub_pubsignAsSharedSubkey(context, event, peer) → eventnip44EncryptAsSharedSubkey(context, recipient, plaintext, peer),nip44DecryptAsSharedSubkey(context, sender, ciphertext, peer)(+nip04*)
Blinded (peer required):
getBlindedPubkey(context, peer) → blinded_pub— the caller's own blinded key (base = the caller's root, blinded towardpeer). The signer also holdsblinded_privfor the sign/encrypt ops.getPeerBlindedPubkey(context, peer) → blinded_pub— a peer's blinded key toward the caller's root (base =peer, blinded withecdh_x(root_priv, peer)). Public key only — the verifier-side derivation for the simple case where the peer blinded toward your raw root. There is deliberately no operation to act as a peer's blinded key; that is the property that lets a verifier confirm a binding without being able to impersonate it.getPeerBlindedPubkeyViaSelf(viaContext, context, peer) → blinded_pubandgetPeerBlindedPubkeyViaBlinded(viaContext, viaPeer, context, peer) → blinded_pub— the composed verifier ops (§1.2). Identical togetPeerBlindedPubkeyexcept the ECDH identityKon the caller's side is one of the caller's own sub-keys — aselfsub-keyviaContext(ViaSelf), or ablindedsub-keyviaContext↦viaPeer(ViaBlinded), instead of the raw root. Use these when the peer blinded toward your pseudonym rather than your root: a group owner (acting as its owner pseudonym → ViaSelf) re-deriving a member's pseudonym, or a facilitator (acting as its member pseudonym → ViaBlinded) re-deriving a vouched user's pseudonym. Public key only — the intermediateKis derived and used inside the signer and never returned (§1.2, §3). There is likewise no op to act as the peer's key.signAsBlinded(context, event, peer) → event— sign as the caller's own blinded key.nip44EncryptAsBlinded(context, recipient, plaintext, peer),nip44DecryptAsBlinded(context, sender, ciphertext, peer)(+nip04*)
Every signAs* operation MUST treat the supplied event as final: set pubkey to the derived
public key, compute id over the event exactly as given, and sign. It MUST NOT alter
created_at, tags (including any proof-of-work nonce tag), or kind. Clients may mine
proof-of-work (NIP-13) against the derived pubkey before requesting the signature, so re-stamping
created_at or reordering/stripping tags would invalidate the already-mined id. A signer's ordinary
sign_event path that re-times or normalizes the template MUST be bypassed here — sign the client's
event byte-for-byte.
2.1 Interactivity
The pubkey derivations — getSelfSubkeyPubkey, getSharedSubkeyPubkey, getBlindedPubkey,
getPeerBlindedPubkey, and the composed getPeerBlindedPubkeyViaSelf / getPeerBlindedPubkeyViaBlinded
(§1.2) — are read-only: they return a public key, no secret and no signature. A
signer SHOULD answer them non-interactively (no user-approval prompt), exactly as it answers
get_public_key (NIP-46) or the injected getPublicKey (NIP-07). This is required for the capability
probe in §6/§7 to work: a client detects support by calling a pubkey op, so a signer that routes it
through an approval prompt turns feature-detection into a hanging request and appears not to support
NIP-SKD at all. Treat them as the same public-information class as get_public_key.
The signAs* operations produce a signature and MUST follow the signer's normal authorization
model for signing (typically explicit user consent, unless the user has pre-authorized the app or a
skd:<context-prefix> grant — §4). The encrypt/decrypt-as-subkey operations SHOULD follow the
signer's authorization model as well; a signer MAY answer them non-interactively for a trusted
connection (some transports, e.g. NIP-UPV2, auto-execute all non-signing sub-key ops) or require
consent — but the signAs* operations are never made non-interactive by default.
3. Security invariant
A signer implementing NIP-SKD MUST NEVER expose to the client:
- the raw ECDH shared secret
secp256k1_ecdh_x(root_priv, peer_pub), - the raw
HKDF(root_priv, ·)or the derivedseed, - any sub-key's private key, including a blinded key's private scalar
root_priv + t(which is a linear offset of the root key — exposing it would revealroot_privto anyone who also knowst, e.g. the ECDH peer).
Derived private keys are as sensitive as the root key. Every derived private key — self, shared,
or blinded — MUST be generated, held, used, and destroyed at the same security level an
implementation applies to root_priv: the same memory hygiene, the same non-exportability, the same
access controls and lifetime. A derived key is never a "lower-value" credential that may be cached
to disk, written to logs, handed to a less-trusted component, kept alive longer, or otherwise handled
more loosely than the root. A self or shared key fully controls its pseudonym; a blinded key is
strictly root-equivalent, since root_priv = blinded_priv − t and the tweak t is computable by
the ECDH peer (§1) — so leaking a blinded private key is exactly as damaging as leaking root_priv
itself. A signer or local-key client MUST NOT store, transmit, or expose any derived private key
anywhere it would not store, transmit, or expose root_priv.
Internal derivation and internal use are unrestricted, provided every purpose uses a distinct,
non-empty, domain-separated context, and every form uses its distinct form tag in info (§1).
The context rule is a key-separation rule (it stops different features from colliding); the
form-tag rule additionally stops the shared and blinded forms from sharing a seed on the same
inputs, which would leak the root by subtraction (§1). Neither exposes anything — they are correctness
invariants.
There is intentionally no "export the derived secret" method. Applications that want to act as a derived identity do so through §2 operations; the private material stays in the signer. Clients holding a local key may derive directly — that is the same trust boundary as the root key they already hold.
4. Permissions
Operations SHOULD be gated by user permission, mirroring NIP-04/44 approval. Because
context is public and any caller may request any string (including another app's), the
security boundary is authorization, not the context:
- A signer SHOULD let the user grant an app/connection a shared permission pool over a
context prefix (e.g. "allow
example-chat:*"), auto-approving all derivations and sub-key operations under it — analogous to abunker://connection's permission grant, with one toggle rather than a per-operation prompt storm. - Sub-keys MAY carry narrower, per-context permissions if the user prefers.
5. Versioning
The salt carries the scheme version. A backwards-incompatible change — a different
construction, or a deliberate salt rotation — increments it: nip-skd-v2, nip-skd-v3, …
Signers MAY support multiple versions concurrently. Consumers MUST select a version
explicitly (never "latest") so derivations stay reproducible. (E.g. a consumer records the
scheme version it derived under on its group or root object.)
The three forms (self, shared, blinded) are not versions — they coexist under one
scheme version and are selected per-operation (§2). The form is carried in the HKDF info, not the
salt, so adding or choosing a form never changes the scheme version. A signer that advertises skd:1
(§7) implements all three forms.
The composed verifier ops (getPeerBlindedPubkeyVia{Self,Blinded}, §1.2/§2) are an additive part
of the skd:1 surface: they change no salt, no derivation, and no existing method — the pseudonyms they
verify are ordinary skd:1 blinded keys — so they are not a version bump. A client feature-detects them
independently of the scheme version (method-presence in §6, or an attempt in §7). A signer built before
them simply lacks them, in which case the owner and facilitator roles fall back to local-key-only
(the same outcome as a non-SKD signer); everything else still works. Never gate the composed ops behind a new
scheme version.
6. Client interface (NIP-07)
window.nostr.skd = {
// self (no peer)
getSelfSubkeyPubkey(context: string): Promise<string>,
signAsSelfSubkey(context: string, event: EventTemplate): Promise<Event>,
nip44EncryptAsSelfSubkey(context: string, recipient: string, plaintext: string): Promise<string>,
nip44DecryptAsSelfSubkey(context: string, sender: string, ciphertext: string): Promise<string>,
// shared (peer required; both parties derive the same keypair)
getSharedSubkeyPubkey(context: string, peerPub: string): Promise<string>,
signAsSharedSubkey(context: string, event: EventTemplate, peerPub: string): Promise<Event>,
nip44EncryptAsSharedSubkey(context: string, recipient: string, plaintext: string, peerPub: string): Promise<string>,
nip44DecryptAsSharedSubkey(context: string, sender: string, ciphertext: string, peerPub: string): Promise<string>,
// blinded (caller owns the private key; a peer can derive only the public key to verify) — peer REQUIRED
getBlindedPubkey(context: string, peerPub: string): Promise<string>, // my own blinded key
getPeerBlindedPubkey(context: string, peerPub: string): Promise<string>, // a peer's blinded key toward my ROOT (verify) — pubkey only
// composed verify (§1.2): the ECDH identity is one of MY sub-keys, not my root — pubkey only
getPeerBlindedPubkeyViaSelf(viaContext: string, context: string, peerPub: string): Promise<string>, // owner verifies a member
getPeerBlindedPubkeyViaBlinded(viaContext: string, viaPeerPub: string, context: string, peerPub: string): Promise<string>, // facilitator verifies a vouched user
signAsBlinded(context: string, event: EventTemplate, peerPub: string): Promise<Event>,
nip44EncryptAsBlinded(context: string, recipient: string, plaintext: string, peerPub: string): Promise<string>,
nip44DecryptAsBlinded(context: string, sender: string, ciphertext: string, peerPub: string): Promise<string>,
// nip04* equivalents of each nip44* method, for signers that still support NIP-04
}
Feature-detection: typeof skd?.getSelfSubkeyPubkey === 'function' && typeof skd?.getBlindedPubkey === 'function'. Requiring the blinded op (needed by consumers that author under the blinded form) rejects an older signer that has only
the pre-blinded self/shared surface; the getSelfSubkeyPubkey half keeps the check robust against a partial
object exposing just one op. This detects the base skd:1 surface (self/shared/blinded + getPeerBlindedPubkey),
which is enough to participate as a member. The composed verifier ops are additive (§5) and detected
separately — e.g. typeof skd?.getPeerBlindedPubkeyViaSelf === 'function' — because a signer may implement
the base surface without them; when they are absent, the owner and facilitator roles fall back to
local-key-only (§1.2).
7. Remote signer (NIP-46)
New request methods, mirroring §6:
# self (no peer)
skd_get_self_subkey_pubkey params: [context]
skd_sign_as_self_subkey params: [context, event]
skd_nip44_encrypt_as_self_subkey params: [context, recipient, plaintext]
skd_nip44_decrypt_as_self_subkey params: [context, sender, ciphertext]
# shared (peer required)
skd_get_shared_subkey_pubkey params: [context, peer]
skd_sign_as_shared_subkey params: [context, event, peer]
skd_nip44_encrypt_as_shared_subkey params: [context, recipient, plaintext, peer]
skd_nip44_decrypt_as_shared_subkey params: [context, sender, ciphertext, peer]
# blinded (peer required on every method)
skd_get_blinded_pubkey params: [context, peer] # my own blinded key
skd_get_peer_blinded_pubkey params: [context, peer] # a peer's blinded key toward my ROOT (verify) — pubkey only
# composed verify (§1.2): ECDH identity is one of my sub-keys, not my root — pubkey only
skd_get_peer_blinded_pubkey_via_self params: [viaContext, context, peer] # owner verifies a member
skd_get_peer_blinded_pubkey_via_blinded params: [viaContext, viaPeer, context, peer] # facilitator verifies a vouched user
skd_sign_as_blinded params: [context, event, peer]
skd_nip44_encrypt_as_blinded params: [context, recipient, plaintext, peer]
skd_nip44_decrypt_as_blinded params: [context, sender, ciphertext, peer]
# skd_nip04_*_as_{self,shared,blinded} equivalents for NIP-04 signers only
Each form has its own methods, so peer is a fixed positional parameter of the shared and
blinded methods and is absent from the self methods — the form is never inferred from argument
presence, so a mistaken/forgotten peer is a wrong method name (caught in review) rather than a silent
wrong key. A client discovers support by attempting skd_get_blinded_pubkey (with a peer — any valid
pubkey, e.g. the client's own) and handling a method-not-supported response. The blinded op is the probe
(not a self/shared one) because a consumer may author members under the blinded form, so a signer with only
the older non-blinded surface must be treated as unsupported. The signer MUST answer that method
non-interactively (§2.1), the same as get_public_key, or the probe stalls and the signer wrongly
appears to lack NIP-SKD. Connection permission grants extend the connection's permission set with
skd:<context-prefix> entries (§4).
The composed verifier methods (skd_get_peer_blinded_pubkey_via_self / _via_blinded) are additive
(§5): a client that needs remote owner/facilitator support probes one of them separately (attempt +
handle method-not-supported) and, on absence, keeps those roles local-key-only. They are pubkey reads, so a
signer MUST answer them non-interactively too (§2.1).
Other transports. The method names and their logical parameters above are the contract; the positional-array encoding is specific to NIP-46. A non-NIP-46 signer protocol (e.g. NIP-UPV2) binds these same methods and parameters using its own request encoding — see that transport's specification (for NIP-UPV2, the params are a named JSON object rather than a positional array). The derivation itself (§1, §5) and the test vectors (§8) are transport-independent, so a pseudonym derived over any transport is byte-identical.
Capability discovery when the probe is unavailable. The two discovery mechanisms above — the §6
method-presence check and the §7 attempt-skd_get_blinded_pubkey probe — both assume the client
can tell whether the signer implements NIP-SKD by inspecting or calling the signer directly. Some
transports break that assumption:
- An in-process adapter (e.g. a same-page iframe reached over
postMessage) defines the method wrappers on the client side unconditionally, so method-presence is always true regardless of what the backend supports: the §6 check gives a false positive. - A signer that cannot answer the probe non-interactively, e.g. an adapter that is locked by default and needs a session secret before it can derive, would reject or stall the §7 probe while locked, giving a false negative.
Such a transport SHOULD advertise support out-of-band in its own handshake (a static capability
of the deployed build, independent of lock state) rather than relying on method-presence or a live
probe, and the client SHOULD treat the absence of that advertisement as "no NIP-SKD" — gating v2 off,
the same outcome as a failed §7 probe. This keeps feature-detection accurate for a backend that is
outdated or locked, instead of enabling operations it would later reject. The advertised value names
the derivation scheme (§5), e.g. skd:1, and implies support for all three forms. This is a discovery
mechanism only; the methods, parameters, and derivation remain exactly as specified above. (An
in-process/iframe adapter can do this: its ready handshake carries capabilities: ["skd:1"].)
The composed verifier ops are NOT implied by that skd:1 advertisement — they are additive (§5) and
an in-process adapter that advertises skd:1 may predate them. Method-presence is likewise unreliable there
(the adapter defines the wrappers unconditionally). So a client detects the composed ops by attempting
one and handling method-not-supported (degrading the owner/facilitator roles to local-key-only), or the
deployed backend advertises them with a distinct capability token; never infer them from skd:1 alone.
8. Test vectors
Generated and verified by the reference implementation; every conforming signer MUST reproduce these
values byte-for-byte. ecdh_x is the raw x-coordinate of the shared point (the x-only peer
reconstructed as even-y 02||x);
xonly(·) drops the parity byte; reduce(·) maps the 48-byte seed to a secp256k1 scalar (wide
reduction, 0 → 1; see §1); lift_even_y(·) reconstructs the even-y point from an x-only key; info
carries the form tag "nip-skd:" ‖ form ‖ 0x1F before the context (§1).
# ── self derivation (e.g. a group owner pseudonym O) ──
root_priv = 1111111111111111111111111111111111111111111111111111111111111111
context = "nip-chat:v2:owner-pseudonym:abc-123"
info = "nip-skd:self" ‖ 0x1F ‖ context
seed = HKDF-SHA256(IKM=root_priv, salt="nip-skd-v1", info=info, L=48)
sub_pub = xonly(reduce(seed)·G)
=> 94576ae28a4583c68e5641b10befe9a90c92680271dc839052937a8552fc0ae5 # = O_pub
# ── shared derivation (independent key both parties derive) ──
root_priv = 2222222222222222222222222222222222222222222222222222222222222222
peer_pub = 94576ae28a4583c68e5641b10befe9a90c92680271dc839052937a8552fc0ae5 # O_pub above
context = "nip-skd:example:shared:abc-123"
info = "nip-skd:shared" ‖ 0x1F ‖ context
seed = HKDF-SHA256(IKM=ecdh_x(root_priv, peer_pub), salt="nip-skd-v1", info=info, L=48)
sub_pub = xonly(reduce(seed)·G)
=> 96a9e601a6baa6acca538fad90d72ae3ed6906c5e057f6100e4a20b903611692
# ── blinded derivation (e.g. a group member pseudonym P) ──
root_priv = 2222222222222222222222222222222222222222222222222222222222222222 # member R
root_pub = 466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27 # = R_pub
peer_pub = 94576ae28a4583c68e5641b10befe9a90c92680271dc839052937a8552fc0ae5 # owner O_pub
context = "nip-chat:v2:member-pseudonym:abc-123"
info = "nip-skd:blinded" ‖ 0x1F ‖ context
seed = HKDF-SHA256(IKM=ecdh_x(root_priv, peer_pub), salt="nip-skd-v1", info=info, L=48)
t = reduce(seed)
P_pub = xonly( lift_even_y(root_pub) + t·G )
=> 059510a63a230047ffe6e978ade8ad31e4bfb59d414331d5b17b6d50038c51a1 # = P_pub
# ── blinded symmetry (owner re-derives the same P → owner-verification; the ViaSelf composed op §1.2) ──
# owner computes getPeerBlindedPubkeyViaSelf(viaContext = "nip-chat:v2:owner-pseudonym:abc-123",
# context = "nip-chat:v2:member-pseudonym:abc-123", peer = R_pub): K = self(owner_root, viaContext) = O_priv,
# base = lift_even_y(R_pub), IKM = ecdh_x(O_priv, R_pub). By ECDH symmetry the seed (hence t) is identical,
# so it reproduces P_pub — NOTE this uses O_priv (the owner pseudonym), NOT the owner's root:
# => 059510a63a230047ffe6e978ade8ad31e4bfb59d414331d5b17b6d50038c51a1 ✓ (owner never learns P_priv = R_priv + t)
# ── blinded, odd-y base (pins even-y normalization) ──
# root_priv whose root_pub has ODD y — the holder must tweak root_priv_evenY = n - root_priv,
# and both holder and verifier lift the even-y base, so both land on the same blinded_pub:
root_priv = 0000000000000000000000000000000000000000000000000000000000000006 # root_pub has odd y
root_pub = fff97bd5755eeea420453a14355235d382f6472f8568a18b2f057a1460297556
peer_pub = 94576ae28a4583c68e5641b10befe9a90c92680271dc839052937a8552fc0ae5 # O_pub
context = "nip-chat:v2:member-pseudonym:abc-123"
blinded_pub (holder, root_priv_evenY = n - root_priv) => 75a5ff6d888b7065181e9f2108f2ebd7e3000236cd409d19cf4f56ac0224a919
blinded_pub (verifier, lift_even_y(root_pub)) => 75a5ff6d888b7065181e9f2108f2ebd7e3000236cd409d19cf4f56ac0224a919 ✓
# ── facilitated: nested blinded (e.g. a facilitated pseudonym Pf; the ViaBlinded composed op §1.2) ──
# Same blinded form, one level deeper: Pf blinds the facilitated member's R_f toward the FACILITATOR's
# own pseudonym P_fac (which is itself R_fac blinded toward O). Base = lift_even_y(R_f_pub); the ECDH
# peer is P_fac. The facilitator re-derives the same Pf via getPeerBlindedPubkeyViaBlinded(viaContext =
# member-pseudonym, viaPeer = O_pub, context = facilitated-pseudonym, peer = R_f_pub): K = blinded(R_fac,
# member-ctx, O_pub) = P_fac_priv, then ECDH(P_fac_priv, R_f_pub) — identical seed by symmetry.
R_fac_priv = 3333333333333333333333333333333333333333333333333333333333333333
P_fac_pub = 55b5f44d71211d5505f3a66115aad173e24a68f5510866269ed52cde4d398803 # R_fac blinded toward O
R_f_priv = 4444444444444444444444444444444444444444444444444444444444444444 # facilitated member
context = "nip-chat:v2:facilitated-pseudonym:abc-123"
info = "nip-skd:blinded" ‖ 0x1F ‖ context
Pf_pub (facilitated: base = lift_even_y(R_f_pub), IKM = ecdh_x(R_f_priv, P_fac_pub)) => 31b1370ab9902ae59ee73d76bc5c7fb451d7bd52ec7c111a48f42d9ed2389a06
Pf_pub (facilitator: getPeerBlindedPubkeyViaBlinded, base = R_f_pub, IKM = ecdh_x(P_fac_priv, R_f_pub)) => 31b1370ab9902ae59ee73d76bc5c7fb451d7bd52ec7c111a48f42d9ed2389a06 ✓
The shared and blinded forms feed the raw ECDH x-coordinate into HKDF (as NIP-44 does), not
sha256(x) — a signer implementation must match this to reproduce the vectors.
9. Worked example (self + blinded)
A representative consumer is a group-chat protocol: each group is authored under a derived owner
pseudonym, and each member acts under a per-group pseudonym derived from their own key, so real
identities never appear in public. It uses self (for the owner) and blinded (for members,
facilitated users, and the join address); it does not use the shared form. Let group_id be the
group's stable identifier.
- Owner pseudonym
O(self):context = "example-chat:v2:owner-pseudonym:" + group_id,IKM = owner_root_priv. The group is authored byO, so the creator's real key never appears publicly. - Member pseudonym
P(blinded):context = "example-chat:v2:member-pseudonym:" + group_id, base = the member's real keyR, peer =O_pub. The member holdsP_priv = R_priv + tand signs asP. The owner re-derives the sameP_pubviagetPeerBlindedPubkeyViaSelf(viaContext= the owner-pseudonym context,context= the member-pseudonym context,peer=R_pub), where the ECDH runs on the owner's pseudonymO, not the owner's root (§1.2). The owner uses this for verification and placement but cannot obtainP_priv, so cannot impersonate the member. - Facilitated pseudonym
Pf(blinded): the same construction one level down. Base = the facilitated user's real keyR_f, peer = the facilitator's member pseudonymP_fac. The facilitator re-derivesPf_pubviagetPeerBlindedPubkeyViaBlinded(viaContext= the facilitator's member-pseudonym context,viaPeer=O_pub,context= the facilitated-pseudonym context,peer=R_f_pub) but cannot act asPf. - Join address (blinded): a per-join key, base = the applicant's real key
R, peer =O_pub. The owner re-derives it fromR_pub(after opening the sealedR) viagetPeerBlindedPubkeyViaSelf(the member case, with the join-address context) to confirm the applicant controlsR.
The member and owner sides, and the facilitated and facilitator sides, all run through the §2
sub-signer operations on remote/browser signers, or are derived directly on a local key. The composed
verifier ops (§1.2) are what let the owner (ViaSelf) and facilitator (ViaBlinded) roles run on a
remote/browser signer and not only on a local key: the intermediate pseudonym private key (O / P_fac)
is derived inside the signer and never leaves it.
Discussion
Connect a key to comment.