meta: make a read-only version to enforce token immutability
This commit is contained in:
@@ -142,8 +142,8 @@ func (t *Token) Nonce() []byte {
|
||||
}
|
||||
|
||||
// Meta returns the Token's metadata.
|
||||
func (t *Token) Meta() *meta.Meta {
|
||||
return t.meta
|
||||
func (t *Token) Meta() meta.ReadOnly {
|
||||
return t.meta.ReadOnly()
|
||||
}
|
||||
|
||||
// NotBefore returns the time at which the Token becomes "active".
|
||||
|
||||
@@ -17,7 +17,7 @@ type Token interface {
|
||||
// Issuer returns the did.DID representing the Token's issuer.
|
||||
Issuer() did.DID
|
||||
// Meta returns the Token's metadata.
|
||||
Meta() *meta.Meta
|
||||
Meta() meta.ReadOnly
|
||||
}
|
||||
|
||||
type Marshaller interface {
|
||||
|
||||
@@ -71,8 +71,8 @@ func (t *Token) Nonce() []byte {
|
||||
}
|
||||
|
||||
// Meta returns the Token's metadata.
|
||||
func (t *Token) Meta() *meta.Meta {
|
||||
return t.meta
|
||||
func (t *Token) Meta() meta.ReadOnly {
|
||||
return t.meta.ReadOnly()
|
||||
}
|
||||
|
||||
// Expiration returns the time at which the Token expires.
|
||||
|
||||
Reference in New Issue
Block a user