credential

package
v0.0.0-...-ef7a112 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainersToInterface

func ContainersToInterface(cs []Container) []any

func CopyCredential

CopyCredential copies a credential into a new credential

Types

type Container

type Container struct {
	// UUID assigned by the oac-service. For example, 48958871-6a6d-4a25-889f-88c9c6835780. The `credential.id`
	// value will be a URL that can be dereferenced, which includes this ID.
	ID string `json:"id,omitempty"`

	// Fully qualified verification method ID that can be used to verify the credential. For example
	// `did:ion:EiDpQBo_nEfuLVeppgmPVQNEhtrnZLWFsB9ziZUuaKCJ3Q#83526c36-136c-423b-a57a-f190b83ae531`.
	FullyQualifiedVerificationMethodID string `json:"fullyQualifiedVerificationMethodId,omitempty"`

	// Verifiable Credential in the `application/vc+ld+json` format. The credential is secured with an external proof
	// using JWS. In other words, the `proof` field is not present. See `credentialJwt` for the secured Verifiable
	// Credential.
	Credential *credential.VerifiableCredential `json:"credential,omitempty"`

	// JWT representation of `credential`, secured with an external proof. Verification can be done according to
	// `fullyQualifiedVerificationMethodId`.
	CredentialJWT *keyaccess.JWT `json:"credentialJwt,omitempty"`

	// Whether this credential is currently revoked.
	Revoked bool `json:"revoked,omitempty"`

	// Whether this credential is currently suspended.
	Suspended bool `json:"suspended,omitempty"`
}

Container acts as an abstraction over both possible credential representations JWT representations are parsed upon container creation, while the original JWT is maintained

func NewCredentialContainerFromArray

func NewCredentialContainerFromArray(creds []any) ([]Container, error)

NewCredentialContainerFromArray attempts to parse arrays of credentials of any type (either data integrity or JWT) into an array of CredentialContainers. The method will return an error if any of the credentials are invalid.

func NewCredentialContainerFromJWT

func NewCredentialContainerFromJWT(credentialJWT string) (*Container, error)

NewCredentialContainerFromJWT attempts to parse a VC-JWT credential from a string into a Container

func NewCredentialContainerFromMap

func NewCredentialContainerFromMap(credMap map[string]any) (*Container, error)

NewCredentialContainerFromMap attempts to parse a data integrity credential from a piece of JSON, which is represented as a map in go, into a Container

func (Container) HasDataIntegrityCredential

func (c Container) HasDataIntegrityCredential() bool

func (Container) HasJWTCredential

func (c Container) HasJWTCredential() bool

func (Container) HasSignedCredential

func (c Container) HasSignedCredential() bool

func (Container) IsValid

func (c Container) IsValid() bool

func (Container) JWTString

func (c Container) JWTString() string

Jump to

Keyboard shortcuts

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