feat: add meta MetadataParentLink

This commit is contained in:
Derrick Hammer 2024-01-05 08:41:17 -05:00
parent 36c4212305
commit 93782c9db7
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 39 additions and 0 deletions

24
metadata/parent_link.go Normal file
View File

@ -0,0 +1,24 @@
package metadata
import (
"git.lumeweb.com/LumeWeb/libs5-go/encoding"
"git.lumeweb.com/LumeWeb/libs5-go/types"
)
// MetadataParentLink represents the structure for Metadata Parent Link.
type MetadataParentLink struct {
CID *encoding.CID
Type types.ParentLinkType
Role string
Signed bool
}
// NewMetadataParentLink creates a new MetadataParentLink with the provided values.
func NewMetadataParentLink(cid *encoding.CID, role string, signed bool) *MetadataParentLink {
return &MetadataParentLink{
CID: cid,
Type: types.ParentLinkTypeUserIdentity,
Role: role,
Signed: signed,
}
}

15
types/parent_link.go Normal file
View File

@ -0,0 +1,15 @@
package types
type ParentLinkType int
const (
ParentLinkTypeUserIdentity ParentLinkType = 0x01
ParentLinkTypeBoard ParentLinkType = 0x05
ParentLinkTypeBridgeUser ParentLinkType = 0x0A
)
var ParentLinkTypeMap = map[ParentLinkType]string{
ParentLinkTypeUserIdentity: "UserIdentity",
ParentLinkTypeBoard: "Board",
ParentLinkTypeBridgeUser: "BridgeUser",
}