signature

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package signature is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var JSONWebSignature2020Context = ssi.MustParseURI("https://w3c-ccg.github.io/lds-jws2020/contexts/lds-jws2020-v1.json")

JSONWebSignature2020Context defines the JsonWebSignature2020 json-ld context

View Source
var W3idSecurityV1Context = ssi.MustParseURI("https://w3id.org/security/v1")

W3idSecurityV1Context defines the v1 of the w3id json-ld context

View Source
var W3idSecurityV2Context = ssi.MustParseURI("https://w3id.org/security/v2")

W3idSecurityV2Context defines the v2 of the w3id json-ld context

Functions

func AddContext

func AddContext(context interface{}, newContext ssi.URI) []interface{}

AddContext adds the context to the @context array. It makes sure no duplicates will exist.

func NewContextLoader

func NewContextLoader(allowExternalCalls bool) (ld.DocumentLoader, error)

NewContextLoader creates a new JSON-LD context loader with the embedded FS as first loader. It loads the most used context from the embedded FS. This ensures the contents cannot be altered. If allowExternalCalls is set to true, it also loads external context from the internet.

func NewEmbeddedFSDocumentLoader

func NewEmbeddedFSDocumentLoader(fs embed.FS, nextLoader ld.DocumentLoader) ld.DocumentLoader

NewEmbeddedFSDocumentLoader creates a new embeddedFSDocumentLoader for an embedded filesystem.

Types

type JSONWebSignature2020

type JSONWebSignature2020 struct {
	ContextLoader ld.DocumentLoader
}

JSONWebSignature2020 Contains the correct implementation of the JSONWebSignature2020 signature suite It bundles the correct implementation of the canonicalize, hash and sign operations.

func (JSONWebSignature2020) CalculateDigest

func (s JSONWebSignature2020) CalculateDigest(doc []byte) []byte

CalculateDigest calculates the digest of the document. This implementation uses the SHA256 sum.

func (JSONWebSignature2020) CanonicalizeDocument

func (s JSONWebSignature2020) CanonicalizeDocument(doc interface{}) ([]byte, error)

CanonicalizeDocument canonicalizes a document using the LD canonicalization algorithm. Can be used for both the LD proof as the document. It requires the document to have a valid context.

func (JSONWebSignature2020) GetType

func (s JSONWebSignature2020) GetType() ssi.ProofType

GetType returns the signature type, 'JSONWebSignature2020'

func (JSONWebSignature2020) Sign

func (s JSONWebSignature2020) Sign(doc []byte, key crypto.Key) ([]byte, error)

Sign signs the document as a JWS.

type LDUtil

type LDUtil struct {
	LDDocumentLoader ld.DocumentLoader
}

LDUtil package a set of often used JSON-LD operations for re-usability.

func (LDUtil) Canonicalize

func (util LDUtil) Canonicalize(input interface{}) (result interface{}, err error)

Canonicalize canonicalizes the json-ld input according to the URDNA2015 [RDF-DATASET-NORMALIZATION] algorithm.

type LegacyNutsSuite

type LegacyNutsSuite struct {
}

LegacyNutsSuite is the first and wrong implementation of a JSONWebSignature. It is here so all the signatures set in the develop network are still valid. Must be removed in Node version 2.

func (LegacyNutsSuite) CalculateDigest

func (l LegacyNutsSuite) CalculateDigest(doc []byte) []byte

CalculateDigest returns a digest for the doc by calculating the SHA256 hash.

func (LegacyNutsSuite) CanonicalizeDocument

func (l LegacyNutsSuite) CanonicalizeDocument(doc interface{}) ([]byte, error)

CanonicalizeDocument canonicalizes the document by marshalling it to json

func (LegacyNutsSuite) GetType

func (l LegacyNutsSuite) GetType() ssi.ProofType

GetType returns the signature type

func (LegacyNutsSuite) Sign

func (l LegacyNutsSuite) Sign(doc []byte, key crypto.Key) ([]byte, error)

Sign signs the provided doc and returns the signature bytes.

type MockSuite

type MockSuite struct {
	// contains filtered or unexported fields
}

MockSuite is a mock of Suite interface.

func NewMockSuite

func NewMockSuite(ctrl *gomock.Controller) *MockSuite

NewMockSuite creates a new mock instance.

func (*MockSuite) CalculateDigest

func (m *MockSuite) CalculateDigest(doc []byte) []byte

CalculateDigest mocks base method.

func (*MockSuite) CanonicalizeDocument

func (m *MockSuite) CanonicalizeDocument(doc interface{}) ([]byte, error)

CanonicalizeDocument mocks base method.

func (*MockSuite) EXPECT

func (m *MockSuite) EXPECT() *MockSuiteMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSuite) GetType

func (m *MockSuite) GetType() ssi.ProofType

GetType mocks base method.

func (*MockSuite) Sign

func (m *MockSuite) Sign(doc []byte, key crypto.Key) ([]byte, error)

Sign mocks base method.

type MockSuiteMockRecorder

type MockSuiteMockRecorder struct {
	// contains filtered or unexported fields
}

MockSuiteMockRecorder is the mock recorder for MockSuite.

func (*MockSuiteMockRecorder) CalculateDigest

func (mr *MockSuiteMockRecorder) CalculateDigest(doc interface{}) *gomock.Call

CalculateDigest indicates an expected call of CalculateDigest.

func (*MockSuiteMockRecorder) CanonicalizeDocument

func (mr *MockSuiteMockRecorder) CanonicalizeDocument(doc interface{}) *gomock.Call

CanonicalizeDocument indicates an expected call of CanonicalizeDocument.

func (*MockSuiteMockRecorder) GetType

func (mr *MockSuiteMockRecorder) GetType() *gomock.Call

GetType indicates an expected call of GetType.

func (*MockSuiteMockRecorder) Sign

func (mr *MockSuiteMockRecorder) Sign(doc, key interface{}) *gomock.Call

Sign indicates an expected call of Sign.

type Suite

type Suite interface {
	Sign(doc []byte, key crypto.Key) ([]byte, error)
	CanonicalizeDocument(doc interface{}) ([]byte, error)
	CalculateDigest(doc []byte) []byte
	GetType() ssi.ProofType
}

Suite is an interface which defines the methods a signature suite implementation should implement.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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