ratsdtoken

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright 2026 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	LegacyProfile = "tag:github.com,2024:veraison/ratsd"

	NonceAdjustFunctionShake128 = "shake-128"
	NonceAdjustFunctionShake256 = "shake-256"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	EatProfile          *eat.Profile    `json:"eat_profile"`
	EatNonce            *eat.Nonce      `json:"eat_nonce"`
	CMW                 string          `json:"cmw"`
	NonceAdjustFunction *string         `json:"vnd.veraison.nonce_adjust_function,omitempty"`
	NonceAdjustMap      map[string]uint `json:"vnd.veraison.nonce_adjust_map,omitempty"`
}

Claims contains the legacy RATSD token claims defined in docs/ratsd-token.cddl.

func (Claims) GetCMW

func (c Claims) GetCMW() *cmw.CMW

GetCMW returns the legacy CMW collection claim.

func (Claims) GetEatNonce

func (c Claims) GetEatNonce() *eat.Nonce

GetEatNonce returns the EAT nonce claim.

func (Claims) GetEatProfile

func (c Claims) GetEatProfile() *eat.Profile

GetEatProfile returns the EAT profile claim.

func (Claims) GetKeyandNonceSz

func (c Claims) GetKeyandNonceSz(key string) (uint, bool)

GetKeyandNonceSz returns the configured adjusted nonce size for the given key. The boolean result reports whether the key was present in the nonce-adjust map.

func (Claims) GetNonceAdjustFn

func (c Claims) GetNonceAdjustFn() string

GetNonceAdjustFn returns the nonce adjustment algorithm, if set.

func (Claims) GetNonceAdjustMap

func (c Claims) GetNonceAdjustMap() map[string]uint

GetNonceAdjustMap returns a copy of the nonce adjustment map.

func (*Claims) SetCMW

func (c *Claims) SetCMW(v interface{}) error

SetCMW serializes the supplied CMW object into the legacy base64 claim form.

func (*Claims) SetKeyandNonceSz

func (c *Claims) SetKeyandNonceSz(key string, sz uint) error

SetKeyandNonceSz sets the nonce-adjusted size for a given key.

func (*Claims) SetNonce

func (c *Claims) SetNonce(v []byte) error

SetNonce replaces the stored EAT nonce with the supplied raw nonce value.

func (*Claims) SetNonceAdjustFn

func (c *Claims) SetNonceAdjustFn(alg string) error

SetNonceAdjustFn sets the nonce adjustment algorithm.

type Evidence

type Evidence struct {
	Claims Claims `json:"-"`
}

Evidence exposes the legacy RATSD token as a single claims container.

func NewEvidence

func NewEvidence() *Evidence

NewEvidence returns an Evidence with the legacy EAT profile preset.

func (Evidence) GetClaims

func (e Evidence) GetClaims() (c Claims, err error)

GetClaims returns a copy of the stored claims after validating the evidence state.

func (Evidence) MarshalJSON

func (e Evidence) MarshalJSON() ([]byte, error)

MarshalJSON encodes Evidence using the flat legacy claim layout.

func (*Evidence) SetClaims

func (e *Evidence) SetClaims(c Claims) error

SetClaims attaches the supplied claims to the Evidence instance. Only successfully validated claims are allowed to be set.

func (*Evidence) UnmarshalJSON

func (e *Evidence) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes Evidence from the flat legacy claim layout.

func (*Evidence) Valid

func (e *Evidence) Valid() error

Valid checks whether the Evidence matches the legacy RATSD token shape.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL