Commit 1198b31 1 parent 05fd293 commit 1198b31 Copy full SHA for 1198b31
File tree 1 file changed +0
-39
lines changed
packages/core/src/secp256k1
1 file changed +0
-39
lines changed Original file line number Diff line number Diff line change @@ -93,45 +93,6 @@ class Secp256k1 {
93
93
) ;
94
94
}
95
95
96
- /**
97
- * Generates a new random private key.
98
- * If an error occurs during generation using
99
- * [nc_secp256k1](https://github.com/paulmillr/noble-secp256k1),
100
- * an AES-GCM key is generated as a fallback in runtimes not supported
101
- * by `nc_secp256k1`, if those support {@link {@link global.crypto}.
102
- *
103
- * @return {Promise<Uint8Array> } The generated private key as a Uint8Array.
104
- *
105
- * @remarks Security auditable method, depends on
106
- * * {@link global.crypto.subtle.exportKey};
107
- * * {@link global.crypto.subtle.generateKey};
108
- * * [nc_secp256k1.utils.randomPrivateKey](https://github.com/paulmillr/noble-secp256k1).
109
- */
110
- public static async _generatePrivateKey ( ) : Promise < Uint8Array > {
111
- try {
112
- return nc_secp256k1 . utils . randomPrivateKey ( ) ;
113
- } catch ( e ) {
114
- // Generate an ECDSA key pair
115
- const cryptoKey = await global . crypto . subtle . generateKey (
116
- {
117
- name : 'AES-GCM' ,
118
- length : 256
119
- } ,
120
- true ,
121
- [ 'encrypt' , 'decrypt' ]
122
- ) ;
123
-
124
- // Export the private key to raw format
125
- const rawKey = await global . crypto . subtle . exportKey (
126
- 'raw' ,
127
- cryptoKey
128
- ) ;
129
-
130
- // Convert the ArrayBuffer to Uint8Array
131
- return new Uint8Array ( rawKey ) ;
132
- }
133
- }
134
-
135
96
/**
136
97
* Generates a new Secp256k1 private key using a secure random number generator.
137
98
*
You can’t perform that action at this time.
0 commit comments