From f4d9db5505827745f7fab37b0dba41a129e651a5 Mon Sep 17 00:00:00 2001 From: sshmatrix Date: Fri, 10 Mar 2023 16:54:00 +0530 Subject: [PATCH] housekeeping --- xx.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/xx.md b/xx.md index da37d9df..f3d2fddf 100644 --- a/xx.md +++ b/xx.md @@ -7,7 +7,7 @@ Nostr-Specific Private Keys from Deterministic Wallet Signatures (Sign-In-With-X ## Abstract -This specification provides an optional method for Nostr clients and NIP-07 providers and coin wallet providers to generate deterministic private keys from Chain Agnostic `Sign-in-With-X`[(CAIP-122)](https://github.com/ChainAgnostic/CAIPs/pull/122) signature. Nostr-specific private key is derived from HKDF-SHA-256 using NIP02/NIP05 names, [(CAIP-02: Blockchain ID Specification)](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md), [CAIP-10: Account ID Specification](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md) identifiers, and deterministic signature from connected coin-wallet as inputs. +This specification provides an optional method for Nostr clients and NIP-07 providers and coin wallet providers to generate deterministic private keys from Chain Agnostic `Sign-in-With-X`[(CAIP-122)](https://github.com/ChainAgnostic/CAIPs/pull/122) signature. Nostr-specific private key is derived from HKDF-SHA-256 using NIP-02/NIP-05 names, [CAIP-02: Blockchain ID Specification](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md), [CAIP-10: Account ID Specification](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md) identifiers, and deterministic signature from connected coin-wallet as inputs. ## Terminology @@ -39,11 +39,11 @@ RFC6979 compatible deterministic signature from coin-wallet provider. let signature = wallet.signMessage(message); ``` -### e) Blockchain and Address Identifier +### e) Blockchain and Address Identifier Chain Agnostic [CAIP-02: Blockchain ID Specification](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md) and [CAIP-10: Account ID Specification](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md) are used to generate blockchain and address identifiers. ``` let caip02 = - `eip155:` || + `eip155:` || `cosmos:` || `bip122:<16 bytes genesis/fork hash>`; @@ -113,7 +113,7 @@ let password = "horse staple battery" /** - * + * * @param username nip02/nip05 identifier * @param caip10 CAIP identifier for the blockchain account * @param sig Deterministic signature from X-wallet provider @@ -136,12 +136,12 @@ export async function privateKeyFromX( } /** - * + * * @param username nip02/nip05 identifier * @param caip10 CAIP identifier for the blockchain account * @param sig Deterministic signature from X-wallet provider * @param password Optional password - * @returns + * @returns */ export async function signInWithX( username: string, @@ -164,7 +164,7 @@ export async function signInWithX( } if(profile == null){ throw new Error("Nostr Profile Not Found") - } + } petname = (username.split("@").length == 2) ? username.split("@")[0] : username.split(".")[0] } let privkey = await privateKeyFromX(username, caip10, sig, password) @@ -180,9 +180,9 @@ export async function signInWithX( } ``` -## Implementations -1) Nostr tools : https://github.com/nbd-wtf/nostr-tools/pull/132 (PR) -2) Nostr client: (WIP) +## Implementations +1) Nostr Tools : [Sign-In-With-X](https://github.com/dostr-eth/nostr-tools/tree/sign-in-with-x) ([Pull Request #132](https://github.com/nbd-wtf/nostr-tools/pull/132)) +2) Nostr Client: [Dostr Client](https://github.com/dostr-eth/dostr-client) ## Security Considerations @@ -195,7 +195,7 @@ export async function signInWithX( - [RFC5869: HKDF (HMAC-based Extract-and-Expand Key Derivation Function)](https://datatracker.ietf.org/doc/html/rfc5869) - [CAIP-02: Blockchain ID Specification](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md) - [CAIP-10: Account ID Specification](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md) -- [CAIP-122: Sign-in-With-X)](https://github.com/ChainAgnostic/CAIPs/pull/122) +- [CAIP-122: Sign-in-With-X)](https://github.com/ChainAgnostic/CAIPs/pull/122) - [Digital Signature Standard (DSS), FIPS 186-4 B.4.1](https://csrc.nist.gov/publications/detail/fips/186/4/final) - [BIP340: Schnorr Signature Standard](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki) @@ -204,4 +204,4 @@ export async function signInWithX( - [NIP-02: Contact List and Petnames](https://github.com/nostr-protocol/nips/blob/master/02.md) - [NIP-05: Mapping Nostr keys to DNS-based internet identifiers](https://github.com/nostr-protocol/nips/blob/master/05.md) - [@noble/hashes](https://github.com/paulmillr/noble-hashes) -- [@noble/secp256k1](https://github.com/paulmillr/noble-secp256k1) \ No newline at end of file +- [@noble/secp256k1](https://github.com/paulmillr/noble-secp256k1)