forked from TrueCloudLab/frostfs-sdk-go
[#252] session: Add Object.Issuer
method
Add method to get `Object` session's issuer similar to `Container`. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
1f7fe6864d
commit
bef4618cd6
2 changed files with 33 additions and 0 deletions
|
@ -377,3 +377,20 @@ func (x Object) AssertAuthKey(key neofscrypto.PublicKey) bool {
|
|||
|
||||
return bytes.Equal(bKey, x.body.GetSessionKey())
|
||||
}
|
||||
|
||||
// Issuer returns user ID of the session issuer.
|
||||
//
|
||||
// Makes sense only for signed Object instances. For unsigned instances,
|
||||
// Issuer returns zero user.ID.
|
||||
//
|
||||
// See also Sign.
|
||||
func (x Object) Issuer() user.ID {
|
||||
var issuer user.ID
|
||||
|
||||
issuerV2 := x.body.GetOwnerID()
|
||||
if issuerV2 != nil {
|
||||
_ = issuer.ReadFromV2(*issuerV2)
|
||||
}
|
||||
|
||||
return issuer
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue