mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-04 03:09:33 -06:00
18 lines
544 B
Go
18 lines
544 B
Go
package helpers
|
|
|
|
import (
|
|
"crypto/sha256"
|
|
"encoding/hex"
|
|
|
|
providerv1beta1 "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
|
"github.com/opencloud-eu/reva/v2/pkg/storagespace"
|
|
)
|
|
|
|
// HashResourceId builds a urlsafe and stable file reference that can be used for proxy routing,
|
|
// so that all sessions on one file end on the same office server
|
|
func HashResourceId(resourceId *providerv1beta1.ResourceId) string {
|
|
c := sha256.New()
|
|
c.Write([]byte(storagespace.FormatResourceID(resourceId)))
|
|
return hex.EncodeToString(c.Sum(nil))
|
|
}
|