@@ -62,18 +62,6 @@ describe('Crypto', function () {
62
62
pri . publicKey . secp256k1Uncompressed . bytes
63
63
)
64
64
} )
65
- it ( 'derives address from public key' , function ( ) {
66
- // using the sample from https://kobl.one/blog/create-full-ethereum-keypair-and-address/
67
- const bytes = utils . hexToBytes (
68
- '04836b35a026743e823a90a0ee3b91bf615c6a757e2b60b9e1dc1826fd0dd16106f7bc1e8179f665015f43c6c81f39062fc2086ed849625c06e04697698b21855e'
69
- )
70
- const pub = new PublicKey ( {
71
- secp256k1Uncompressed : { bytes } ,
72
- timestamp : new Date ( ) . getTime ( ) ,
73
- } )
74
- const address = pub . getEthereumAddress ( )
75
- assert . equal ( address , '0x0BED7ABd61247635c1973eB38474A2516eD1D884' )
76
- } )
77
65
it ( 'encrypts and decrypts payload with key bundles' , async function ( ) {
78
66
const alice = await PrivateKeyBundle . generate ( )
79
67
const bob = await PrivateKeyBundle . generate ( )
@@ -99,49 +87,4 @@ describe('Crypto', function () {
99
87
assert . ok ( pub2 . preKey )
100
88
assert . ok ( pub2 . identityKey . verifyKey ( pub2 . preKey ) )
101
89
} )
102
- it ( 'signs keys using a wallet' , async function ( ) {
103
- // create a wallet using a generated key
104
- const alice = PrivateKey . generate ( )
105
- assert . ok ( alice . secp256k1 )
106
- const wallet = new ethers . Wallet ( alice . secp256k1 . bytes )
107
- // sanity check that we agree with the wallet about the address
108
- assert . ok ( wallet . address , alice . publicKey . getEthereumAddress ( ) )
109
- // sign the public key using the wallet
110
- await alice . publicKey . signWithWallet ( wallet )
111
- // validate the key signature and return wallet address
112
- const address = alice . publicKey . walletSignatureAddress ( )
113
- assert . equal ( address , wallet . address )
114
- } )
115
- it ( 'encrypts private key bundle for storage using a wallet' , async function ( ) {
116
- // create a wallet using a generated key
117
- const alice = PrivateKey . generate ( )
118
- assert . ok ( alice . secp256k1 )
119
- const wallet = new ethers . Wallet ( alice . secp256k1 . bytes )
120
- // generate key bundle
121
- const bob = await PrivateKeyBundle . generate ( wallet )
122
- // encrypt and serialize the bundle for storage
123
- const bytes = await bob . encode ( wallet )
124
- // decrypt and decode the bundle from storage
125
- const bobDecoded = await PrivateKeyBundle . decode ( wallet , bytes )
126
- assert . ok ( bob . identityKey )
127
- assert . ok ( bobDecoded . identityKey )
128
- assert . ok ( bob . identityKey . publicKey . signature )
129
- assert . ok ( bobDecoded . identityKey . publicKey . signature )
130
- assert . deepEqual (
131
- bob . identityKey . publicKey . signature ?. ecdsaCompact ?. bytes ,
132
- bobDecoded . identityKey . publicKey . signature ?. ecdsaCompact ?. bytes
133
- )
134
- assert . ok ( bob . identityKey . secp256k1 )
135
- assert . ok ( bobDecoded . identityKey . secp256k1 )
136
- assert . deepEqual (
137
- bob . identityKey . secp256k1 . bytes ,
138
- bobDecoded . identityKey . secp256k1 . bytes
139
- )
140
- assert . ok ( bob . preKeys [ 0 ] . secp256k1 )
141
- assert . ok ( bobDecoded . preKeys [ 0 ] . secp256k1 )
142
- assert . deepEqual (
143
- bob . preKeys [ 0 ] . secp256k1 . bytes ,
144
- bobDecoded . preKeys [ 0 ] . secp256k1 . bytes
145
- )
146
- } )
147
90
} )
0 commit comments