mirror of
https://github.com/owncloud/ocis
synced 2026-04-25 17:25:21 +02:00
18 lines
540 B
Go
18 lines
540 B
Go
package helpers
|
|
|
|
import (
|
|
"crypto/sha256"
|
|
"encoding/hex"
|
|
|
|
providerv1beta1 "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
|
"github.com/owncloud/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))
|
|
}
|