Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
expose get profile by uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Aug 31, 2022
1 parent 233b034 commit 436ed84
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions profiles/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ func GetProfileE164(tel string) (contacts.Contact, error) {
}

// GetProfileUUID get a profile by a phone number
func GetProfileUUID(uuid string) (*contacts.Contact, error) {
func GetProfileUUID(uuid string) (*Profile, error) {
c := contacts.Contacts[uuid]
profile := &Profile{}
var err error
Expand Down Expand Up @@ -440,5 +440,5 @@ func GetProfileUUID(uuid string) (*contacts.Contact, error) {
}
contacts.Contacts[c.UUID] = c
contacts.WriteContactsToPath()
return &c, nil
return profile, nil
}
10 changes: 10 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,18 @@ func GetProfile(uuid string, profileKey []byte) (*profiles.Profile, error) {
}
return profile, nil
}
func GetProfileByUUID(uuid string) (*profiles.Profile, error) {
profile, err := profiles.GetProfileUUID(uuid)
if err != nil {
return nil, err
}
return profile, nil
}

func GetProfileAndCredential(uuid string, profileKey []byte) (*profiles.Profile, error) {
if uuid == "" || len(profileKey) == 0 {
return nil, fmt.Errorf("uuid or profileKey is empty")
}
profile, err := profiles.GetProfileAndCredential(uuid, profileKey)
if err != nil {
return nil, err
Expand Down

0 comments on commit 436ed84

Please sign in to comment.