File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,9 @@ import { TinySecp256k1Interface } from './types';
55 * If `eccLib` is a new instance, it will be verified before setting it as the active library.
66 *
77 * @param eccLib The instance of the ECC library to initialize.
8+ * @param skipVerification If the ecc verification should not be executed.
89 */
9- export declare function initEccLib ( eccLib : TinySecp256k1Interface | undefined ) : void ;
10+ export declare function initEccLib ( eccLib : TinySecp256k1Interface | undefined , skipVerification ?: boolean ) : void ;
1011/**
1112 * Retrieves the ECC Library instance.
1213 * Throws an error if the ECC Library is not provided.
Original file line number Diff line number Diff line change @@ -8,14 +8,16 @@ const _ECCLIB_CACHE = {};
88 * If `eccLib` is a new instance, it will be verified before setting it as the active library.
99 *
1010 * @param eccLib The instance of the ECC library to initialize.
11+ * @param skipVerification If the ecc verification should not be executed.
1112 */
12- function initEccLib ( eccLib ) {
13+ function initEccLib ( eccLib , skipVerification ) {
1314 if ( ! eccLib ) {
1415 // allow clearing the library
1516 _ECCLIB_CACHE . eccLib = eccLib ;
1617 } else if ( eccLib !== _ECCLIB_CACHE . eccLib ) {
17- // new instance, verify it
18- verifyEcc ( eccLib ) ;
18+ if ( ! skipVerification )
19+ // new instance, verify it
20+ verifyEcc ( eccLib ) ;
1921 _ECCLIB_CACHE . eccLib = eccLib ;
2022 }
2123}
Original file line number Diff line number Diff line change @@ -8,14 +8,19 @@ const _ECCLIB_CACHE: { eccLib?: TinySecp256k1Interface } = {};
88 * If `eccLib` is a new instance, it will be verified before setting it as the active library.
99 *
1010 * @param eccLib The instance of the ECC library to initialize.
11+ * @param skipVerification If the ecc verification should not be executed.
1112 */
12- export function initEccLib ( eccLib : TinySecp256k1Interface | undefined ) : void {
13+ export function initEccLib (
14+ eccLib : TinySecp256k1Interface | undefined ,
15+ skipVerification ?: boolean ,
16+ ) : void {
1317 if ( ! eccLib ) {
1418 // allow clearing the library
1519 _ECCLIB_CACHE . eccLib = eccLib ;
1620 } else if ( eccLib !== _ECCLIB_CACHE . eccLib ) {
17- // new instance, verify it
18- verifyEcc ( eccLib ! ) ;
21+ if ( ! skipVerification )
22+ // new instance, verify it
23+ verifyEcc ( eccLib ! ) ;
1924 _ECCLIB_CACHE . eccLib = eccLib ;
2025 }
2126}
You can’t perform that action at this time.
0 commit comments