MCPcopy Create free account
hub / github.com/DNAProject/DNA / ImportAccount

Method ImportAccount

account/client.go:208–227  ·  view source on GitHub ↗
(accMeta *AccountMetadata)

Source from the content-addressed store, hash-verified

206}
207
208func (this *ClientImpl) ImportAccount(accMeta *AccountMetadata) error {
209 accData := &AccountData{}
210 accData.Label = accMeta.Label
211 accData.PubKey = accMeta.PubKey
212 accData.SigSch = accMeta.SigSch
213 accData.Key = accMeta.Key
214 accData.Alg = accMeta.KeyType
215 accData.Address = accMeta.Address
216 accData.EncAlg = accMeta.EncAlg
217 accData.Hash = accMeta.Hash
218 accData.Salt = accMeta.Salt
219 accData.Param = map[string]string{"curve": accMeta.Curve}
220
221 oldAccMeta := this.GetAccountMetadataByLabel(accData.Label)
222 if oldAccMeta != nil {
223 //rename
224 accData.Label = fmt.Sprintf("%s_1", accData.Label)
225 }
226 return this.addAccountData(accData)
227}
228
229func (this *ClientImpl) GetAccountByAddress(address string, passwd []byte) (*Account, error) {
230 this.lock.RLock()

Callers

nothing calls this directly

Calls 2

addAccountDataMethod · 0.95

Tested by

no test coverage detected