dev-api-aliases-v2 #6

Merged
lash merged 5 commits from dev-api-aliases-v2 into master 2025-01-23 15:28:06 +01:00
Showing only changes of commit 448fdffbd0 - Show all commits

View File

@ -346,17 +346,13 @@ func (das *DevAccountService) saveAlias(ctx context.Context, alias map[string]st
if das.db == nil {
return fmt.Errorf("Db cannot be nil")
}
sessionId, ok := ctx.Value("SessionId").(string)
if !ok {
return fmt.Errorf("unresolved session id")
}
for k, v := range alias {
k_ := das.prefixKeyFor("alias", k)
v_, err := json.Marshal(v)
if err != nil {
return err
}
das.db.SetSession(sessionId)
lash marked this conversation as resolved
Review

Please explain this change?

Please explain this change?
Review

When the alias is saved,it will need to be retrieved by any other session id during Send.So when resolving the alias address,we don't really yet know the exact session id the alias belongs to beforehand.It made sense to me to keep this as an independent record that would be resolved in a similar way that we check if a certain public key is in the list of created accounts.

When the alias is saved,it will need to be retrieved by any other session id during Send.So when resolving the alias address,we don't really yet know the exact session id the alias belongs to beforehand.It made sense to me to keep this as an independent record that would be resolved in a similar way that we check if a certain public key is in the list of created accounts.
das.db.SetSession("")
das.db.SetPrefix(db.DATATYPE_USERDATA)
return das.db.Put(ctx, []byte(k_), v_)
}