You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Usage of bls is problematic under some alternative JS environment for the following reasons:
usage of top-level-wait in a lib
automatic detection of the proper implementation (i.e. use native when node env is detected)
Ideally there would be a way to allow bls users to select the implementation used at runtime. Users should not be able to specify their chosen implementation after the initialization has been done (thus ignoring their choice).
First idea
Single global implementation
BLS_IMPLEMENTATION=herumi node ...
importbls,{init}from"@chainsafe/bls";// Make sure the initialization has been done// Can be called several times, initialization is done only onceawaitinit();constsecretKey=bls.SecretKey.fromKeygen();constmessage=newUint8Array(32);constsignature=secretKey.sign(message);
No automatic init would be done, users explicitly have to do it. Essentially it's a modified version (with env variable) of the existing switchable singleton. This would be the only way to use the lib.
Second idea
Explicitly pass around a bls object tied to an implementation.
Usage of
bls
is problematic under some alternative JS environment for the following reasons:top-level-wait
in a libnative
whennode
env is detected)Ideally there would be a way to allow
bls
users to select the implementation used at runtime. Users should not be able to specify their chosen implementation after the initialization has been done (thus ignoring their choice).First idea
Single global implementation
No automatic
init
would be done, users explicitly have to do it. Essentially it's a modified version (with env variable) of the existing switchable singleton. This would be the only way to use the lib.Second idea
Explicitly pass around a
bls
object tied to an implementation.The text was updated successfully, but these errors were encountered: