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
This issue is scoped to the item about sodium-native et al. being a problematic dependency.
Design Idea: Crypto provider flexibility
What if we made an assumption about the existence of a shim layer that was then provided to us as a polyfill? For example, we would write,
// in e.g. src/keypair.jsimport{CryptoProvider}from'stellar-crypto';// the following can be assumed to exist:CryptoProvider.signCryptoProvider.verifyCryptoProvider.generate
Then, the user can either leverage existing providers (sodium-native, tweetnacl, etc.) or implement their own shim layer:
// index.jsimport{createSecretKey}from'crypto';// node's crypto lib// // This is just to demonstrate how the shim layer would work, not provide a// secure implementation of a shim via Node's `crypto` library. DON'T USE THIS.//functiongenerate(){// https://nodejs.org/api/crypto.html#cryptocreatesecretkeykey-encodingconst{ publicKey, privateKey }=generateKeyPairSync('ed25519')return[publicKey,privateKey]}// etc.
and run
yarn link 'stellar-crypto'
Just as easily, they could use sodium-native as a shim, tweetnacl, noble, etc. The onus of choice would be on them, though we could provide some defaults, e.g.
yarn add @stellar/sdk @stellar/sdk-sodium-shim
The text was updated successfully, but these errors were encountered:
Parent Epic: stellar/js-stellar-sdk#848
This issue is scoped to the item about
sodium-native
et al. being a problematic dependency.Design Idea: Crypto provider flexibility
What if we made an assumption about the existence of a shim layer that was then provided to us as a polyfill? For example, we would write,
Then, the user can either leverage existing providers (
sodium-native
,tweetnacl
, etc.) or implement their own shim layer:and run
yarn link 'stellar-crypto'
Just as easily, they could use
sodium-native
as a shim, tweetnacl, noble, etc. The onus of choice would be on them, though we could provide some defaults, e.g.The text was updated successfully, but these errors were encountered: