api

package
v0.0.0-...-6ffe938 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Overview

Package api defines gomobile-compatible wallet-sdk interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringArrayArrayToGoArray

func StringArrayArrayToGoArray(arrayArray *StringArrayArray) [][]string

StringArrayArrayToGoArray converts StringArrayArray to [][]string.

Types

type Activity

type Activity struct {
	// GoAPIActivity will not be accessible directly in the bindings (will be "skipped").
	// This is OK - this field is not intended to be set directly by the user of the SDK.
	GoAPIActivity *goapi.Activity
}

An Activity represents a single activity.

func ParseActivity

func ParseActivity(activity string) (*Activity, error)

ParseActivity parses the given serialized activity and returns an Activity object.

func (*Activity) Client

func (a *Activity) Client() string

Client returns information about with whom this activity was with. For example: the issuer name, verifier name, etc.

func (*Activity) ID

func (a *Activity) ID() string

ID returns this activity's ID.

func (*Activity) Operation

func (a *Activity) Operation() string

Operation returns what operation was performed. For example: oidc-issuance, oidc-presentation, etc.

func (*Activity) Params

func (a *Activity) Params() *Params

Params returns any additional parameters contained within the activity.

func (*Activity) Serialize

func (a *Activity) Serialize() (string, error)

Serialize serializes this Activity object into JSON.

func (*Activity) Status

func (a *Activity) Status() string

Status returns the status of the operation that was performed. For example: success, failure, etc.

func (*Activity) Type

func (a *Activity) Type() string

Type returns this activity's type.

func (*Activity) UnixTimestamp

func (a *Activity) UnixTimestamp() int64

UnixTimestamp returns the time this activity happened as a Unix timestamp.

type ActivityLogger

type ActivityLogger interface {
	// Log logs a single activity.
	Log(activity *Activity) error
}

An ActivityLogger logs activities.

type Crypto

type Crypto interface {
	// Sign will sign msg using a matching signature primitive from key referenced by keyID
	// returns:
	// 		signature as []byte
	//		error in case of errors
	Sign(msg []byte, keyID string) ([]byte, error)
}

Crypto defines useful Crypto operations.

type DIDDocResolution

type DIDDocResolution struct {
	// Content is the full marshalled DID doc resolution object.
	Content string
}

DIDDocResolution represents a DID document resolution object.

func NewDIDDocResolution

func NewDIDDocResolution(content string) *DIDDocResolution

NewDIDDocResolution creates a new DIDDocResolution.

func (*DIDDocResolution) AssertionMethod

func (d *DIDDocResolution) AssertionMethod() (*VerificationMethod, error)

AssertionMethod returns did assertion verification method.

func (*DIDDocResolution) ID

func (d *DIDDocResolution) ID() (string, error)

ID returns the ID of the DID document contained within this DIDDocResolution.

type DIDResolver

type DIDResolver interface {
	// Resolve resolves a DID. It returns a DID document marshalled as JSON.
	Resolve(did string) ([]byte, error)
}

DIDResolver defines the method required for a type to resolve DIDs.

type Header struct {
	Name  string
	Value string
}

Header represents an HTTP header.

func NewHeader

func NewHeader(name, value string) *Header

NewHeader returns a new HTTP Header.

type Headers

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

Headers represents an array of HTTP headers that can be used in certain APIs.

func NewHeaders

func NewHeaders() *Headers

NewHeaders returns a new Headers object.

func (*Headers) Add

func (h *Headers) Add(header *Header)

Add adds the given HTTP Header to this list of headers.

func (*Headers) GetAll

func (h *Headers) GetAll() []Header

GetAll returns all the headers set in this Headers object as an array of Header objects. This method is not compatible with gomobile and so will not be available in the generated bindings.

type JSONWebKey

type JSONWebKey struct {
	JWK *jwk.JWK `json:"jwk,omitempty"`
}

JSONWebKey holds a public key with associated metadata, in JWK format.

func ParseJSONWebKey

func ParseJSONWebKey(data string) (*JSONWebKey, error)

ParseJSONWebKey parses a JSONWebKey from a JWK in JSON format.

func (*JSONWebKey) ID

func (k *JSONWebKey) ID() string

ID returns the Key ID for this JSONWebKey.

func (*JSONWebKey) Serialize

func (k *JSONWebKey) Serialize() (string, error)

Serialize returns a JSON representation of this JSONWebKey.

type JSONWebKeySet

type JSONWebKeySet struct {
	JWKs []JSONWebKey
}

JSONWebKeySet represents a JWK Set object.

func NewJSONWebKeySet

func NewJSONWebKeySet() *JSONWebKeySet

NewJSONWebKeySet returns a new JSON Web Key Set. It acts as a gomobile-compatible wrapper around a Go array of JSONWebKey objects.

func (*JSONWebKeySet) Append

func (j *JSONWebKeySet) Append(jsonWebKey *JSONWebKey) *JSONWebKeySet

Append appends the given JSONWebKey to the array. It returns a reference to the JSONWebKey in order to allow a caller to chain together Append calls.

func (*JSONWebKeySet) AtIndex

func (j *JSONWebKeySet) AtIndex(index int) *JSONWebKey

AtIndex returns the JSONWebKey at the given index. If the index passed in is out of bounds, then nil is returned.

func (*JSONWebKeySet) Length

func (j *JSONWebKeySet) Length() int

Length returns the number of JSONWebKeys contained within this JSONWebKeySet object.

type KeyValuePair

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

KeyValuePair represents a single key-value pair.

func (*KeyValuePair) Key

func (k *KeyValuePair) Key() string

Key returns this key-value pair's key.

func (*KeyValuePair) ValueString

func (k *KeyValuePair) ValueString() (string, error)

ValueString returns this key-value pair's value. If the value is not a string, then an error is returned.

func (*KeyValuePair) ValueStringArray

func (k *KeyValuePair) ValueStringArray() (*StringArray, error)

ValueStringArray returns this key-value pair's value. If the value is not an array of strings, then an error is returned.

func (*KeyValuePair) ValueType

func (k *KeyValuePair) ValueType() (string, error)

ValueType returns the type of this key-value pair's value. If value is a string, then "string" is returned. If value is an array of strings, then "[]string" is returned. No other types are (currently) supported - if the value is any other type then an error is returned.

type KeyValuePairs

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

KeyValuePairs represents a set of key-value pairs.

func (*KeyValuePairs) AtIndex

func (k *KeyValuePairs) AtIndex(index int) *KeyValuePair

AtIndex returns the key-value pair at the given index. If the index passed in is out of bounds, then nil is returned.

func (*KeyValuePairs) Length

func (k *KeyValuePairs) Length() int

Length returns the number of key-value pairs contained within this KeyValuePairs object.

type LDDocument

type LDDocument struct {
	DocumentURL string `json:"documentURL,omitempty"`
	Document    string `json:"document,omitempty"` // Must be an LD document in JSON form.
	ContextURL  string `json:"contextURL,omitempty"`
}

LDDocument is linked domains document.

type LDDocumentLoader

type LDDocumentLoader interface {
	LoadDocument(url string) (*LDDocument, error)
}

LDDocumentLoader is capable of loading linked domains documents.

type MetricsEvent

type MetricsEvent struct {
	// GoAPIMetricsEvent will not be accessible directly in the bindings (will be "skipped").
	// This is OK - this field is not intended to be set directly by the user of the SDK.
	GoAPIMetricsEvent *goapi.MetricsEvent
}

A MetricsEvent represents a single event that occurred that had performance metrics taken.

func (*MetricsEvent) DurationNanoseconds

func (m *MetricsEvent) DurationNanoseconds() int64

DurationNanoseconds returns event duration as nanoseconds.

func (*MetricsEvent) Event

func (m *MetricsEvent) Event() string

Event returns the event name.

func (*MetricsEvent) ParentEvent

func (m *MetricsEvent) ParentEvent() string

ParentEvent returns the parent event name.

type MetricsLogger

type MetricsLogger interface {
	Log(metricsEvent *MetricsEvent) error
}

MetricsLogger represents a type that can log MetricsEvents.

type Params

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

Params represents additional parameters which may be required for wallet applications in the future. As such, this is currently a placeholder.

func (*Params) AllKeyValuePairs

func (p *Params) AllKeyValuePairs() *KeyValuePairs

AllKeyValuePairs returns all params as key-value pairs.

func (*Params) GetString

func (p *Params) GetString(key string) (string, error)

GetString returns the value stored under the given key. If there is no param with that key, or if the param is not a string then an error is returned.

func (*Params) GetStringArray

func (p *Params) GetStringArray(key string) (*StringArray, error)

GetStringArray returns the value stored under the given key. If there is no param with that key, or if the param is not an array of strings then an error is returned.

func (*Params) GetValueType

func (p *Params) GetValueType(key string) (string, error)

GetValueType returns the type of the value stored under the given key. If there is no param with that key then an error is returned. If value is a string, then "string" is returned. If value is an array of strings, then "[]string" is returned. No other types are (currently) supported - if the value is any other type then an error is returned.

type Signer

type Signer interface {
	Sign(msg []byte) ([]byte, error)
}

A Signer is capable of signing data.

type StringArray

type StringArray struct {
	Strings []string
}

StringArray represents an array of strings. It wraps a standard Go array and provides gomobile-compatible methods that allow a caller to use this type in an array-like manner.

func NewStringArray

func NewStringArray() *StringArray

NewStringArray returns a new string array. It acts as a gomobile-compatible wrapper around a Go string array.

func (*StringArray) Append

func (s *StringArray) Append(value string) *StringArray

Append appends the given string to the array. It returns a reference to the StringArray in order to allow a caller to chain together Append calls.

func (*StringArray) AtIndex

func (s *StringArray) AtIndex(index int) string

AtIndex returns the string at the given index. If the index passed in is out of bounds, then an empty string is returned.

func (*StringArray) Length

func (s *StringArray) Length() int

Length returns the number of strings contained within this StringArray object.

type StringArrayArray

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

StringArrayArray represents an array of StringArray.

func NewStringArrayArray

func NewStringArrayArray() *StringArrayArray

NewStringArrayArray creates new StringArrayArray.

func StringArrayArrayFromGoArray

func StringArrayArrayFromGoArray(arrayArray [][]string) *StringArrayArray

StringArrayArrayFromGoArray converts [][]string to StringArrayArray.

func (*StringArrayArray) Add

Add adds new item to underlying array.

func (*StringArrayArray) AtIndex

func (a *StringArrayArray) AtIndex(index int) *StringArray

AtIndex returns the StringArray at the given index. If the index passed in is out of bounds, then nil is returned.

func (*StringArrayArray) Length

func (a *StringArrayArray) Length() int

Length returns the number of StringArrays contained within this StringArrayArray.

type VerificationMethod

type VerificationMethod struct {
	ID   string
	Type string
	Key  models.VerificationKey
}

VerificationMethod represents a DID verification method.

func NewVerificationMethod

func NewVerificationMethod(keyID, vmType string) *VerificationMethod

NewVerificationMethod creates VerificationMethod.

func (*VerificationMethod) ToSDKVerificationMethod

func (vm *VerificationMethod) ToSDKVerificationMethod() *models.VerificationMethod

ToSDKVerificationMethod returns this VerificationMethod as a models.VerificationMethod.

Jump to

Keyboard shortcuts

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