mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
refactor: Now at orbitdb/orbit-db-identity-provider-ethereum.
This commit is contained in:
parent
dc576c00ea
commit
74ab478671
@ -1,70 +0,0 @@
|
||||
// import IdentityProvider from './interface.js'
|
||||
// import { Wallet, verifyMessage } from '@ethersproject/wallet'
|
||||
|
||||
// const type = 'ethereum'
|
||||
|
||||
// class EthIdentityProvider extends IdentityProvider {
|
||||
// constructor ({ wallet } = {}) {
|
||||
// super()
|
||||
// this.wallet = wallet
|
||||
// }
|
||||
|
||||
// // Returns the type of the identity provider
|
||||
// static get type () { return type }
|
||||
|
||||
// // Returns the signer's id
|
||||
// async getId (options = {}) {
|
||||
// if (!this.wallet) {
|
||||
// this.wallet = await this._createWallet(options)
|
||||
// }
|
||||
// return this.wallet.getAddress()
|
||||
// }
|
||||
|
||||
// // Returns a signature of pubkeysignature
|
||||
// async signIdentity (data) {
|
||||
// const wallet = this.wallet
|
||||
|
||||
// if (!wallet) {
|
||||
// throw new Error('wallet is required')
|
||||
// }
|
||||
|
||||
// return wallet.signMessage(data)
|
||||
// }
|
||||
|
||||
// static async verifyIdentity (identity) {
|
||||
// // Verify that identity was signed by the id
|
||||
// const signerAddress = verifyMessage(
|
||||
// identity.publicKey + identity.signatures.id,
|
||||
// identity.signatures.publicKey
|
||||
// )
|
||||
// return (signerAddress === identity.id)
|
||||
// }
|
||||
|
||||
// async _createWallet (options = {}) {
|
||||
// if (options.mnemonicOpts) {
|
||||
// if (!options.mnemonicOpts.mnemonic) {
|
||||
// throw new Error('mnemonic is required')
|
||||
// }
|
||||
|
||||
// const { mnemonic, path, wordlist } = options.mnemonicOpts
|
||||
// return Wallet.fromMnemonic(mnemonic, path, wordlist)
|
||||
// }
|
||||
|
||||
// if (options.encryptedJsonOpts) {
|
||||
// if (!options.encryptedJsonOpts.json) {
|
||||
// throw new Error('encrypted json is required')
|
||||
// }
|
||||
|
||||
// if (!options.encryptedJsonOpts.password) {
|
||||
// throw new Error('password for encrypted json is required')
|
||||
// }
|
||||
|
||||
// const { json, password, progressCallback } = options.encryptedJsonOpts
|
||||
// return Wallet.fromEncryptedJson(json, password, progressCallback)
|
||||
// }
|
||||
|
||||
// return Wallet.createRandom()
|
||||
// }
|
||||
// }
|
||||
|
||||
// export default EthIdentityProvider
|
Loading…
x
Reference in New Issue
Block a user