This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update zkgroup + improve group handling
- Loading branch information
1 parent
04e83ca
commit 0deacab
Showing
21 changed files
with
2,183 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package entities | ||
|
||
import ( | ||
"bytes" | ||
) | ||
|
||
type GroupUser struct { | ||
UserCiphertext []byte | ||
GroupPublicKey []byte | ||
GroupId []byte | ||
StrGroupId string | ||
StrUserUUId string | ||
} | ||
|
||
func (user *GroupUser) IsMember(uuid, groupPublicKey []byte) bool { | ||
f1 := bytes.Equal(user.GroupPublicKey, groupPublicKey) | ||
f2 := bytes.Equal(user.UserCiphertext, uuid) | ||
return f1 && f2 | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package entities | ||
|
||
import ( | ||
"encoding/json" | ||
"net/http" | ||
"path" | ||
"runtime" | ||
|
||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
type ResponseStatus struct { | ||
Code int `json:"code" example:"200"` | ||
Message string `json:"message" example:"OK"` | ||
Reason string `json:"reason" example:"param error"` | ||
File string `json:"file" example:"param error"` | ||
Line int `json:"line" example:"param error"` | ||
FuncName string `json:"func"` | ||
} | ||
|
||
func (rs *ResponseStatus) Error() string { | ||
jsb, _ := json.Marshal(rs) | ||
log.Errorln(string(jsb)) | ||
return string(jsb) | ||
} | ||
|
||
func Status(code int, reason string) error { | ||
fname, file, line, _ := runtime.Caller(1) | ||
return &ResponseStatus{ | ||
Code: code, | ||
Message: http.StatusText(code), | ||
Reason: reason, | ||
File: path.Base(file), | ||
Line: line, | ||
FuncName: path.Base(runtime.FuncForPC(fname).Name()), | ||
} | ||
} | ||
|
||
type Resp struct { | ||
Obj interface{} `json:"obj"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.