rl2020

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: Apache-2.0 Imports: 7 Imported by: 6

README

RevocationList2020

This library provides the implementation for the RevocationList2020 proposal described here.

Documentation

Index

Constants

View Source
const (
	TypeRevocationList2020       = "RevocationList2020"
	TypeRevocationList2020Status = "RevocationList2020status"
	Revoke                       = true
	Reset                        = false
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CredentialStatus

type CredentialStatus interface {
	// Coordinates returns the credential list ID to check for revocation,
	// and the index within the list
	Coordinates() (string, int)
	// TypeDef returns the ID and the Type of the credential status itself
	TypeDef() (string, string)
}

CredentialStatus represent the status block of a credential issued using the RevocationList2020 as a revocation method. See https://w3c-ccg.github.io/vc-status-rl-2020/#revocationlist2020status

func NewCredentialStatus

func NewCredentialStatus(rlCredential string, rlIndex int) CredentialStatus

NewCredentialStatus creates a new CredentialStatus

type CredentialStatusJSON

type CredentialStatusJSON struct {
	ID                       string `json:"id"`
	Type                     string `json:"type"`
	RevocationListIndex      int    `json:"revocationListIndex"`
	RevocationListCredential string `json:"revocationListCredential"`
}

CredentialStatusJSON implements the CredentialStatus interface serializable to JSON according to the W3C draft proposal

func (CredentialStatusJSON) Coordinates

func (cs CredentialStatusJSON) Coordinates() (string, int)

Coordinates retun the revocation list id and credential index within the list

func (CredentialStatusJSON) TypeDef

func (cs CredentialStatusJSON) TypeDef() (string, string)

TypeDef returns the credential status ID and type for correctness check

type RevocationList2020

type RevocationList2020 struct {
	ID          string `json:"id"`
	Type        string `json:"type"`
	EncodedList string `json:"encodedList"`
	// contains filtered or unexported fields
}

RevocationList2020 represent the credential subject of a RevocationList2020 credential as defined in https://w3c-ccg.github.io/vc-status-rl-2020/

func NewRevocationList

func NewRevocationList(id string, kbSize int) (rl RevocationList2020, err error)

NewRevocationList creates a new revocation lists of the specified size

func NewRevocationListFromJSON

func NewRevocationListFromJSON(data []byte) (rl RevocationList2020, err error)

NewRevocationListFromJSON parse

func (RevocationList2020) BitSet

func (rl RevocationList2020) BitSet() []byte

BitSet return the bitset associated with the revocation list

func (RevocationList2020) Capacity

func (rl RevocationList2020) Capacity() int

Capacity returns the number of credentials that can be handled by this revocation list

func (RevocationList2020) GetBytes

func (rl RevocationList2020) GetBytes() ([]byte, error)

GetBytes returns the json serialized revocation list

func (RevocationList2020) IsRevoked

func (rl RevocationList2020) IsRevoked(status CredentialStatus) (isIt bool, err error)

IsRevoked check the value for CredentialStatus in the list. Check if the corresponding bit is set (1) or not (0)

func (*RevocationList2020) Reset

func (rl *RevocationList2020) Reset(credentials ...int) (err error)

Reset reset a credential status by it's index, that is, set the corresponding bit to 0

func (*RevocationList2020) Revoke

func (rl *RevocationList2020) Revoke(credentials ...int) (err error)

Revoke revoke a credential by it's index, that is, set the corresponding bit to 1

func (RevocationList2020) Size

func (rl RevocationList2020) Size() int

Size returns the size in KB of the revocation list

func (*RevocationList2020) Update

func (rl *RevocationList2020) Update(action bool, indexes ...int) (err error)

Update - set a list of credential indexes either to revoked (action to true) or reset (action to false)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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