@btc-vision/transaction 1.7.7 → 1.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/_version.d.ts +1 -0
- package/browser/chain/ChainData.d.ts +4 -0
- package/browser/{src/epoch → epoch}/interfaces/IChallengeSolution.d.ts +4 -4
- package/browser/{src/generators → generators}/Features.d.ts +6 -1
- package/browser/{src/generators → generators}/Generator.d.ts +1 -0
- package/browser/generators/MLDSAData.d.ts +15 -0
- package/browser/index.js +1 -1
- package/browser/{src/keypair → keypair}/Address.d.ts +9 -3
- package/browser/{src/keypair → keypair}/MessageSigner.d.ts +9 -0
- package/browser/{src/opnet.d.ts → opnet.d.ts} +1 -0
- package/browser/{src/transaction → transaction}/browser/Web3Provider.d.ts +15 -4
- package/browser/transaction/browser/types/OPWallet.d.ts +6 -0
- package/browser/{src/transaction → transaction}/builders/CustomScriptTransaction.d.ts +1 -0
- package/browser/{src/transaction → transaction}/builders/DeploymentTransaction.d.ts +1 -0
- package/browser/{src/transaction → transaction}/builders/TransactionBuilder.d.ts +4 -0
- package/browser/{src/transaction → transaction}/interfaces/ITransactionParameters.d.ts +3 -0
- package/browser/{src/transaction → transaction}/shared/TweakedTransaction.d.ts +6 -0
- package/browser/{src/utxo → utxo}/OPNetLimitedProvider.d.ts +1 -0
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/chain/ChainData.d.ts +4 -0
- package/build/chain/ChainData.js +20 -0
- package/build/epoch/ChallengeSolution.js +4 -4
- package/build/epoch/interfaces/IChallengeSolution.d.ts +4 -4
- package/build/generators/Features.d.ts +6 -1
- package/build/generators/Features.js +1 -0
- package/build/generators/Generator.d.ts +1 -0
- package/build/generators/Generator.js +24 -2
- package/build/generators/MLDSAData.d.ts +15 -0
- package/build/generators/MLDSAData.js +19 -0
- package/build/generators/builders/CalldataGenerator.js +1 -1
- package/build/generators/builders/DeploymentGenerator.js +1 -1
- package/build/generators/builders/P2WDAGenerator.js +1 -1
- package/build/keypair/Address.d.ts +9 -3
- package/build/keypair/Address.js +63 -38
- package/build/keypair/MessageSigner.d.ts +9 -0
- package/build/keypair/MessageSigner.js +101 -3
- package/build/opnet.d.ts +1 -0
- package/build/opnet.js +1 -0
- package/build/transaction/TransactionFactory.js +3 -0
- package/build/transaction/browser/Web3Provider.d.ts +15 -4
- package/build/transaction/browser/types/OPWallet.d.ts +2 -10
- package/build/transaction/browser/types/OPWallet.js +4 -2
- package/build/transaction/builders/CustomScriptTransaction.d.ts +1 -0
- package/build/transaction/builders/CustomScriptTransaction.js +3 -0
- package/build/transaction/builders/DeploymentTransaction.d.ts +1 -0
- package/build/transaction/builders/DeploymentTransaction.js +26 -1
- package/build/transaction/builders/InteractionTransaction.js +14 -1
- package/build/transaction/builders/InteractionTransactionP2WDA.js +14 -1
- package/build/transaction/builders/TransactionBuilder.d.ts +4 -0
- package/build/transaction/builders/TransactionBuilder.js +77 -0
- package/build/transaction/interfaces/ITransactionParameters.d.ts +3 -0
- package/build/transaction/shared/P2TR_MS.js +1 -0
- package/build/transaction/shared/TweakedTransaction.d.ts +6 -0
- package/build/transaction/shared/TweakedTransaction.js +19 -0
- package/build/utxo/OPNetLimitedProvider.d.ts +1 -0
- package/build/utxo/OPNetLimitedProvider.js +11 -1
- package/eslint.config.js +2 -1
- package/package.json +1 -1
- package/src/_version.ts +1 -1
- package/src/chain/ChainData.ts +32 -0
- package/src/epoch/ChallengeSolution.ts +4 -4
- package/src/epoch/interfaces/IChallengeSolution.ts +4 -4
- package/src/generators/Features.ts +8 -2
- package/src/generators/Generator.ts +35 -2
- package/src/generators/MLDSAData.ts +30 -0
- package/src/generators/builders/CalldataGenerator.ts +1 -1
- package/src/generators/builders/DeploymentGenerator.ts +2 -1
- package/src/generators/builders/LegacyCalldataGenerator.ts +1 -0
- package/src/generators/builders/P2WDAGenerator.ts +5 -1
- package/src/keypair/Address.ts +78 -38
- package/src/keypair/MessageSigner.ts +214 -15
- package/src/opnet.ts +2 -0
- package/src/transaction/TransactionFactory.ts +3 -0
- package/src/transaction/browser/Web3Provider.ts +64 -4
- package/src/transaction/browser/types/OPWallet.ts +6 -53
- package/src/transaction/builders/CustomScriptTransaction.ts +4 -0
- package/src/transaction/builders/DeploymentTransaction.ts +36 -8
- package/src/transaction/builders/InteractionTransaction.ts +17 -7
- package/src/transaction/builders/InteractionTransactionP2WDA.ts +17 -7
- package/src/transaction/builders/TransactionBuilder.ts +107 -0
- package/src/transaction/interfaces/ITransactionParameters.ts +12 -0
- package/src/transaction/shared/P2TR_MS.ts +1 -0
- package/src/transaction/shared/TweakedTransaction.ts +35 -0
- package/src/utxo/OPNetLimitedProvider.ts +19 -2
- package/test/address.test.ts +18 -20
- package/test/addressmap.test.ts +783 -0
- package/test/addressverificator-mldsa.test.ts +40 -16
- package/test/messagesigner-mldsa.test.ts +50 -50
- package/test/messagesigner-schnorr.test.ts +40 -40
- package/tsconfig.webpack.json +2 -6
- package/webpack.config.js +1 -1
- package/browser/src/_version.d.ts +0 -1
- package/browser/src/transaction/browser/types/OPWallet.d.ts +0 -14
- package/browser/test/address.test.d.ts +0 -1
- package/browser/test/addressverificator-mldsa.test.d.ts +0 -1
- package/browser/test/derivePath.test.d.ts +0 -1
- package/browser/test/fastmap-setall.test.d.ts +0 -1
- package/browser/test/fastmap.test.d.ts +0 -1
- package/browser/test/messagesigner-mldsa.test.d.ts +0 -1
- package/browser/test/messagesigner-schnorr.test.d.ts +0 -1
- package/browser/test/network-awareness.test.d.ts +0 -1
- package/browser/test/old/FastBigIntMap.d.ts +0 -18
- package/browser/test/oldfastmap.test.d.ts +0 -1
- /package/browser/{src/abi → abi}/ABICoder.d.ts +0 -0
- /package/browser/{src/buffer → buffer}/BinaryReader.d.ts +0 -0
- /package/browser/{src/buffer → buffer}/BinaryWriter.d.ts +0 -0
- /package/browser/{src/bytecode → bytecode}/Compressor.d.ts +0 -0
- /package/browser/{src/consensus → consensus}/Consensus.d.ts +0 -0
- /package/browser/{src/consensus → consensus}/ConsensusConfig.d.ts +0 -0
- /package/browser/{src/consensus → consensus}/metadata/RoswellConsensus.d.ts +0 -0
- /package/browser/{src/crypto → crypto}/crypto-browser.d.ts +0 -0
- /package/browser/{src/crypto → crypto}/crypto.d.ts +0 -0
- /package/browser/{src/deterministic → deterministic}/AddressMap.d.ts +0 -0
- /package/browser/{src/deterministic → deterministic}/AddressSet.d.ts +0 -0
- /package/browser/{src/deterministic → deterministic}/CustomMap.d.ts +0 -0
- /package/browser/{src/deterministic → deterministic}/DeterministicMap.d.ts +0 -0
- /package/browser/{src/deterministic → deterministic}/DeterministicSet.d.ts +0 -0
- /package/browser/{src/deterministic → deterministic}/FastMap.d.ts +0 -0
- /package/browser/{src/epoch → epoch}/ChallengeSolution.d.ts +0 -0
- /package/browser/{src/epoch → epoch}/validator/EpochValidator.d.ts +0 -0
- /package/browser/{src/event → event}/NetEvent.d.ts +0 -0
- /package/browser/{src/generators → generators}/AddressGenerator.d.ts +0 -0
- /package/browser/{src/generators → generators}/builders/CalldataGenerator.d.ts +0 -0
- /package/browser/{src/generators → generators}/builders/CustomGenerator.d.ts +0 -0
- /package/browser/{src/generators → generators}/builders/DeploymentGenerator.d.ts +0 -0
- /package/browser/{src/generators → generators}/builders/LegacyCalldataGenerator.d.ts +0 -0
- /package/browser/{src/generators → generators}/builders/MultiSignGenerator.d.ts +0 -0
- /package/browser/{src/generators → generators}/builders/P2WDAGenerator.d.ts +0 -0
- /package/browser/{src/index.d.ts → index.d.ts} +0 -0
- /package/browser/{src/keypair → keypair}/AddressVerificator.d.ts +0 -0
- /package/browser/{src/keypair → keypair}/EcKeyPair.d.ts +0 -0
- /package/browser/{src/keypair → keypair}/Secp256k1PointDeriver.d.ts +0 -0
- /package/browser/{src/keypair → keypair}/Wallet.d.ts +0 -0
- /package/browser/{src/keypair → keypair}/interfaces/IWallet.d.ts +0 -0
- /package/browser/{src/metadata → metadata}/ContractBaseMetadata.d.ts +0 -0
- /package/browser/{src/metadata → metadata}/tokens.d.ts +0 -0
- /package/browser/{src/mnemonic → mnemonic}/BIPStandard.d.ts +0 -0
- /package/browser/{src/mnemonic → mnemonic}/Mnemonic.d.ts +0 -0
- /package/browser/{src/mnemonic → mnemonic}/MnemonicStrength.d.ts +0 -0
- /package/browser/{src/network → network}/ChainId.d.ts +0 -0
- /package/browser/{src/p2wda → p2wda}/P2WDADetector.d.ts +0 -0
- /package/browser/{src/signer → signer}/SignerUtils.d.ts +0 -0
- /package/browser/{src/signer → signer}/TweakedSigner.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/ContractAddress.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/TransactionFactory.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/browser/BrowserSignerBase.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/browser/extensions/UnisatSigner.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/browser/extensions/XverseSigner.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/browser/types/Unisat.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/browser/types/Xverse.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/builders/CancelTransaction.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/builders/ChallengeSolutionTransaction.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/builders/FundingTransaction.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/builders/InteractionTransaction.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/builders/InteractionTransactionP2WDA.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/builders/MultiSignTransaction.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/builders/SharedInteractionTransaction.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/enums/TransactionType.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/interfaces/Tap.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/mineable/IP2WSHAddress.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/mineable/TimelockGenerator.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/processor/PsbtTransaction.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/psbt/PSBTTypes.d.ts +0 -0
- /package/browser/{src/transaction → transaction}/shared/P2TR_MS.d.ts +0 -0
- /package/browser/{src/utils → utils}/BitcoinUtils.d.ts +0 -0
- /package/browser/{src/utils → utils}/BufferHelper.d.ts +0 -0
- /package/browser/{src/utils → utils}/StringToBuffer.d.ts +0 -0
- /package/browser/{src/utils → utils}/lengths.d.ts +0 -0
- /package/browser/{src/utils → utils}/types.d.ts +0 -0
- /package/browser/{src/utxo → utxo}/interfaces/BroadcastResponse.d.ts +0 -0
- /package/browser/{src/utxo → utxo}/interfaces/IUTXO.d.ts +0 -0
- /package/browser/{src/verification → verification}/TapscriptVerificator.d.ts +0 -0
|
@@ -335,13 +335,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
335
335
|
const message = 'Hello, OPNet!';
|
|
336
336
|
const signed = MessageSigner.signMessage(wallet.keypair, message);
|
|
337
337
|
|
|
338
|
-
const
|
|
338
|
+
const isValidLegacyPublicKey = MessageSigner.verifySignature(
|
|
339
339
|
wallet.keypair.publicKey,
|
|
340
340
|
message,
|
|
341
341
|
signed.signature,
|
|
342
342
|
);
|
|
343
343
|
|
|
344
|
-
expect(
|
|
344
|
+
expect(isValidLegacyPublicKey).toBe(true);
|
|
345
345
|
});
|
|
346
346
|
|
|
347
347
|
it('should verify signature with Unicode string', () => {
|
|
@@ -356,13 +356,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
356
356
|
const message = '你好世界 🌍';
|
|
357
357
|
const signed = MessageSigner.signMessage(wallet.keypair, message);
|
|
358
358
|
|
|
359
|
-
const
|
|
359
|
+
const isValidLegacyPublicKey = MessageSigner.verifySignature(
|
|
360
360
|
wallet.keypair.publicKey,
|
|
361
361
|
message,
|
|
362
362
|
signed.signature,
|
|
363
363
|
);
|
|
364
364
|
|
|
365
|
-
expect(
|
|
365
|
+
expect(isValidLegacyPublicKey).toBe(true);
|
|
366
366
|
});
|
|
367
367
|
|
|
368
368
|
it('should fail verification with wrong message', () => {
|
|
@@ -378,13 +378,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
378
378
|
const wrongMessage = 'Wrong message';
|
|
379
379
|
const signed = MessageSigner.signMessage(wallet.keypair, message);
|
|
380
380
|
|
|
381
|
-
const
|
|
381
|
+
const isValidLegacyPublicKey = MessageSigner.verifySignature(
|
|
382
382
|
wallet.keypair.publicKey,
|
|
383
383
|
wrongMessage,
|
|
384
384
|
signed.signature,
|
|
385
385
|
);
|
|
386
386
|
|
|
387
|
-
expect(
|
|
387
|
+
expect(isValidLegacyPublicKey).toBe(false);
|
|
388
388
|
});
|
|
389
389
|
});
|
|
390
390
|
|
|
@@ -401,13 +401,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
401
401
|
const message = Buffer.from('Hello, Buffer!', 'utf-8');
|
|
402
402
|
const signed = MessageSigner.signMessage(wallet.keypair, message);
|
|
403
403
|
|
|
404
|
-
const
|
|
404
|
+
const isValidLegacyPublicKey = MessageSigner.verifySignature(
|
|
405
405
|
wallet.keypair.publicKey,
|
|
406
406
|
message,
|
|
407
407
|
signed.signature,
|
|
408
408
|
);
|
|
409
409
|
|
|
410
|
-
expect(
|
|
410
|
+
expect(isValidLegacyPublicKey).toBe(true);
|
|
411
411
|
});
|
|
412
412
|
|
|
413
413
|
it('should verify signature with binary Buffer', () => {
|
|
@@ -422,13 +422,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
422
422
|
const message = Buffer.from([0x00, 0x01, 0x02, 0xff]);
|
|
423
423
|
const signed = MessageSigner.signMessage(wallet.keypair, message);
|
|
424
424
|
|
|
425
|
-
const
|
|
425
|
+
const isValidLegacyPublicKey = MessageSigner.verifySignature(
|
|
426
426
|
wallet.keypair.publicKey,
|
|
427
427
|
message,
|
|
428
428
|
signed.signature,
|
|
429
429
|
);
|
|
430
430
|
|
|
431
|
-
expect(
|
|
431
|
+
expect(isValidLegacyPublicKey).toBe(true);
|
|
432
432
|
});
|
|
433
433
|
});
|
|
434
434
|
|
|
@@ -445,13 +445,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
445
445
|
const message = new Uint8Array([1, 2, 3, 4, 5]);
|
|
446
446
|
const signed = MessageSigner.signMessage(wallet.keypair, message);
|
|
447
447
|
|
|
448
|
-
const
|
|
448
|
+
const isValidLegacyPublicKey = MessageSigner.verifySignature(
|
|
449
449
|
wallet.keypair.publicKey,
|
|
450
450
|
message,
|
|
451
451
|
signed.signature,
|
|
452
452
|
);
|
|
453
453
|
|
|
454
|
-
expect(
|
|
454
|
+
expect(isValidLegacyPublicKey).toBe(true);
|
|
455
455
|
});
|
|
456
456
|
|
|
457
457
|
it('should verify signature with Uint8Array public key', () => {
|
|
@@ -467,13 +467,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
467
467
|
const signed = MessageSigner.signMessage(wallet.keypair, message);
|
|
468
468
|
|
|
469
469
|
const publicKeyUint8 = new Uint8Array(wallet.keypair.publicKey);
|
|
470
|
-
const
|
|
470
|
+
const isValidLegacyPublicKey = MessageSigner.verifySignature(
|
|
471
471
|
publicKeyUint8,
|
|
472
472
|
message,
|
|
473
473
|
signed.signature,
|
|
474
474
|
);
|
|
475
475
|
|
|
476
|
-
expect(
|
|
476
|
+
expect(isValidLegacyPublicKey).toBe(true);
|
|
477
477
|
});
|
|
478
478
|
});
|
|
479
479
|
|
|
@@ -508,13 +508,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
508
508
|
const message = 'Test message';
|
|
509
509
|
const signed = MessageSigner.signMessage(wallet1.keypair, message);
|
|
510
510
|
|
|
511
|
-
const
|
|
511
|
+
const isValidLegacyPublicKey = MessageSigner.verifySignature(
|
|
512
512
|
wallet2.keypair.publicKey,
|
|
513
513
|
message,
|
|
514
514
|
signed.signature,
|
|
515
515
|
);
|
|
516
516
|
|
|
517
|
-
expect(
|
|
517
|
+
expect(isValidLegacyPublicKey).toBe(false);
|
|
518
518
|
});
|
|
519
519
|
|
|
520
520
|
it('should fail verification with corrupted signature', () => {
|
|
@@ -532,13 +532,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
532
532
|
const corruptedSignature = Buffer.from(signed.signature);
|
|
533
533
|
corruptedSignature[0] ^= 0xff;
|
|
534
534
|
|
|
535
|
-
const
|
|
535
|
+
const isValidLegacyPublicKey = MessageSigner.verifySignature(
|
|
536
536
|
wallet.keypair.publicKey,
|
|
537
537
|
message,
|
|
538
538
|
corruptedSignature,
|
|
539
539
|
);
|
|
540
540
|
|
|
541
|
-
expect(
|
|
541
|
+
expect(isValidLegacyPublicKey).toBe(false);
|
|
542
542
|
});
|
|
543
543
|
});
|
|
544
544
|
|
|
@@ -680,13 +680,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
680
680
|
networks.bitcoin,
|
|
681
681
|
);
|
|
682
682
|
|
|
683
|
-
const
|
|
683
|
+
const isValidLegacyPublicKey = MessageSigner.tweakAndVerifySignature(
|
|
684
684
|
wallet.keypair.publicKey,
|
|
685
685
|
message,
|
|
686
686
|
signed.signature,
|
|
687
687
|
);
|
|
688
688
|
|
|
689
|
-
expect(
|
|
689
|
+
expect(isValidLegacyPublicKey).toBe(true);
|
|
690
690
|
});
|
|
691
691
|
|
|
692
692
|
it('should verify tweaked signature with Buffer message', () => {
|
|
@@ -705,13 +705,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
705
705
|
networks.bitcoin,
|
|
706
706
|
);
|
|
707
707
|
|
|
708
|
-
const
|
|
708
|
+
const isValidLegacyPublicKey = MessageSigner.tweakAndVerifySignature(
|
|
709
709
|
wallet.keypair.publicKey,
|
|
710
710
|
message,
|
|
711
711
|
signed.signature,
|
|
712
712
|
);
|
|
713
713
|
|
|
714
|
-
expect(
|
|
714
|
+
expect(isValidLegacyPublicKey).toBe(true);
|
|
715
715
|
});
|
|
716
716
|
|
|
717
717
|
it('should verify tweaked signature with Uint8Array message', () => {
|
|
@@ -730,13 +730,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
730
730
|
networks.bitcoin,
|
|
731
731
|
);
|
|
732
732
|
|
|
733
|
-
const
|
|
733
|
+
const isValidLegacyPublicKey = MessageSigner.tweakAndVerifySignature(
|
|
734
734
|
wallet.keypair.publicKey,
|
|
735
735
|
message,
|
|
736
736
|
signed.signature,
|
|
737
737
|
);
|
|
738
738
|
|
|
739
|
-
expect(
|
|
739
|
+
expect(isValidLegacyPublicKey).toBe(true);
|
|
740
740
|
});
|
|
741
741
|
|
|
742
742
|
it('should fail verification with wrong message', () => {
|
|
@@ -756,13 +756,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
756
756
|
networks.bitcoin,
|
|
757
757
|
);
|
|
758
758
|
|
|
759
|
-
const
|
|
759
|
+
const isValidLegacyPublicKey = MessageSigner.tweakAndVerifySignature(
|
|
760
760
|
wallet.keypair.publicKey,
|
|
761
761
|
wrongMessage,
|
|
762
762
|
signed.signature,
|
|
763
763
|
);
|
|
764
764
|
|
|
765
|
-
expect(
|
|
765
|
+
expect(isValidLegacyPublicKey).toBe(false);
|
|
766
766
|
});
|
|
767
767
|
|
|
768
768
|
it('should fail verification with wrong public key', () => {
|
|
@@ -782,13 +782,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
782
782
|
networks.bitcoin,
|
|
783
783
|
);
|
|
784
784
|
|
|
785
|
-
const
|
|
785
|
+
const isValidLegacyPublicKey = MessageSigner.tweakAndVerifySignature(
|
|
786
786
|
wallet2.keypair.publicKey,
|
|
787
787
|
message,
|
|
788
788
|
signed.signature,
|
|
789
789
|
);
|
|
790
790
|
|
|
791
|
-
expect(
|
|
791
|
+
expect(isValidLegacyPublicKey).toBe(false);
|
|
792
792
|
});
|
|
793
793
|
|
|
794
794
|
it('should not verify non-tweaked signature with tweakAndVerifySignature', () => {
|
|
@@ -803,13 +803,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
803
803
|
const message = 'Test message';
|
|
804
804
|
const signed = MessageSigner.signMessage(wallet.keypair, message);
|
|
805
805
|
|
|
806
|
-
const
|
|
806
|
+
const isValidLegacyPublicKey = MessageSigner.tweakAndVerifySignature(
|
|
807
807
|
wallet.keypair.publicKey,
|
|
808
808
|
message,
|
|
809
809
|
signed.signature,
|
|
810
810
|
);
|
|
811
811
|
|
|
812
|
-
expect(
|
|
812
|
+
expect(isValidLegacyPublicKey).toBe(false);
|
|
813
813
|
});
|
|
814
814
|
|
|
815
815
|
it('should verify with Uint8Array public key', () => {
|
|
@@ -829,13 +829,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
829
829
|
);
|
|
830
830
|
|
|
831
831
|
const publicKeyUint8 = new Uint8Array(wallet.keypair.publicKey);
|
|
832
|
-
const
|
|
832
|
+
const isValidLegacyPublicKey = MessageSigner.tweakAndVerifySignature(
|
|
833
833
|
publicKeyUint8,
|
|
834
834
|
message,
|
|
835
835
|
signed.signature,
|
|
836
836
|
);
|
|
837
837
|
|
|
838
|
-
expect(
|
|
838
|
+
expect(isValidLegacyPublicKey).toBe(true);
|
|
839
839
|
});
|
|
840
840
|
});
|
|
841
841
|
|
|
@@ -856,13 +856,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
856
856
|
networks.bitcoin,
|
|
857
857
|
);
|
|
858
858
|
|
|
859
|
-
const
|
|
859
|
+
const isValidLegacyPublicKey = MessageSigner.verifySignature(
|
|
860
860
|
wallet.keypair.publicKey,
|
|
861
861
|
message,
|
|
862
862
|
tweakedSigned.signature,
|
|
863
863
|
);
|
|
864
864
|
|
|
865
|
-
expect(
|
|
865
|
+
expect(isValidLegacyPublicKey).toBe(false);
|
|
866
866
|
});
|
|
867
867
|
|
|
868
868
|
it('should verify regular signature with regular verify, not with tweaked verify', () => {
|
|
@@ -959,13 +959,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
959
959
|
|
|
960
960
|
const message = Buffer.from([0x00, 0x01, 0x00, 0x02, 0x00]);
|
|
961
961
|
const signed = MessageSigner.signMessage(wallet.keypair, message);
|
|
962
|
-
const
|
|
962
|
+
const isValidLegacyPublicKey = MessageSigner.verifySignature(
|
|
963
963
|
wallet.keypair.publicKey,
|
|
964
964
|
message,
|
|
965
965
|
signed.signature,
|
|
966
966
|
);
|
|
967
967
|
|
|
968
|
-
expect(
|
|
968
|
+
expect(isValidLegacyPublicKey).toBe(true);
|
|
969
969
|
});
|
|
970
970
|
|
|
971
971
|
it('should handle very long messages', () => {
|
|
@@ -979,13 +979,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
979
979
|
|
|
980
980
|
const message = 'X'.repeat(100000);
|
|
981
981
|
const signed = MessageSigner.signMessage(wallet.keypair, message);
|
|
982
|
-
const
|
|
982
|
+
const isValidLegacyPublicKey = MessageSigner.verifySignature(
|
|
983
983
|
wallet.keypair.publicKey,
|
|
984
984
|
message,
|
|
985
985
|
signed.signature,
|
|
986
986
|
);
|
|
987
987
|
|
|
988
|
-
expect(
|
|
988
|
+
expect(isValidLegacyPublicKey).toBe(true);
|
|
989
989
|
});
|
|
990
990
|
|
|
991
991
|
it('should handle messages with emoji', () => {
|
|
@@ -999,13 +999,13 @@ describe('MessageSigner Schnorr', () => {
|
|
|
999
999
|
|
|
1000
1000
|
const message = '🚀🌙⭐🪐💫';
|
|
1001
1001
|
const signed = MessageSigner.signMessage(wallet.keypair, message);
|
|
1002
|
-
const
|
|
1002
|
+
const isValidLegacyPublicKey = MessageSigner.verifySignature(
|
|
1003
1003
|
wallet.keypair.publicKey,
|
|
1004
1004
|
message,
|
|
1005
1005
|
signed.signature,
|
|
1006
1006
|
);
|
|
1007
1007
|
|
|
1008
|
-
expect(
|
|
1008
|
+
expect(isValidLegacyPublicKey).toBe(true);
|
|
1009
1009
|
});
|
|
1010
1010
|
});
|
|
1011
1011
|
});
|
package/tsconfig.webpack.json
CHANGED
|
@@ -10,13 +10,9 @@
|
|
|
10
10
|
"strict": true,
|
|
11
11
|
"baseUrl": ".",
|
|
12
12
|
"paths": {
|
|
13
|
-
"@btc-vision/logger": [
|
|
14
|
-
"node_modules/@btc-vision/logger"
|
|
15
|
-
]
|
|
13
|
+
"@btc-vision/logger": ["node_modules/@btc-vision/logger"]
|
|
16
14
|
},
|
|
17
15
|
"moduleResolution": "bundler"
|
|
18
16
|
},
|
|
19
|
-
"exclude": [
|
|
20
|
-
"./src/tests"
|
|
21
|
-
]
|
|
17
|
+
"exclude": ["node_modules", "test", "**/*.test.ts", "**/*.spec.ts"]
|
|
22
18
|
}
|
package/webpack.config.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const version = "1.7.7";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Unisat } from './Unisat.js';
|
|
2
|
-
import { MLDSASecurityLevel } from '@btc-vision/bip32';
|
|
3
|
-
export interface MLDSASignature {
|
|
4
|
-
readonly signature: string;
|
|
5
|
-
readonly publicKey: string;
|
|
6
|
-
readonly securityLevel: MLDSASecurityLevel;
|
|
7
|
-
readonly messageHash: string;
|
|
8
|
-
}
|
|
9
|
-
export interface OPWallet extends Unisat {
|
|
10
|
-
getMLDSAPublicKey(): Promise<string>;
|
|
11
|
-
signMLDSAMessage(message: string): Promise<MLDSASignature>;
|
|
12
|
-
verifyMLDSASignature(message: string, signature: MLDSASignature): Promise<boolean>;
|
|
13
|
-
}
|
|
14
|
-
export declare function isOPWallet(wallet: unknown): wallet is OPWallet;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare class FastBigIntMap {
|
|
2
|
-
private items;
|
|
3
|
-
private keyOrder;
|
|
4
|
-
constructor(iterable?: ReadonlyArray<readonly [bigint, bigint]> | null | FastBigIntMap);
|
|
5
|
-
get size(): number;
|
|
6
|
-
setAll(map: FastBigIntMap): void;
|
|
7
|
-
addAll(map: FastBigIntMap): void;
|
|
8
|
-
set(key: bigint, value: bigint): this;
|
|
9
|
-
get(key: bigint): bigint | undefined;
|
|
10
|
-
has(key: bigint): boolean;
|
|
11
|
-
delete(key: bigint): boolean;
|
|
12
|
-
clear(): void;
|
|
13
|
-
entries(): IterableIterator<[bigint, bigint]>;
|
|
14
|
-
keys(): IterableIterator<bigint>;
|
|
15
|
-
values(): IterableIterator<bigint>;
|
|
16
|
-
forEach(callback: (value: bigint, key: bigint, map: FastBigIntMap) => void, thisArg?: unknown): void;
|
|
17
|
-
[Symbol.iterator](): IterableIterator<[bigint, bigint]>;
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|