mirror of
https://github.com/minibits-cash/minibits_wallet.git
synced 2026-10-05 11:18:24 +00:00
The fork existed only to strip the package's `exports` map so metro would bundle the TS source; upstream now ships a build that react-native consumes directly (README documents the polyfills, all of which the app already installs), so the fork has no reason to exist. Fallout of the upgrade: - `subscribeMany` now takes a single filter rather than an array. - `SimplePool` drops a relay from its map when it gives up on it, so an empty map - not a `false` status - is what "everything is down" looks like now. Opt into `enableReconnect` so the pool restores dropped connections and refires their subscriptions with an advanced `since`. - `message-port-polyfill` was there for the old nostr-tools; nothing in the tree references MessagePort any more. - The published build is plain CJS/ESM, so jest can load the real library and the mock that stood in for it is gone. Nested @noble copies need babel, hence the transformIgnorePatterns tweak. Covered by a NIP-06 derivation test against the standard vector, so the identity the wallet derives from a seed phrase is provably unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
22 lines
989 B
TypeScript
22 lines
989 B
TypeScript
import {KeyChain} from '../src/services/keyChain'
|
|
|
|
// NIP-06 test vector (nostr-tools' own): the derivation the wallet uses to turn a
|
|
// seed phrase into the user's nostr identity. This is the only place in the app
|
|
// that runs nostr-tools crypto, so it also guards the library upgrade itself.
|
|
const MNEMONIC = 'leader monkey parrot ring guide accident before fence cannon height naive bean'
|
|
const NPUB_HEX = '17162c921dc4d2518f9a101db33695df1afb56ab82f5ff3e5da6eec3ca5cd917'
|
|
const NSEC_HEX = '7f7ff03d123792d6ac594bfa67bf6d0c0ab55b6b1fdb6249303fe861f1ccba9a'
|
|
|
|
describe('deriveNostrKeyPair', () => {
|
|
it('derives the NIP-06 account 0 keypair from a mnemonic', () => {
|
|
expect(KeyChain.deriveNostrKeyPair(MNEMONIC)).toEqual({
|
|
publicKey: NPUB_HEX,
|
|
privateKey: NSEC_HEX,
|
|
})
|
|
})
|
|
|
|
it('derives a different keypair for another account index', () => {
|
|
expect(KeyChain.deriveNostrKeyPair(MNEMONIC, 1).publicKey).not.toBe(NPUB_HEX)
|
|
})
|
|
})
|