basic keylist support
@@ -15,8 +15,7 @@ type FileInfo struct {
Size int64
ExpirationTime time.Time
Deleted bool
- // TODO: When KeyList is implemented
- // Keys []Keys
+ Keys []Ed25519PublicKey
}
func NewFileInfoQuery() *FileInfoQuery {
@@ -39,11 +38,26 @@ func (builder *FileInfoQuery) Execute(client *Client) (FileInfo, error) {
return FileInfo{}, err
}
+ pbKeyList := resp.GetFileGetInfo().FileInfo.Keys.Keys
+
+ keyList := make([]Ed25519PublicKey, len(pbKeyList))
+
+ for i, key := range(pbKeyList) {
+
+ // todo: support more than ed25519keys
+ keyList[i], err = Ed25519PublicKeyFromBytes(key.GetEd25519())
+
+ if err != nil {
+ return FileInfo{}, err
+ }
+ }
+
return FileInfo{
FileID: fileIDFromProto(resp.GetFileGetInfo().FileInfo.FileID),
Size: resp.GetFileGetInfo().FileInfo.Size,
ExpirationTime: timeFromProto(resp.GetFileGetInfo().FileInfo.ExpirationTime),
Deleted: resp.GetFileGetInfo().FileInfo.Deleted,
+ Keys: keyList,
}, nil
}
