ffi

package
v0.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Bridge trampolines for the public packages.

Each public type that needs to cross a package boundary has a pair of function-typed vars here. The owning public package populates both in its init():

<Type>Of(any) *<Type>      // extract the ffi handle from a public wrapper
To<Type>(*<Type>) any      // build a public wrapper from an ffi handle

Sibling packages call these (with a type assertion on the create side) so public types can keep their handle field unexported AND not expose Wrap/ Unwrap helpers in their godoc. Misuse panics at runtime — the trampolines are only ever wired up correctly from within this SDK.

Package ffi is the single cgo boundary for the zktf Go SDK.

It is the ONLY package in this module that does `import "C"`. Every other package is pure Go and talks to the native zktf library exclusively through the Go types and functions exported here. Keeping all cgo in one package avoids two problems that the previous-generation self-go-sdk suffered from:

  1. cgo gives every package that imports "C" its own *distinct* set of C types, so sharing a C pointer across packages required `//go:linkname`. With a single cgo package there is no cross-package C type and no linkname is ever needed.

  2. The C types never escape: each wrapper struct holds its `*C.zktf_*` pointer in an UNEXPORTED field, so no exported signature — here or in any public package — ever mentions a C type.

Build prerequisites: the native header `zktf-sdk.h` must be on the C include path and `libzktf_sdk` on the linker path, matching the version pinned in `zktf-sdk-version` at the repo root.

Primary path — scripted fetch of the prebuilt archive:

eval "$(scripts/fetch-native.sh)"
go build ./...

`scripts/fetch-native.sh` reads `zktf-sdk-version`, maps GOOS/GOARCH to the matching Rust target triple, downloads `zktf-sdk-<triple>-<version>.tar.gz` from `gs://download.joinself.com/zktf-sdk/` (via curl/wget against the public HTTPS mirror, falling back to `gcloud storage cp`) into `.zktf-native/`, and prints the `CGO_CFLAGS` / `CGO_LDFLAGS` / `LD_LIBRARY_PATH` values needed to build against it (it also writes them to a sourceable `.env`). CI runs this same script before `go build` / `go test`.

Fallback — local dev against a sibling zktf-sdk checkout:

If you are iterating on the native side too, point cgo directly at a sibling `zktf-sdk` checkout instead of the pinned prebuilt archive:

CGO_CFLAGS=-I/path/to/zktf-sdk/crates/zktf-ffi \
CGO_LDFLAGS=-L/path/to/zktf-sdk/target/debug \
LD_LIBRARY_PATH=/path/to/zktf-sdk/target/debug \
go build ./...

Async future plumbing.

The native SDK exposes both a blocking `zktf_future_*_wait` and a callback- based `zktf_future_*_on_complete` for every future. Blocking the calling thread in C is invisible to the Go scheduler — it consumes an OS thread that can't be preempted. We avoid that by always using `_on_complete`: the native runtime invokes our callback (success, failure, or timeout — the SDK enforces the timeout internally) and we deliver the result over a oneshot channel.

The Go side passes a cgo.Handle wrapping the result channel as the C user_data, which is shuttled through C as uintptr_t to avoid Go pointers crossing into C. Each future kind has its own //export trampoline that recovers the channel and sends the typed result.

Index

Constants

View Source
const DefaultTimeout = 30 * time.Second

DefaultTimeout is the default timeout applied to async operations when the caller doesn't pass one.

Variables

View Source
var (
	SigningPublicKeyOf  func(any) *SigningPublicKey
	ToSigningPublicKey  func(*SigningPublicKey) any
	ExchangePublicKeyOf func(any) *ExchangePublicKey
	ToExchangePublicKey func(*ExchangePublicKey) any
)

keypair

View Source
var (
	DIDAddressOf             func(any) *DIDAddress
	ToDIDAddress             func(*DIDAddress) any
	CredentialTermOf         func(any) *CredentialTerm
	ToCredentialTerm         func(*CredentialTerm) any
	CredentialOf             func(any) *VerifiableCredential
	ToCredential             func(*VerifiableCredential) any
	VerifiableCredentialOf   func(any) *VerifiableCredential
	ToVerifiableCredential   func(*VerifiableCredential) any
	VerifiablePresentationOf func(any) *VerifiablePresentation
	ToVerifiablePresentation func(*VerifiablePresentation) any
	CredentialGraphOf        func(any) *CredentialGraph
	ToCredentialGraph        func(*CredentialGraph) any
	RevocationProofOf        func(any) *RevocationProof
	ToRevocationProof        func(*RevocationProof) any
	CredentialExchangeOf     func(any) *CredentialExchange
	ToCredentialExchange     func(*CredentialExchange) any
)

credential

View Source
var (
	PredicateTreeOf func(any) *PredicateTree
	ToPredicateTree func(*PredicateTree) any
)

credential/predicate

View Source
var (
	IdentityDocumentOf  func(any) *IdentityDocument
	ToIdentityDocument  func(*IdentityDocument) any
	IdentityOperationOf func(any) *IdentityOperation
	ToIdentityOperation func(*IdentityOperation) any
	IdentityLookupOf    func(any) *IdentityLookup
	ToIdentityLookup    func(*IdentityLookup) any
)

identity

View Source
var (
	GroupOf              func(any) *Group
	ToGroup              func(*Group) any
	GroupLookupOf        func(any) *GroupLookup
	ToGroupLookup        func(*GroupLookup) any
	GroupUpdateRequestOf func(any) *GroupUpdateRequest
	ToGroupUpdateRequest func(*GroupUpdateRequest) any
)

group

View Source
var (
	CryptoKeyPackageOf func(any) *CryptoKeyPackage
	ToCryptoKeyPackage func(*CryptoKeyPackage) any
	CryptoWelcomeOf    func(any) *CryptoWelcome
	ToCryptoWelcome    func(*CryptoWelcome) any
)

crypto

View Source
var (
	PairwiseIdentityOf     func(any) *PairwiseIdentity
	ToPairwiseIdentity     func(*PairwiseIdentity) any
	PairwiseIntroductionOf func(any) *PairwiseIntroduction
	ToPairwiseIntroduction func(*PairwiseIntroduction) any
)

pairwise

View Source
var (
	RevocationStatementOf func(any) *RevocationStatement
	ToRevocationStatement func(*RevocationStatement) any
)

revocation

View Source
var (
	TokenOf                 func(any) *Token
	ToToken                 func(*Token) any
	TokenRequestOf          func(any) *TokenRequest
	ToTokenRequest          func(*TokenRequest) any
	ObjectOf                func(any) *Object
	ToObject                func(*Object) any
	TrustedIssuerRegistryOf func(any) *TrustedIssuerRegistry
	ToTrustedIssuerRegistry func(*TrustedIssuerRegistry) any
)

token / object / trust

View Source
var (
	ContentOf               func(any) *Content
	ToContent               func(*Content) any
	MessageOf               func(any) *Message
	ToMessage               func(*Message) any
	MessageContentSummaryOf func(any) *MessageContentSummary
	ToMessageContentSummary func(*MessageContentSummary) any
)

message — content + meta

View Source
var (
	ActionOf           func(any) *Action
	ToAction           func(*Action) any
	OutcomeOf          func(any) *Outcome
	ToOutcome          func(*Outcome) any
	ExchangeRequestOf  func(any) *ExchangeRequest
	ToExchangeRequest  func(*ExchangeRequest) any
	ExchangeResponseOf func(any) *ExchangeResponse
	ToExchangeResponse func(*ExchangeResponse) any
)

message — exchange action/outcome polymorphism

View Source
var (
	PresentationActionOf      func(any) *PresentationAction
	ToPresentationAction      func(*PresentationAction) any
	PresentationResultOf      func(any) *PresentationResult
	ToPresentationResult      func(*PresentationResult) any
	VerificationActionOf      func(any) *VerificationAction
	ToVerificationAction      func(*VerificationAction) any
	VerificationResultOf      func(any) *VerificationResult
	ToVerificationResult      func(*VerificationResult) any
	IdentitySigningActionOf   func(any) *IdentitySigningAction
	ToIdentitySigningAction   func(*IdentitySigningAction) any
	IdentitySigningResultOf   func(any) *IdentitySigningResult
	ToIdentitySigningResult   func(*IdentitySigningResult) any
	RevocationSigningActionOf func(any) *RevocationSigningAction
	ToRevocationSigningAction func(*RevocationSigningAction) any
	RevocationSigningResultOf func(any) *RevocationSigningResult
	ToRevocationSigningResult func(*RevocationSigningResult) any
	DevicePairingActionOf     func(any) *DevicePairingAction
	ToDevicePairingAction     func(*DevicePairingAction) any
	DevicePairingResultOf     func(any) *DevicePairingResult
	ToDevicePairingResult     func(*DevicePairingResult) any
)

message — per-kind request/response bodies

View Source
var (
	StatusEventOf     func(any) *StatusEvent
	ToStatusEvent     func(*StatusEvent) any
	GroupEventOf      func(any) *GroupEvent
	ToGroupEvent      func(*GroupEvent) any
	WorkflowEventOf   func(any) *WorkflowEvent
	ToWorkflowEvent   func(*WorkflowEvent) any
	KeyPackageEventOf func(any) *KeyPackageEvent
	ToKeyPackageEvent func(*KeyPackageEvent) any
	WelcomeEventOf    func(any) *WelcomeEvent
	ToWelcomeEvent    func(*WelcomeEvent) any
	CommitEventOf     func(any) *CommitEvent
	ToCommitEvent     func(*CommitEvent) any
	ProposalEventOf   func(any) *ProposalEvent
	ToProposalEvent   func(*ProposalEvent) any
	DroppedEventOf    func(any) *DroppedEvent
	ToDroppedEvent    func(*DroppedEvent) any
)

event — status + group + workflow + the wire events nested under group

Functions

func AwaitStatus

func AwaitStatus(fut *C.zktf_future_status, timeout time.Duration) error

AwaitStatus drives a zktf_future_status to completion via callback and returns once the channel has been signalled.

func DefaultIssuedCredentialTypes

func DefaultIssuedCredentialTypes() []string

DefaultIssuedCredentialTypes returns the default credential types issued by self.

func DefaultIssuerEpoch

func DefaultIssuerEpoch() int64

DefaultIssuerEpoch returns the default epoch (unix seconds) from when credentials issued by self are valid.

func SetLogHandler

func SetLogHandler(h LogHandler)

SetLogHandler registers the process-global log handler. A nil handler is a safe no-op.

Types

type Account

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

Account wraps a zktf_account handle.

func NewAccount

func NewAccount() *Account

NewAccount allocates an unconfigured account.

func (*Account) Close

func (a *Account) Close()

Close destroys the native account and releases the cgo.Handle pinning its callbacks, stopping the GC cleanup to avoid a double free. No-op if already closed.

func (*Account) Configure

func (a *Account) Configure(cfg AccountConfig, cb AccountCallbacks) error

Configure configures the account and registers its callbacks. The callbacks are kept alive via a cgo.Handle for the lifetime of the account.

func (*Account) CredentialExchangeLog

func (a *Account) CredentialExchangeLog(with *SigningPublicKey, tree *PredicateTree) ([]*CredentialExchange, error)

CredentialExchangeLog returns the credential exchange log, optionally restricted to exchanges with an address and to credentials satisfying a predicate tree. Either filter may be nil.

func (*Account) CredentialExchangeTrack

func (a *Account) CredentialExchangeTrack(with *SigningPublicKey, vc *VerifiableCredential) error

CredentialExchangeTrack records that a credential was exchanged with an address.

func (*Account) CredentialGraphCreate

func (a *Account) CredentialGraphCreate(registry *TrustedIssuerRegistry, presentations []*VerifiablePresentation, timeout time.Duration) (*CredentialGraph, error)

CredentialGraphCreate builds a credential graph for a holder by validating the given presentations against the trusted-issuer registry, via callback.

func (*Account) CredentialIssue

func (a *Account) CredentialIssue(credential *VerifiableCredential) (*VerifiableCredential, error)

CredentialIssue signs a credential (with pending signers queued via CredentialBuilder.SignWith) into a verifiable credential. The signature is applied in place; the same credential is returned once signed.

func (*Account) CredentialLookup

func (a *Account) CredentialLookup(tree *PredicateTree) ([]*VerifiableCredential, error)

CredentialLookup returns credentials in the account's local store that satisfy the given predicate tree.

func (*Account) CredentialSharedWith

func (a *Account) CredentialSharedWith(with *SigningPublicKey, tree *PredicateTree) ([]*VerifiableCredential, error)

CredentialSharedWith returns credentials the account has shared with the given address that satisfy the predicate tree.

func (*Account) CredentialStore

func (a *Account) CredentialStore(credential *VerifiableCredential) error

CredentialStore stores a verifiable credential in the account's local store.

func (*Account) GroupAccept

func (a *Account) GroupAccept(as *SigningPublicKey, welcome *CryptoWelcome, timeout time.Duration) (*Group, error)

GroupAccept accepts a received welcome to join an encrypted group session via callback.

func (*Account) GroupEstablish

func (a *Account) GroupEstablish(as *SigningPublicKey, keyPackage *CryptoKeyPackage, timeout time.Duration) (*Group, error)

GroupEstablish uses a received key package to establish an encrypted group session via callback.

func (*Account) GroupLeave

func (a *Account) GroupLeave(g *Group) error

GroupLeave leaves a group.

func (*Account) GroupLookup

func (a *Account) GroupLookup(l *GroupLookup) ([]*Group, error)

GroupLookup returns groups matching the lookup query.

func (*Account) GroupNegotiate

func (a *Account) GroupNegotiate(as, with *SigningPublicKey, expiresUnix int64) error

GroupNegotiate negotiates an encrypted session between two inbox addresses. The SDK auto-accepts the resulting invite/welcome on both sides. expiresUnix of 0 means no expiry.

func (*Account) GroupNegotiateOutOfBand

func (a *Account) GroupNegotiateOutOfBand(as *SigningPublicKey, expiresUnix int64) (*CryptoKeyPackage, error)

GroupNegotiateOutOfBand creates a key package for establishing an encrypted session with this account out of band (e.g. for inclusion in a discovery request). expiresUnix of 0 means no expiry.

func (*Account) GroupUpdate

func (a *Account) GroupUpdate(r *GroupUpdateRequest) error

GroupUpdate publishes a built group update.

func (*Account) IdentityExecute

func (a *Account) IdentityExecute(operation *IdentityOperation, timeout time.Duration) error

IdentityExecute publishes an identity operation via callback, returning once the result has been delivered.

func (*Account) IdentityLookup

func (a *Account) IdentityLookup(lookup *IdentityLookup) ([]*DIDAddress, error)

IdentityLookup returns DID addresses matching the lookup query.

func (*Account) IdentityResolve

func (a *Account) IdentityResolve(address *DIDAddress, timeout time.Duration) (*IdentityDocument, error)

IdentityResolve resolves the identity document for an address via callback, returning once the result has been delivered.

func (*Account) IdentitySign

func (a *Account) IdentitySign(operation *IdentityOperation) error

IdentitySign signs an identity operation with this account's keys.

func (*Account) InboxClose

func (a *Account) InboxClose(address *SigningPublicKey, timeout time.Duration) error

InboxClose closes an open inbox, awaiting completion via callback.

func (*Account) InboxDefault

func (a *Account) InboxDefault() (*SigningPublicKey, error)

InboxDefault returns the account's default inbox address synchronously.

func (*Account) InboxList

func (a *Account) InboxList() ([]*SigningPublicKey, error)

InboxList returns the addresses of all open inboxes on this account.

func (*Account) InboxOpen

func (a *Account) InboxOpen(timeout time.Duration) (*SigningPublicKey, error)

InboxOpen opens a new messaging inbox, awaiting its address via callback.

func (*Account) KeychainExchangeCreate

func (a *Account) KeychainExchangeCreate() (*ExchangePublicKey, error)

KeychainExchangeCreate generates a new exchange key in the keychain and returns its public address.

func (*Account) KeychainLookup

func (a *Account) KeychainLookup(lookup *KeychainLookup) ([]*SigningPublicKey, error)

KeychainLookup resolves the signing keys held in the keychain that satisfy the lookup query.

func (*Account) KeychainSign

func (a *Account) KeychainSign(address *SigningPublicKey, payload []byte) ([]byte, error)

KeychainSign signs payload with the keychain key identified by address.

func (*Account) KeychainSigningCreate

func (a *Account) KeychainSigningCreate() (*SigningPublicKey, error)

KeychainSigningCreate generates a new signing key in the keychain and returns its public address.

func (*Account) MessageSend

func (a *Account) MessageSend(to *SigningPublicKey, content *Content) error

MessageSend sends content to the given recipient address. This call returns once the message has been queued locally; delivery is reported via the on_status callback (acknowledged / send-failed).

func (*Account) NotificationSend

func (a *Account) NotificationSend(to *SigningPublicKey, summary *MessageContentSummary, timeout time.Duration) error

NotificationSend sends a push notification to the given address carrying the content summary, via callback.

func (*Account) ObjectDownload

func (a *Account) ObjectDownload(obj *Object, timeout time.Duration) error

ObjectDownload downloads an object's encrypted bytes and key from the server, via callback.

func (*Account) ObjectRetrieve

func (a *Account) ObjectRetrieve(objectID []byte) (*Object, error)

ObjectRetrieve loads a locally stored object by its id.

func (*Account) ObjectStore

func (a *Account) ObjectStore(obj *Object) error

ObjectStore stores an object in the account's local data store.

func (*Account) ObjectUpload

func (a *Account) ObjectUpload(obj *Object, options *ObjectUploadOptions, timeout time.Duration) error

ObjectUpload uploads an object to the object store via callback. Pass nil options for defaults.

func (*Account) PresentationLookup

func (a *Account) PresentationLookup(tree *PredicateTree) ([]*VerifiablePresentation, error)

PresentationLookup returns presentations stored on the account that satisfy the predicate tree. A nil tree returns every stored presentation.

func (*Account) PresentationSign

func (a *Account) PresentationSign(vp *VerifiablePresentation) error

PresentationSign signs a presentation with any available keys it requires.

func (*Account) PresentationStore

func (a *Account) PresentationStore(vp *VerifiablePresentation) error

PresentationStore stores a presentation on the account for later retrieval.

func (*Account) RevocationRevoke

func (a *Account) RevocationRevoke(statement *RevocationStatement, timeout time.Duration) error

RevocationRevoke publishes a signed revocation statement via callback.

func (*Account) RevocationSign

func (a *Account) RevocationSign(statement *RevocationStatement) error

RevocationSign signs an unsigned revocation statement with the account's keys.

func (*Account) SetupPairingCode

func (a *Account) SetupPairingCode() (string, error)

SetupPairingCode sets the account up for pairing with an application identity and returns the pairing code. It fails if the account has already been paired.

func (*Account) TokenIssue

func (a *Account) TokenIssue(req *TokenRequest) (*Token, error)

TokenIssue issues a fresh token from a validated request.

func (*Account) TokenStore

func (a *Account) TokenStore(tk *Token) error

TokenStore stores a token. The issuer, bearer and local owner are derived from the token itself.

func (*Account) ValueKeys

func (a *Account) ValueKeys(prefix string) ([]string, error)

ValueKeys lists stored value keys, optionally filtered by prefix. An empty prefix lists every key.

func (*Account) ValueLookup

func (a *Account) ValueLookup(key string) ([]byte, bool, error)

ValueLookup returns the value stored under key. The boolean is false when no value is stored for that key.

func (*Account) ValueRemove

func (a *Account) ValueRemove(key string) error

ValueRemove deletes the value stored under key.

func (*Account) ValueStore

func (a *Account) ValueStore(key string, value []byte, expiresUnix int64) error

ValueStore stores a key/value pair. A zero expiresUnix means the value never expires; otherwise it is removed at that absolute unix timestamp (seconds).

type AccountCallbacks

type AccountCallbacks interface {
	OnStatus(*StatusEvent)
	OnMessage(*Message)
	OnGroup(*GroupEvent)
	OnWorkflow(*WorkflowEvent)
}

AccountCallbacks is the Go-side dispatch interface for the native account callbacks. The public account package implements it with an adapter that re-wraps the ffi event types into public types.

type AccountConfig

type AccountConfig struct {
	Network         Network
	RPCEndpoint     string
	ObjectEndpoint  string
	MessageEndpoint string
	StoragePath     string
	EncryptionKey   []byte
	LogLevel        LogLevel
}

AccountConfig holds the configuration for an account.

type Action

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

Action is the generic polymorphic wrapper for the per-kind action types inside an exchange request.

func (*Action) AsDevicePairing

func (a *Action) AsDevicePairing() (*DevicePairingAction, error)

AsDevicePairing downcasts the action to a device-pairing action.

func (*Action) AsIdentitySigning

func (a *Action) AsIdentitySigning() (*IdentitySigningAction, error)

AsIdentitySigning downcasts the action to an identity-signing action.

func (*Action) AsPresentation

func (a *Action) AsPresentation() (*PresentationAction, error)

AsPresentation downcasts the action to a credential presentation action.

func (*Action) AsRevocationSigning

func (a *Action) AsRevocationSigning() (*RevocationSigningAction, error)

AsRevocationSigning downcasts the action to a revocation-signing action.

func (*Action) AsVerification

func (a *Action) AsVerification() (*VerificationAction, error)

AsVerification downcasts the action to a credential verification action.

func (*Action) ID

func (a *Action) ID() []byte

ID returns the action's id bytes.

func (*Action) Kind

func (a *Action) Kind() ActionKind

Kind returns the kind of action.

type ActionKind

type ActionKind uint32

ActionKind mirrors zktf_message_content_action_kind.

const (
	ActionKindUnknown                ActionKind = C.ACTION_KIND_UNKNOWN
	ActionKindCredentialPresentation ActionKind = C.ACTION_KIND_CREDENTIAL_PRESENTATION
	ActionKindCredentialVerification ActionKind = C.ACTION_KIND_CREDENTIAL_VERIFICATION
	ActionKindIdentitySigning        ActionKind = C.ACTION_KIND_IDENTITY_SIGNING
	ActionKindDevicePairing          ActionKind = C.ACTION_KIND_DEVICE_PAIRING
	ActionKindRevocationSigning      ActionKind = C.ACTION_KIND_REVOCATION_SIGNING
)

type AddressMethod

type AddressMethod uint32

AddressMethod mirrors zktf_address_method.

const (
	AddressMethodZktf AddressMethod = C.METHOD_ZKTF
	AddressMethodKey  AddressMethod = C.METHOD_KEY
)

type AnonymousMessage

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

AnonymousMessage wraps a zktf_anonymous_message handle. An anonymous message is an unencrypted, self-describing envelope (e.g. a pairing/QR code) that carries message content addressed to no particular inbox.

func AnonymousMessageDecodeFromString

func AnonymousMessageDecodeFromString(encoded string) (*AnonymousMessage, error)

AnonymousMessageDecodeFromString decodes a base64 URL encoded anonymous message (e.g. a pairing code).

func (*AnonymousMessage) Content

func (m *AnonymousMessage) Content() *Content

Content returns the message content.

func (*AnonymousMessage) ID

func (m *AnonymousMessage) ID() []byte

ID returns the id of the message.

type Chat

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

Chat wraps a zktf_message_content_chat handle.

func ChatFromContent

func ChatFromContent(content *Content) (*Chat, error)

ChatFromContent decodes message content as a chat message.

func (*Chat) Attachments

func (c *Chat) Attachments() []*Object

Attachments returns the objects attached to this chat message.

func (*Chat) Message

func (c *Chat) Message() string

Message returns the chat message text.

func (*Chat) Referencing

func (c *Chat) Referencing() []byte

Referencing returns the id of the message this chat references, or nil.

type ChatBuilder

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

ChatBuilder wraps a zktf_message_content_chat_builder handle.

func NewChatBuilder

func NewChatBuilder() *ChatBuilder

NewChatBuilder initializes a new chat message builder.

func (*ChatBuilder) Attach

func (b *ChatBuilder) Attach(attachment *Object) *ChatBuilder

Attach attaches an object to the chat message.

func (*ChatBuilder) Finish

func (b *ChatBuilder) Finish() (*Content, error)

Finish finalizes the chat content, ready to send.

func (*ChatBuilder) Message

func (b *ChatBuilder) Message(message string) *ChatBuilder

Message sets the chat message text.

func (*ChatBuilder) Reference

func (b *ChatBuilder) Reference(messageID []byte) *ChatBuilder

Reference sets the id of a message this chat references.

type CommitEvent

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

CommitEvent wraps a zktf_commit wire event.

func (*CommitEvent) FromAddress

func (e *CommitEvent) FromAddress() *SigningPublicKey

FromAddress returns the sender's address.

func (*CommitEvent) Sequence

func (e *CommitEvent) Sequence() uint64

Sequence returns the event's sequence number.

func (*CommitEvent) Timestamp

func (e *CommitEvent) Timestamp() int64

Timestamp returns the event's unix timestamp.

func (*CommitEvent) ToAddress

func (e *CommitEvent) ToAddress() *SigningPublicKey

ToAddress returns the recipient address.

type Content

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

Content wraps a zktf_message_content handle — the decoded payload of a message or the output of a content builder, ready to send.

func (*Content) ID

func (c *Content) ID() []byte

ID returns the content's id.

func (*Content) TypeOf

func (c *Content) TypeOf() ContentType

TypeOf returns the type of content.

type ContentType

type ContentType uint32

ContentType mirrors zktf_message_content_type.

const (
	ContentUnknown           ContentType = C.CONTENT_UNKNOWN
	ContentCustom            ContentType = C.CONTENT_CUSTOM
	ContentChat              ContentType = C.CONTENT_CHAT
	ContentReceipt           ContentType = C.CONTENT_RECEIPT
	ContentCredential        ContentType = C.CONTENT_CREDENTIAL
	ContentIntroduction      ContentType = C.CONTENT_INTRODUCTION
	ContentDiscoveryRequest  ContentType = C.CONTENT_DISCOVERY_REQUEST
	ContentDiscoveryResponse ContentType = C.CONTENT_DISCOVERY_RESPONSE
	ContentExchangeRequest   ContentType = C.CONTENT_EXCHANGE_REQUEST
	ContentExchangeResponse  ContentType = C.CONTENT_EXCHANGE_RESPONSE
)

type CredentialBuilder

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

CredentialBuilder wraps a zktf_credential_builder handle.

func NewCredentialBuilder

func NewCredentialBuilder() *CredentialBuilder

NewCredentialBuilder initializes a new credential builder.

func (*CredentialBuilder) CredentialSubject

func (b *CredentialBuilder) CredentialSubject(subject *DIDAddress) *CredentialBuilder

CredentialSubject sets the credential's subject DID address.

func (*CredentialBuilder) CredentialSubjectClaim

func (b *CredentialBuilder) CredentialSubjectClaim(key, value string) *CredentialBuilder

CredentialSubjectClaim adds a string claim about the subject.

func (*CredentialBuilder) CredentialSubjectJSON

func (b *CredentialBuilder) CredentialSubjectJSON(json []byte) *CredentialBuilder

CredentialSubjectJSON sets the subject claims from a raw JSON document.

func (*CredentialBuilder) CredentialType

func (b *CredentialBuilder) CredentialType(types *TypeCollection) *CredentialBuilder

CredentialType sets the credential's types.

func (*CredentialBuilder) Finish

Finish finalizes the credential, ready to be signed via Account.CredentialIssue. This also carries any signers queued via SignWith as pending signers, so the first signature is applied the same way as any other.

func (*CredentialBuilder) Issuer

func (b *CredentialBuilder) Issuer(issuer *DIDAddress) *CredentialBuilder

Issuer sets the credential's issuer DID address.

func (*CredentialBuilder) SignWith

func (b *CredentialBuilder) SignWith(signer *SigningPublicKey, issuedAtUnix int64) *CredentialBuilder

SignWith records the signing key and issuance time for the credential.

func (*CredentialBuilder) ValidFrom

func (b *CredentialBuilder) ValidFrom(unix int64) *CredentialBuilder

ValidFrom sets the unix timestamp (seconds) the credential is valid from.

func (*CredentialBuilder) ValidUntil

func (b *CredentialBuilder) ValidUntil(unix int64) *CredentialBuilder

ValidUntil sets the unix timestamp (seconds) the credential is valid until.

type CredentialContent

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

CredentialContent wraps a zktf_message_content_credential handle.

func CredentialContentFromContent

func CredentialContentFromContent(content *Content) (*CredentialContent, error)

CredentialContentFromContent decodes message content as a credential payload.

func (*CredentialContent) Assets

func (c *CredentialContent) Assets() []*Object

Assets returns supporting object assets carried in the content.

func (*CredentialContent) VerifiableCredentials

func (c *CredentialContent) VerifiableCredentials() []*VerifiableCredential

VerifiableCredentials returns the credentials carried in the content.

func (*CredentialContent) VerifiablePresentations

func (c *CredentialContent) VerifiablePresentations() []*VerifiablePresentation

VerifiablePresentations returns the presentations carried in the content.

type CredentialContentBuilder

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

CredentialContentBuilder wraps a zktf_message_content_credential_builder.

func NewCredentialContentBuilder

func NewCredentialContentBuilder() *CredentialContentBuilder

NewCredentialContentBuilder initializes a new credential-content builder.

func (*CredentialContentBuilder) Asset

Asset attaches a supporting object asset.

func (*CredentialContentBuilder) Finish

func (b *CredentialContentBuilder) Finish() (*Content, error)

Finish finalizes the credential content, ready to send.

func (*CredentialContentBuilder) VerifiableCredential

VerifiableCredential adds a credential to the credential content.

func (*CredentialContentBuilder) VerifiablePresentation

VerifiablePresentation adds a presentation to the credential content.

type CredentialExchange

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

CredentialExchange records a single credential exchanged with an address.

func (*CredentialExchange) ContentHash

func (e *CredentialExchange) ContentHash() []byte

ContentHash returns the hash of the exchanged credential content.

func (*CredentialExchange) SharedAt

func (e *CredentialExchange) SharedAt() int64

SharedAt returns the unix timestamp (seconds) the credential was shared.

func (*CredentialExchange) WithAddress

func (e *CredentialExchange) WithAddress() *SigningPublicKey

WithAddress returns the address the credential was exchanged with.

type CredentialGraph

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

CredentialGraph wraps a zktf_credential_graph handle — the verified state of a holder's credentials, derived from a set of presentations against a registry.

func AwaitCredentialGraph

func AwaitCredentialGraph(fut *C.zktf_future_credential_graph, timeout time.Duration) (*CredentialGraph, error)

AwaitCredentialGraph drives a zktf_future_credential_graph to completion.

func (*CredentialGraph) BiometricAnchorHashFor

func (g *CredentialGraph) BiometricAnchorHashFor(holder *DIDAddress) []byte

BiometricAnchorHashFor returns the holder's 20-byte biometric anchor hash, or nil.

func (*CredentialGraph) RevocationProofFor

func (g *CredentialGraph) RevocationProofFor(revocationHash []byte) *RevocationProof

RevocationProofFor returns the revocation proof for the given hash, or nil if no revocation has been recorded.

func (*CredentialGraph) RevokedCredentialsFor

func (g *CredentialGraph) RevokedCredentialsFor(holder *DIDAddress) ([]*VerifiableCredential, error)

RevokedCredentialsFor returns the holder's revoked credentials.

func (*CredentialGraph) ValidAuthenticationFor

func (g *CredentialGraph) ValidAuthenticationFor(identity *PairwiseIdentity, challenge []byte) bool

ValidAuthenticationFor reports whether the given pairwise identity has signed the supplied challenge with currently-valid keys.

func (*CredentialGraph) ValidCredentialsFor

func (g *CredentialGraph) ValidCredentialsFor(holder *DIDAddress) ([]*VerifiableCredential, error)

ValidCredentialsFor returns the holder's currently-valid credentials.

func (*CredentialGraph) ValidDocumentFor

func (g *CredentialGraph) ValidDocumentFor(document *DIDAddress) bool

ValidDocumentFor reports whether the document at the address is currently valid (no recovery / deactivation effective).

type CredentialTerm

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

CredentialTerm describes the duration under which the requester wishes to access shared credentials.

func NewCredentialTerm

func NewCredentialTerm(durationSeconds uint64) *CredentialTerm

NewCredentialTerm creates a credential term with the given duration in seconds.

func (*CredentialTerm) Duration

func (t *CredentialTerm) Duration() uint64

Duration returns the term's duration in seconds.

type CryptoKeyPackage

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

CryptoKeyPackage wraps a zktf_crypto_key_package handle (an MLS key package used to establish an encrypted session out of band, e.g. via discovery).

func (*CryptoKeyPackage) FromAddress

func (k *CryptoKeyPackage) FromAddress() *SigningPublicKey

FromAddress returns the signing address the key package is for.

type CryptoWelcome

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

CryptoWelcome wraps a zktf_crypto_welcome handle (an MLS welcome message).

type Custom

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

Custom wraps a zktf_message_content_custom handle.

func CustomFromContent

func CustomFromContent(content *Content) (*Custom, error)

CustomFromContent decodes message content as a custom payload.

func (*Custom) Payload

func (c *Custom) Payload() []byte

Payload returns the custom payload bytes.

type CustomBuilder

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

CustomBuilder wraps a zktf_message_content_custom_builder handle.

func NewCustomBuilder

func NewCustomBuilder() *CustomBuilder

NewCustomBuilder initializes a new custom content builder.

func (*CustomBuilder) Finish

func (b *CustomBuilder) Finish() (*Content, error)

Finish finalizes the custom content, ready to send.

func (*CustomBuilder) Payload

func (b *CustomBuilder) Payload(payload []byte) *CustomBuilder

Payload sets the custom payload bytes.

type DIDAddress

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

DIDAddress wraps a zktf_did_address handle.

func DIDAddressDecode

func DIDAddressDecode(did string) (*DIDAddress, error)

DIDAddressDecode decodes a DID string into an address.

func DIDAddressKey

func DIDAddressKey(key *SigningPublicKey) *DIDAddress

DIDAddressKey builds a key-method DID address from a signing key.

func (*DIDAddress) Address

func (a *DIDAddress) Address() *SigningPublicKey

Address returns the signing public key embedded in the DID address.

func (*DIDAddress) String

func (a *DIDAddress) String() string

String returns the encoded DID string.

type DevicePairingAction

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

DevicePairingAction is a request to pair another device (signing key) into an identity document with a given role bitmask.

func (*DevicePairingAction) Address

func (a *DevicePairingAction) Address() *SigningPublicKey

Address returns the signing address to pair.

func (*DevicePairingAction) AsAction

func (a *DevicePairingAction) AsAction() *Action

AsAction wraps this device-pairing action into a generic Action.

func (*DevicePairingAction) Roles

func (a *DevicePairingAction) Roles() uint64

Roles returns the requested role bitmask for the paired key.

type DevicePairingActionBuilder

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

DevicePairingActionBuilder builds a device-pairing action.

func NewDevicePairingActionBuilder

func NewDevicePairingActionBuilder() *DevicePairingActionBuilder

NewDevicePairingActionBuilder initializes the builder.

func (*DevicePairingActionBuilder) Address

Address sets the signing address to pair.

func (*DevicePairingActionBuilder) Finish

Finish finalizes the action.

func (*DevicePairingActionBuilder) Roles

Roles sets the requested role bitmask.

type DevicePairingResult

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

DevicePairingResult is the response to a device-pairing request.

func (*DevicePairingResult) Assets

func (r *DevicePairingResult) Assets() []*Object

Assets returns the assets attached to the result.

func (*DevicePairingResult) DocumentAddress

func (r *DevicePairingResult) DocumentAddress() *SigningPublicKey

DocumentAddress returns the document address the result is for.

func (*DevicePairingResult) Operation

func (r *DevicePairingResult) Operation() *IdentityOperation

Operation returns the signed operation that paired the device.

func (*DevicePairingResult) Presentations

func (r *DevicePairingResult) Presentations() []*VerifiablePresentation

Presentations returns the presentations attached to the result.

func (*DevicePairingResult) Tokens

func (r *DevicePairingResult) Tokens() ([]*Token, error)

Tokens returns the tokens issued to the paired device.

type DevicePairingResultBuilder

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

DevicePairingResultBuilder builds a device-pairing result.

func NewDevicePairingResultBuilder

func NewDevicePairingResultBuilder() *DevicePairingResultBuilder

NewDevicePairingResultBuilder initializes the builder.

func (*DevicePairingResultBuilder) Asset

Asset attaches a supporting object asset.

func (*DevicePairingResultBuilder) DocumentAddress

DocumentAddress sets the document address the result is for.

func (*DevicePairingResultBuilder) Finish

Finish finalizes the result.

func (*DevicePairingResultBuilder) Operation

Operation sets the signed operation.

func (*DevicePairingResultBuilder) Presentation

Presentation adds a presentation to the result.

func (*DevicePairingResultBuilder) Token

Token attaches a token for the paired device, such as the identity token it authenticates its grant publish with.

type DiscoveryRequest

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

DiscoveryRequest wraps a zktf_message_content_discovery_request handle (a QR onboarding / out-of-band discovery request).

func DiscoveryRequestFromContent

func DiscoveryRequestFromContent(content *Content) (*DiscoveryRequest, error)

DiscoveryRequestFromContent decodes message content as a discovery request.

func (*DiscoveryRequest) DocumentAddress

func (r *DiscoveryRequest) DocumentAddress() *SigningPublicKey

DocumentAddress returns the discovery requester's document address, or nil.

func (*DiscoveryRequest) Expires

func (r *DiscoveryRequest) Expires() int64

Expires returns the unix timestamp (seconds) the request expires.

func (*DiscoveryRequest) FromAddress

func (r *DiscoveryRequest) FromAddress() *SigningPublicKey

FromAddress returns the inbox address the discovery request was issued by, or nil.

func (*DiscoveryRequest) KeyPackage

func (r *DiscoveryRequest) KeyPackage() *CryptoKeyPackage

KeyPackage returns the key package used to establish an inbound session, or nil.

type DiscoveryRequestBuilder

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

DiscoveryRequestBuilder builds a discovery request.

func NewDiscoveryRequestBuilder

func NewDiscoveryRequestBuilder() *DiscoveryRequestBuilder

NewDiscoveryRequestBuilder initializes a discovery request builder.

func (*DiscoveryRequestBuilder) DocumentAddress

DocumentAddress sets an optional document address.

func (*DiscoveryRequestBuilder) Expires

Expires sets the unix timestamp (seconds) the request expires.

func (*DiscoveryRequestBuilder) Finish

func (b *DiscoveryRequestBuilder) Finish() (*Content, error)

Finish finalizes the discovery request, ready to send.

func (*DiscoveryRequestBuilder) FromAddress

FromAddress sets the inbox address the discovery request is issued by.

func (*DiscoveryRequestBuilder) KeyPackage

KeyPackage attaches a key package the receiver can use to establish a session.

type DiscoveryResponse

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

DiscoveryResponse wraps a zktf_message_content_discovery_response handle.

func DiscoveryResponseFromContent

func DiscoveryResponseFromContent(content *Content) (*DiscoveryResponse, error)

DiscoveryResponseFromContent decodes message content as a discovery response.

func (*DiscoveryResponse) ErrorMessage

func (r *DiscoveryResponse) ErrorMessage() string

ErrorMessage returns the response error message, or "".

func (*DiscoveryResponse) ResponseTo

func (r *DiscoveryResponse) ResponseTo() []byte

ResponseTo returns the id of the request being responded to.

func (*DiscoveryResponse) Status

func (r *DiscoveryResponse) Status() ResponseStatus

Status returns the response status.

func (*DiscoveryResponse) Tokens

func (r *DiscoveryResponse) Tokens() ([]*Token, error)

Tokens returns the tokens issued to the recipient.

type DiscoveryResponseBuilder

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

DiscoveryResponseBuilder builds a discovery response.

func NewDiscoveryResponseBuilder

func NewDiscoveryResponseBuilder() *DiscoveryResponseBuilder

NewDiscoveryResponseBuilder initializes a discovery response builder.

func (*DiscoveryResponseBuilder) ErrorMessage

ErrorMessage sets the response error message.

func (*DiscoveryResponseBuilder) Finish

func (b *DiscoveryResponseBuilder) Finish() (*Content, error)

Finish finalizes the discovery response, ready to send.

func (*DiscoveryResponseBuilder) ResponseTo

func (b *DiscoveryResponseBuilder) ResponseTo(requestID []byte) *DiscoveryResponseBuilder

ResponseTo sets the id of the request being responded to.

func (*DiscoveryResponseBuilder) Status

Status sets the response status.

func (*DiscoveryResponseBuilder) Token

Token attaches a token for the recipient.

type DroppedEvent

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

DroppedEvent wraps a zktf_dropped_event handle carried by a STATUS_EVENT_DROPPED.

func (*DroppedEvent) FromAddress

func (e *DroppedEvent) FromAddress() *SigningPublicKey

FromAddress returns the sender's address.

func (*DroppedEvent) FromSequence

func (e *DroppedEvent) FromSequence() uint64

FromSequence returns the starting sequence number of the dropped range.

func (*DroppedEvent) Reason

func (e *DroppedEvent) Reason() error

Reason returns the reason the messages were dropped.

func (*DroppedEvent) ToAddress

func (e *DroppedEvent) ToAddress() *SigningPublicKey

ToAddress returns the recipient address.

func (*DroppedEvent) ToSequence

func (e *DroppedEvent) ToSequence() uint64

ToSequence returns the ending sequence number of the dropped range.

type ExchangePublicKey

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

ExchangePublicKey wraps a zktf_exchange_public_key handle.

func ExchangePublicKeyFromAddress

func ExchangePublicKeyFromAddress(hex string) (*ExchangePublicKey, error)

ExchangePublicKeyFromAddress decodes a hex address into an exchange key.

func ExchangePublicKeyFromBytes

func ExchangePublicKeyFromBytes(data []byte) (*ExchangePublicKey, error)

ExchangePublicKeyFromBytes constructs an exchange key from raw bytes.

func (*ExchangePublicKey) Bytes

func (k *ExchangePublicKey) Bytes() []byte

Bytes returns the raw bytes of the key.

func (*ExchangePublicKey) String

func (k *ExchangePublicKey) String() string

String returns the hex encoded address.

type ExchangeRequest

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

ExchangeRequest wraps a zktf_message_content_exchange_request handle.

func ExchangeRequestFromContent

func ExchangeRequestFromContent(content *Content) (*ExchangeRequest, error)

ExchangeRequestFromContent decodes message content as an exchange request.

func (*ExchangeRequest) Actions

func (r *ExchangeRequest) Actions() ([]*Action, error)

Actions returns the actions contained in the request.

func (*ExchangeRequest) Expires

func (r *ExchangeRequest) Expires() int64

Expires returns the unix timestamp (seconds) the request expires.

func (*ExchangeRequest) Flags

func (r *ExchangeRequest) Flags() uint64

Flags returns the request flags bitfield.

func (*ExchangeRequest) ID

func (r *ExchangeRequest) ID() []byte

ID returns the request id.

func (*ExchangeRequest) Purpose

func (r *ExchangeRequest) Purpose() string

Purpose returns the request purpose string.

type ExchangeRequestBuilder

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

ExchangeRequestBuilder builds an exchange request.

func NewExchangeRequestBuilder

func NewExchangeRequestBuilder() *ExchangeRequestBuilder

NewExchangeRequestBuilder initializes an exchange request builder.

func (*ExchangeRequestBuilder) Action

Action appends an action to the request.

func (*ExchangeRequestBuilder) Expires

Expires sets the request expiry as a unix timestamp (seconds).

func (*ExchangeRequestBuilder) Finish

func (b *ExchangeRequestBuilder) Finish() (*Content, error)

Finish finalizes the exchange request, ready to send.

func (*ExchangeRequestBuilder) Flags

Flags sets the request flags bitfield.

func (*ExchangeRequestBuilder) ID

ID sets the request id.

func (*ExchangeRequestBuilder) Purpose

Purpose sets the request purpose string.

type ExchangeResponse

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

ExchangeResponse wraps a zktf_message_content_exchange_response handle.

func ExchangeResponseFromContent

func ExchangeResponseFromContent(content *Content) (*ExchangeResponse, error)

ExchangeResponseFromContent decodes message content as an exchange response.

func (*ExchangeResponse) ErrorMessage

func (r *ExchangeResponse) ErrorMessage() string

ErrorMessage returns the response error message, or "".

func (*ExchangeResponse) ID

func (r *ExchangeResponse) ID() []byte

ID returns the response id.

func (*ExchangeResponse) Outcomes

func (r *ExchangeResponse) Outcomes() ([]*Outcome, error)

Outcomes returns the per-action outcomes contained in the response.

func (*ExchangeResponse) ResponseTo

func (r *ExchangeResponse) ResponseTo() []byte

ResponseTo returns the id of the request being responded to.

func (*ExchangeResponse) Status

func (r *ExchangeResponse) Status() ResponseStatus

Status returns the overall response status.

type ExchangeResponseBuilder

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

ExchangeResponseBuilder builds an exchange response.

func NewExchangeResponseBuilder

func NewExchangeResponseBuilder() *ExchangeResponseBuilder

NewExchangeResponseBuilder initializes an exchange response builder.

func (*ExchangeResponseBuilder) ErrorMessage

ErrorMessage sets the response error message.

func (*ExchangeResponseBuilder) Finish

func (b *ExchangeResponseBuilder) Finish() (*Content, error)

Finish finalizes the exchange response, ready to send.

func (*ExchangeResponseBuilder) ID

ID sets the response id.

func (*ExchangeResponseBuilder) Outcome

Outcome appends an outcome to the response.

func (*ExchangeResponseBuilder) ResponseTo

func (b *ExchangeResponseBuilder) ResponseTo(requestID []byte) *ExchangeResponseBuilder

ResponseTo sets the id of the request being responded to.

func (*ExchangeResponseBuilder) Status

Status sets the overall response status.

type Group

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

Group wraps a zktf_group handle (a member of an established encrypted group session). The slice exposes Address() and Members(); deeper accessors can be added without changing the wrapping pattern.

func AwaitGroup

func AwaitGroup(fut *C.zktf_future_group, timeout time.Duration) (*Group, error)

AwaitGroup drives a zktf_future_group to completion.

func (*Group) Address

func (g *Group) Address() *SigningPublicKey

Address returns the group address.

func (*Group) MemberAs

func (g *Group) MemberAs() *SigningPublicKey

MemberAs returns the address this account presents within the group.

func (*Group) Members

func (g *Group) Members() []*SigningPublicKey

Members returns the addresses of the group members.

type GroupEvent

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

GroupEvent wraps a zktf_group_event delivered to on_group. Use Kind to dispatch and the per-kind accessors to extract the carried wire event.

func (*GroupEvent) Commit

func (e *GroupEvent) Commit() *CommitEvent

Commit extracts the commit wire event (kind == GroupEventCommit).

func (*GroupEvent) Invite

func (e *GroupEvent) Invite() *KeyPackageEvent

Invite extracts the key package wire event (kind == GroupEventInvite).

func (*GroupEvent) Kind

func (e *GroupEvent) Kind() GroupEventKind

Kind returns the kind of group event.

func (*GroupEvent) Proposal

func (e *GroupEvent) Proposal() *ProposalEvent

Proposal extracts the proposal wire event (kind == GroupEventProposal).

func (*GroupEvent) Welcome

func (e *GroupEvent) Welcome() *WelcomeEvent

Welcome extracts the welcome wire event (kind == GroupEventWelcome).

type GroupEventKind

type GroupEventKind uint32

GroupEventKind mirrors zktf_group_event_type.

const (
	GroupEventInvite   GroupEventKind = C.GROUP_EVENT_INVITE
	GroupEventWelcome  GroupEventKind = C.GROUP_EVENT_WELCOME
	GroupEventCommit   GroupEventKind = C.GROUP_EVENT_COMMIT
	GroupEventProposal GroupEventKind = C.GROUP_EVENT_PROPOSAL
)

type GroupLookup

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

GroupLookup builds a query for groups on an account.

func NewGroupLookup

func NewGroupLookup() *GroupLookup

NewGroupLookup initializes a group lookup query.

func (*GroupLookup) ByAddress

func (l *GroupLookup) ByAddress(address *SigningPublicKey) *GroupLookup

ByAddress restricts the lookup to a group at the given address.

func (*GroupLookup) ByMember

func (l *GroupLookup) ByMember(member *SigningPublicKey) *GroupLookup

ByMember restricts the lookup to groups including the given member.

type GroupUpdateBuilder

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

GroupUpdateBuilder builds a group update (add/remove members).

func NewGroupUpdateBuilder

func NewGroupUpdateBuilder(g *Group) *GroupUpdateBuilder

NewGroupUpdateBuilder initializes an update builder for the given group.

func (*GroupUpdateBuilder) AddMembers

func (b *GroupUpdateBuilder) AddMembers(packages []*CryptoKeyPackage) *GroupUpdateBuilder

AddMembers stages every member in `packages` to be added.

func (*GroupUpdateBuilder) AsProposal

func (b *GroupUpdateBuilder) AsProposal() *GroupUpdateBuilder

AsProposal marks the update to be sent as a proposal (not auto-committed).

func (*GroupUpdateBuilder) Finish

Finish validates the staged changes and produces a request.

func (*GroupUpdateBuilder) RemoveMembers

func (b *GroupUpdateBuilder) RemoveMembers(members []*SigningPublicKey) *GroupUpdateBuilder

RemoveMembers stages every member in `members` to be removed.

type GroupUpdateRequest

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

GroupUpdateRequest is a signed group update ready to publish via Account.GroupUpdate.

type IdentityDocument

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

IdentityDocument wraps a zktf_identity_document handle (the resolved key state of an identity).

func AwaitIdentityDocument

func AwaitIdentityDocument(fut *C.zktf_future_identity_document, timeout time.Duration) (*IdentityDocument, error)

AwaitIdentityDocument drives a zktf_future_identity_document to completion.

func (*IdentityDocument) Commitment

func (d *IdentityDocument) Commitment() []byte

Commitment returns the document's commitment hash, or nil if none is set.

func (*IdentityDocument) Create

Create returns an operation builder seeded from the current document state.

func (*IdentityDocument) Descriptions

Descriptions returns the key descriptions in the document. Pass nil for lookup to list every description in the latest snapshot.

func (*IdentityDocument) ExchangeKeyHasRoles

func (d *IdentityDocument) ExchangeKeyHasRoles(key *ExchangePublicKey, roles IdentityKeyRole, lookup *IdentityKeyLookup) bool

ExchangeKeyHasRoles reports whether the exchange key holds every role in roles. Pass nil for lookup to evaluate against the latest snapshot.

func (*IdentityDocument) ExchangeKeyValid

func (d *IdentityDocument) ExchangeKeyValid(key *ExchangePublicKey, lookup *IdentityKeyLookup) bool

ExchangeKeyValid reports whether the exchange key is valid in the document. Pass nil for lookup to evaluate against the latest snapshot.

func (*IdentityDocument) ExchangeKeys

func (d *IdentityDocument) ExchangeKeys(lookup *IdentityKeyLookup) []*ExchangePublicKey

ExchangeKeys returns the exchange keys in the document. Pass nil for lookup to list every exchange key in the latest snapshot.

func (*IdentityDocument) SigningKeyHasRoles

func (d *IdentityDocument) SigningKeyHasRoles(key *SigningPublicKey, roles IdentityKeyRole, lookup *IdentityKeyLookup) bool

SigningKeyHasRoles reports whether the signing key holds every role in roles. Pass nil for lookup to evaluate against the latest snapshot.

func (*IdentityDocument) SigningKeyValid

func (d *IdentityDocument) SigningKeyValid(key *SigningPublicKey, lookup *IdentityKeyLookup) bool

SigningKeyValid reports whether the signing key is valid in the document. Pass nil for lookup to evaluate against the latest snapshot.

func (*IdentityDocument) SigningKeys

func (d *IdentityDocument) SigningKeys(lookup *IdentityKeyLookup) []*SigningPublicKey

SigningKeys returns the signing keys in the document. Pass nil for lookup to list every signing key in the latest snapshot.

func (*IdentityDocument) ThresholdMet

func (d *IdentityDocument) ThresholdMet(role IdentityKeyRole, signers []*SigningPublicKey, lookup *IdentityKeyLookup) bool

ThresholdMet reports whether signers collectively satisfy role's threshold. Pass nil for lookup to evaluate against the latest snapshot.

type IdentityKeyLookup

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

IdentityKeyLookup filters a document key query by snapshot time and/or roles. With no options applied, queries run against the latest snapshot with no role filter.

func NewIdentityKeyLookup

func NewIdentityKeyLookup() *IdentityKeyLookup

NewIdentityKeyLookup initializes a key lookup.

func (*IdentityKeyLookup) AtTime

func (l *IdentityKeyLookup) AtTime(unix int64)

AtTime evaluates the query against the document as it existed at the given unix timestamp (seconds).

func (*IdentityKeyLookup) WithRoles

func (l *IdentityKeyLookup) WithRoles(roles IdentityKeyRole)

WithRoles restricts the result to keys holding every role in roles.

type IdentityKeyRole

type IdentityKeyRole uint64

IdentityKeyRole is a bitmask of roles a key may hold in an identity document.

const (
	KeyRoleVerification   IdentityKeyRole = C.KEY_ROLE_VERIFICATION
	KeyRoleAssertion      IdentityKeyRole = C.KEY_ROLE_ASSERTION
	KeyRoleAuthentication IdentityKeyRole = C.KEY_ROLE_AUTHENTICATION
	KeyRoleDelegation     IdentityKeyRole = C.KEY_ROLE_DELEGATION
	KeyRoleInvocation     IdentityKeyRole = C.KEY_ROLE_INVOCATION
	KeyRoleKeyAgreement   IdentityKeyRole = C.KEY_ROLE_KEYAGREEMENT
	KeyRoleMessaging      IdentityKeyRole = C.KEY_ROLE_MESSAGING
)

type IdentityLookup

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

IdentityLookup builds a query for identities.

func NewIdentityLookup

func NewIdentityLookup() *IdentityLookup

NewIdentityLookup initializes an identity lookup query.

func (*IdentityLookup) ByKey

ByKey restricts the lookup to identities the given key is associated with.

type IdentityOperation

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

IdentityOperation wraps a zktf_identity_operation handle (a hashgraph operation describing a change to an identity document — e.g. adding/removing keys, recovery). The slice exposes it as an opaque type; Wave 12 adds the operation builder and accessors.

func IdentityOperationDecode

func IdentityOperationDecode(documentAddress *SigningPublicKey, data []byte) (*IdentityOperation, error)

IdentityOperationDecode decodes an encoded identity operation for the given document address.

func (*IdentityOperation) Actions

func (o *IdentityOperation) Actions() []*OperationAction

Actions returns the actions described by the operation.

func (*IdentityOperation) Encode

func (o *IdentityOperation) Encode() ([]byte, error)

Encode returns the encoded bytes of the operation.

func (*IdentityOperation) Hash

func (o *IdentityOperation) Hash() []byte

Hash returns the 32-byte operation hash.

func (*IdentityOperation) Merge

func (o *IdentityOperation) Merge(other *IdentityOperation) error

Merge merges signatures from another operation into this one.

func (*IdentityOperation) Sequence

func (o *IdentityOperation) Sequence() uint32

Sequence returns the operation sequence number.

func (*IdentityOperation) SignedBy

func (o *IdentityOperation) SignedBy(signer *SigningPublicKey) bool

SignedBy reports whether the operation has been signed by the given key.

type IdentityOperationBuilder

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

IdentityOperationBuilder builds an identity-document operation (key grants, modifications, revocations, recovery, deactivation).

func NewIdentityOperationBuilder

func NewIdentityOperationBuilder() *IdentityOperationBuilder

NewIdentityOperationBuilder initializes an operation builder.

func (*IdentityOperationBuilder) Anchor

func (b *IdentityOperationBuilder) Anchor(anchor, nonce []byte) *IdentityOperationBuilder

Anchor attaches a biometric anchor and nonce.

func (*IdentityOperationBuilder) Commitment

func (b *IdentityOperationBuilder) Commitment(commitment []byte) *IdentityOperationBuilder

Commitment sets a commitment value attached to the operation.

func (*IdentityOperationBuilder) Deactivate

func (b *IdentityOperationBuilder) Deactivate(effectiveFromUnix int64) *IdentityOperationBuilder

Deactivate stages a deactivation effective from the given timestamp.

func (*IdentityOperationBuilder) ExchangeGrantEmbedded

ExchangeGrantEmbedded grants an exchange key the given roles, embedded.

func (*IdentityOperationBuilder) ExchangeModify

ExchangeModify modifies the roles of an existing exchange key.

func (*IdentityOperationBuilder) ExchangeRevoke

func (b *IdentityOperationBuilder) ExchangeRevoke(key *ExchangePublicKey, effectiveFromUnix int64) *IdentityOperationBuilder

ExchangeRevoke revokes an exchange key, effective from the given timestamp.

func (*IdentityOperationBuilder) Finish

Finish finalizes the operation.

func (*IdentityOperationBuilder) ID

ID sets the document address the operation targets.

func (*IdentityOperationBuilder) Previous

Previous sets the hash of the previous operation in the sequence.

func (*IdentityOperationBuilder) Recover

func (b *IdentityOperationBuilder) Recover(effectiveFromUnix int64) *IdentityOperationBuilder

Recover stages a recovery operation effective from the given timestamp.

func (*IdentityOperationBuilder) Sequence

Sequence sets the operation sequence number.

func (*IdentityOperationBuilder) SignWith

SignWith records the signing key for the operation.

func (*IdentityOperationBuilder) SigningGrantEmbedded

SigningGrantEmbedded grants a signing key the given roles, with the key embedded.

func (*IdentityOperationBuilder) SigningGrantReferenced

func (b *IdentityOperationBuilder) SigningGrantReferenced(method uint16, controller, key *SigningPublicKey, commitment []byte, roles IdentityKeyRole) *IdentityOperationBuilder

SigningGrantReferenced grants a signing key the given roles via a referenced description.

func (*IdentityOperationBuilder) SigningModify

SigningModify modifies the roles of an existing signing key.

func (*IdentityOperationBuilder) SigningRevoke

func (b *IdentityOperationBuilder) SigningRevoke(key *SigningPublicKey, effectiveFromUnix int64) *IdentityOperationBuilder

SigningRevoke revokes a signing key, effective from the given timestamp.

func (*IdentityOperationBuilder) Threshold

Threshold sets the threshold required to satisfy a given role.

func (*IdentityOperationBuilder) Timestamp

Timestamp sets the operation timestamp.

func (*IdentityOperationBuilder) Weight

Weight assigns a weight to a signing key for a given role.

type IdentityOperationDescription

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

IdentityOperationDescription is a key description recorded in a document (embedded or referenced).

func (*IdentityOperationDescription) Embedded

Embedded returns the embedded description, or nil if not embedded.

func (*IdentityOperationDescription) Kind

Kind returns whether the description is embedded or referenced.

func (*IdentityOperationDescription) Reference

Reference returns the reference description, or nil if not a reference.

type IdentitySigningAction

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

IdentitySigningAction is a request to sign an identity-document operation.

func (*IdentitySigningAction) AsAction

func (a *IdentitySigningAction) AsAction() *Action

AsAction wraps this identity-signing action into a generic Action.

func (*IdentitySigningAction) DocumentAddress

func (a *IdentitySigningAction) DocumentAddress() *SigningPublicKey

DocumentAddress returns the document address the operation targets.

func (*IdentitySigningAction) Operation

func (a *IdentitySigningAction) Operation() *IdentityOperation

Operation returns the hashgraph operation to sign.

type IdentitySigningActionBuilder

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

IdentitySigningActionBuilder builds an identity-signing action.

func NewIdentitySigningActionBuilder

func NewIdentitySigningActionBuilder() *IdentitySigningActionBuilder

NewIdentitySigningActionBuilder initializes the builder.

func (*IdentitySigningActionBuilder) DocumentAddress

DocumentAddress sets the document address the operation targets.

func (*IdentitySigningActionBuilder) Finish

Finish finalizes the action.

func (*IdentitySigningActionBuilder) Operation

Operation sets the operation to sign.

type IdentitySigningResult

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

IdentitySigningResult is the response to an identity-signing request.

func (*IdentitySigningResult) Assets

func (r *IdentitySigningResult) Assets() []*Object

Assets returns the assets attached to the result.

func (*IdentitySigningResult) DocumentAddress

func (r *IdentitySigningResult) DocumentAddress() *SigningPublicKey

DocumentAddress returns the document address the result is for.

func (*IdentitySigningResult) Operation

func (r *IdentitySigningResult) Operation() *IdentityOperation

Operation returns the signed operation.

func (*IdentitySigningResult) Presentations

func (r *IdentitySigningResult) Presentations() []*VerifiablePresentation

Presentations returns the presentations attached to the result.

type IdentitySigningResultBuilder

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

IdentitySigningResultBuilder builds an identity-signing result.

func NewIdentitySigningResultBuilder

func NewIdentitySigningResultBuilder() *IdentitySigningResultBuilder

NewIdentitySigningResultBuilder initializes the builder.

func (*IdentitySigningResultBuilder) Asset

Asset attaches a supporting object asset.

func (*IdentitySigningResultBuilder) DocumentAddress

DocumentAddress sets the document address the result is for.

func (*IdentitySigningResultBuilder) Finish

Finish finalizes the result.

func (*IdentitySigningResultBuilder) Operation

Operation sets the signed operation.

func (*IdentitySigningResultBuilder) Presentation

Presentation adds a presentation to the result.

type Introduction

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

Introduction wraps a zktf_message_content_introduction handle.

func IntroductionFromContent

func IntroductionFromContent(content *Content) (*Introduction, error)

IntroductionFromContent decodes message content as an introduction.

func (*Introduction) Assets

func (i *Introduction) Assets() []*Object

Assets returns supporting object assets attached to the introduction.

func (*Introduction) DocumentAddress

func (i *Introduction) DocumentAddress() *DIDAddress

DocumentAddress returns the sender's document DID address.

func (*Introduction) PairwiseIntroduction

func (i *Introduction) PairwiseIntroduction() (*PairwiseIntroduction, error)

PairwiseIntroduction extracts the pairwise introduction (suitable for validating with Account.PairwiseValidateIntroduction).

func (*Introduction) Presentations

func (i *Introduction) Presentations() []*VerifiablePresentation

Presentations returns the verified presentations shared by the sender.

func (*Introduction) Tokens

func (i *Introduction) Tokens() ([]*Token, error)

Tokens returns the tokens issued by the sender.

type IntroductionBuilder

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

IntroductionBuilder builds an introduction message content.

func NewIntroductionBuilder

func NewIntroductionBuilder() *IntroductionBuilder

NewIntroductionBuilder initializes an introduction builder.

func (*IntroductionBuilder) Asset

Asset attaches a supporting object asset.

func (*IntroductionBuilder) DocumentAddress

func (b *IntroductionBuilder) DocumentAddress(address *DIDAddress) *IntroductionBuilder

DocumentAddress sets the document address the sender wants to identify as.

func (*IntroductionBuilder) Finish

func (b *IntroductionBuilder) Finish() (*Content, error)

Finish finalizes the introduction content, ready to send.

func (*IntroductionBuilder) Presentation

Presentation adds a verifiable presentation to the introduction.

func (*IntroductionBuilder) Token

Token attaches a token (e.g. a delegation/send token) to the introduction.

type KeyPackageEvent

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

KeyPackageEvent wraps a zktf_key_package wire event delivered to OnGroup as an invite. It carries the routing fields plus a conversion to the MLS-level crypto key package usable with Account.Establish.

func (*KeyPackageEvent) CryptoKeyPackage

func (e *KeyPackageEvent) CryptoKeyPackage() *CryptoKeyPackage

CryptoKeyPackage extracts the MLS key package suitable for Account.Establish.

func (*KeyPackageEvent) FromAddress

func (e *KeyPackageEvent) FromAddress() *SigningPublicKey

FromAddress returns the sender's address.

func (*KeyPackageEvent) Sequence

func (e *KeyPackageEvent) Sequence() uint64

Sequence returns the event's sequence number.

func (*KeyPackageEvent) Timestamp

func (e *KeyPackageEvent) Timestamp() int64

Timestamp returns the event's unix timestamp.

func (*KeyPackageEvent) ToAddress

func (e *KeyPackageEvent) ToAddress() *SigningPublicKey

ToAddress returns the recipient address.

type KeychainLookup

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

KeychainLookup builds a query for keychain signing keys.

func NewKeychainLookup

func NewKeychainLookup() *KeychainLookup

NewKeychainLookup initializes a keychain lookup query. With no filters applied it matches every signing key in the keychain.

func (*KeychainLookup) ByIdentity

func (l *KeychainLookup) ByIdentity(identity *SigningPublicKey) *KeychainLookup

ByIdentity restricts the lookup to keys associated with identity.

func (*KeychainLookup) WithRoles

func (l *KeychainLookup) WithRoles(roles IdentityKeyRole) *KeychainLookup

WithRoles restricts the lookup to keys carrying every role in roles. Only applies in combination with ByIdentity.

type KeypairType

type KeypairType uint32

KeypairType mirrors zktf_keypair_type.

const (
	KeypairSigning  KeypairType = C.KEYPAIR_SIGNING
	KeypairExchange KeypairType = C.KEYPAIR_EXCHANGE
)

type LogEntry

type LogEntry struct {
	Level     LogLevel
	AccountID string
	Target    string
	Message   string
	Timestamp time.Time
	Fields    []LogField
}

LogEntry is a structured log record emitted by the native library. It is a pure-Go snapshot: all strings are copied out before the native entry is freed.

type LogField

type LogField struct {
	Key   string
	Value string
}

LogField is a single structured key/value pair attached to a log entry.

type LogHandler

type LogHandler func(LogEntry)

LogHandler receives log entries from the native library.

type LogLevel

type LogLevel uint32

LogLevel mirrors zktf_log_level.

const (
	LogError LogLevel = C.LOG_ERROR
	LogWarn  LogLevel = C.LOG_WARN
	LogInfo  LogLevel = C.LOG_INFO
	LogDebug LogLevel = C.LOG_DEBUG
	LogTrace LogLevel = C.LOG_TRACE
)

type Message

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

Message wraps a zktf_message handle delivered to the on_message callback.

func (*Message) Content

func (m *Message) Content() *Content

Content decodes and returns the message content. The caller owns the result.

func (*Message) ContentHash

func (m *Message) ContentHash() []byte

ContentHash returns the 32-byte sha3 hash of the message content. This is the leaf value recipients use to validate the merkle proof carried in the metadata.

func (*Message) FromAddress

func (m *Message) FromAddress() *SigningPublicKey

FromAddress returns the sender's address.

func (*Message) ID

func (m *Message) ID() []byte

ID returns the message id.

func (*Message) Metadata

func (m *Message) Metadata() ([]byte, bool)

Metadata returns the opaque metadata payload attached to the message, if any. The payload is internal to the network and is not interpreted by this SDK; the boolean is false when no metadata is present.

func (*Message) Sequence

func (m *Message) Sequence() uint64

Sequence returns the per-sender sequence number of the message.

func (*Message) Timestamp

func (m *Message) Timestamp() int64

Timestamp returns the unix timestamp (seconds) of the message.

func (*Message) ToAddress

func (m *Message) ToAddress() *SigningPublicKey

ToAddress returns the recipient's address.

type MessageContentSummary

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

MessageContentSummary wraps a zktf_message_content_summary handle — a compact summary of message content, suitable for inclusion in a push notification.

func SummaryOf

func SummaryOf(content *Content) (*MessageContentSummary, error)

SummaryOf builds a summary of a piece of message content.

func (*MessageContentSummary) Descriptions

func (s *MessageContentSummary) Descriptions() []*SummaryDescription

Descriptions returns the structured descriptions that make up the summary.

func (*MessageContentSummary) ID

func (s *MessageContentSummary) ID() []byte

ID returns the id of the underlying content.

func (*MessageContentSummary) TypeOf

func (s *MessageContentSummary) TypeOf() ContentType

TypeOf returns the type of the summarized content.

type Network

type Network uint32

Network mirrors zktf_account_target — the network whose trust roots the account is anchored to.

const (
	NetworkProduction  Network = C.TARGET_PRODUCTION
	NetworkSandbox     Network = C.TARGET_SANDBOX
	NetworkStaging     Network = C.TARGET_STAGING
	NetworkPreview     Network = C.TARGET_PREVIEW
	NetworkDevelopment Network = C.TARGET_DEVELOPMENT
)

type Object

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

Object wraps a zktf_object handle (an encrypted attachment / blob).

func ObjectCreate

func ObjectCreate(mime string, data []byte) (*Object, error)

ObjectCreate builds an object from raw data and a mime type.

func (*Object) Data

func (o *Object) Data() []byte

Data returns the object's data buffer.

func (*Object) Hash

func (o *Object) Hash() []byte

Hash returns the hash of the unencrypted data, or nil if unavailable.

func (*Object) ID

func (o *Object) ID() []byte

ID returns the hash of the encrypted data, or nil if the object has not yet been uploaded (the id is only available once the encrypted data is hashed).

func (*Object) Key

func (o *Object) Key() []byte

Key returns the object's 44-byte encryption key, or nil if not present.

func (*Object) MimeType

func (o *Object) MimeType() string

MimeType returns the object's mime type.

type ObjectUploadOptions

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

ObjectUploadOptions configures Account.UploadObject.

func NewObjectUploadOptions

func NewObjectUploadOptions() *ObjectUploadOptions

NewObjectUploadOptions initializes upload options.

func (*ObjectUploadOptions) PersistLocally

func (o *ObjectUploadOptions) PersistLocally(persist bool) *ObjectUploadOptions

PersistLocally controls whether the uploaded object is also written to the local object store.

type OperationAction

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

OperationAction is one of the actions inside an identity operation.

func (*OperationAction) DescriptionEmbedded

func (a *OperationAction) DescriptionEmbedded() *OperationDescriptionEmbedded

DescriptionEmbedded returns the embedded description, or nil.

func (*OperationAction) DescriptionKind

func (a *OperationAction) DescriptionKind() OperationDescriptionKind

DescriptionKind returns the kind of description on the action.

func (*OperationAction) DescriptionReference

func (a *OperationAction) DescriptionReference() *OperationDescriptionReference

DescriptionReference returns the reference description, or nil.

func (*OperationAction) EffectiveFrom

func (a *OperationAction) EffectiveFrom() int64

EffectiveFrom returns the unix timestamp the action takes effect.

func (*OperationAction) Kind

Kind returns the kind of action.

func (*OperationAction) Roles

func (a *OperationAction) Roles() IdentityKeyRole

Roles returns the roles assigned by a grant or modify action.

type OperationActionKind

type OperationActionKind uint32

OperationActionKind mirrors zktf_identity_operation_action_type.

const (
	OperationActionGrant      OperationActionKind = C.OPERATION_ACTION_GRANT
	OperationActionModify     OperationActionKind = C.OPERATION_ACTION_MODIFY
	OperationActionRevoke     OperationActionKind = C.OPERATION_ACTION_REVOKE
	OperationActionRecover    OperationActionKind = C.OPERATION_ACTION_RECOVER
	OperationActionDeactivate OperationActionKind = C.OPERATION_ACTION_DEACTIVATE
)

type OperationDescriptionEmbedded

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

OperationDescriptionEmbedded describes a key embedded in an action.

func (*OperationDescriptionEmbedded) AddressAsExchange

func (d *OperationDescriptionEmbedded) AddressAsExchange() *ExchangePublicKey

AddressAsExchange returns the address as an exchange key, or nil if signing.

func (*OperationDescriptionEmbedded) AddressAsSigning

func (d *OperationDescriptionEmbedded) AddressAsSigning() *SigningPublicKey

AddressAsSigning returns the address as a signing key, or nil if exchange.

func (*OperationDescriptionEmbedded) AddressType

func (d *OperationDescriptionEmbedded) AddressType() KeypairType

AddressType returns the type of address (signing or exchange).

func (*OperationDescriptionEmbedded) Controller

Controller returns the controller address, or nil.

type OperationDescriptionKind

type OperationDescriptionKind uint32

OperationDescriptionKind mirrors zktf_identity_operation_description_type.

type OperationDescriptionReference

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

OperationDescriptionReference describes a key referenced by another method.

func (*OperationDescriptionReference) AddressAsExchange

func (d *OperationDescriptionReference) AddressAsExchange() *ExchangePublicKey

AddressAsExchange returns the address as an exchange key, or nil if signing.

func (*OperationDescriptionReference) AddressAsSigning

func (d *OperationDescriptionReference) AddressAsSigning() *SigningPublicKey

AddressAsSigning returns the address as a signing key, or nil if exchange.

func (*OperationDescriptionReference) AddressType

func (d *OperationDescriptionReference) AddressType() KeypairType

AddressType returns the type of address (signing or exchange).

func (*OperationDescriptionReference) Controller

Controller returns the controller address, or nil.

func (*OperationDescriptionReference) Method

Method returns the DID method used by the reference.

type Outcome

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

Outcome is the generic polymorphic wrapper for per-kind result types inside an exchange response.

func (*Outcome) ActionID

func (o *Outcome) ActionID() []byte

ActionID returns the id of the action this outcome refers to.

func (*Outcome) AsDevicePairing

func (o *Outcome) AsDevicePairing() (*DevicePairingResult, error)

AsDevicePairing downcasts the outcome to a device-pairing result.

func (*Outcome) AsIdentitySigning

func (o *Outcome) AsIdentitySigning() (*IdentitySigningResult, error)

AsIdentitySigning downcasts the outcome to an identity-signing result.

func (*Outcome) AsPresentation

func (o *Outcome) AsPresentation() (*PresentationResult, error)

AsPresentation downcasts the outcome to a credential presentation result.

func (*Outcome) AsRevocationSigning

func (o *Outcome) AsRevocationSigning() (*RevocationSigningResult, error)

AsRevocationSigning downcasts the outcome to a revocation-signing result.

func (*Outcome) AsVerification

func (o *Outcome) AsVerification() (*VerificationResult, error)

AsVerification downcasts the outcome to a credential verification result.

func (*Outcome) ErrorMessage

func (o *Outcome) ErrorMessage() string

ErrorMessage returns the error message carried by the outcome, or "".

func (*Outcome) Kind

func (o *Outcome) Kind() OutcomeKind

Kind returns the kind of outcome.

func (*Outcome) Status

func (o *Outcome) Status() ResponseStatus

Status returns the response status carried by the outcome.

type OutcomeBuilder

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

OutcomeBuilder builds a generic outcome carrying one of the per-kind results.

func NewOutcomeBuilder

func NewOutcomeBuilder() *OutcomeBuilder

NewOutcomeBuilder initializes an outcome builder.

func (*OutcomeBuilder) ActionID

func (b *OutcomeBuilder) ActionID(id []byte) *OutcomeBuilder

ActionID sets the id of the action this outcome refers to.

func (*OutcomeBuilder) ErrorMessage

func (b *OutcomeBuilder) ErrorMessage(msg string) *OutcomeBuilder

ErrorMessage sets a human-readable error message.

func (*OutcomeBuilder) Finish

func (b *OutcomeBuilder) Finish() (*Outcome, error)

Finish finalizes the outcome.

func (*OutcomeBuilder) ResultPairing

func (b *OutcomeBuilder) ResultPairing(r *DevicePairingResult) *OutcomeBuilder

ResultPairing attaches a device-pairing result.

func (*OutcomeBuilder) ResultPresentation

func (b *OutcomeBuilder) ResultPresentation(r *PresentationResult) *OutcomeBuilder

ResultPresentation attaches a credential presentation result.

func (*OutcomeBuilder) ResultRevocationSigning

func (b *OutcomeBuilder) ResultRevocationSigning(r *RevocationSigningResult) *OutcomeBuilder

ResultRevocationSigning attaches a revocation-signing result.

func (*OutcomeBuilder) ResultSigning

func (b *OutcomeBuilder) ResultSigning(r *IdentitySigningResult) *OutcomeBuilder

ResultSigning attaches an identity-signing result.

func (*OutcomeBuilder) ResultVerification

func (b *OutcomeBuilder) ResultVerification(r *VerificationResult) *OutcomeBuilder

ResultVerification attaches a credential verification result.

func (*OutcomeBuilder) Status

Status sets the response status.

type OutcomeKind

type OutcomeKind uint32

OutcomeKind mirrors zktf_message_content_outcome_kind.

const (
	OutcomeKindUnknown                OutcomeKind = C.OUTCOME_KIND_UNKNOWN
	OutcomeKindCredentialPresentation OutcomeKind = C.OUTCOME_KIND_CREDENTIAL_PRESENTATION
	OutcomeKindCredentialVerification OutcomeKind = C.OUTCOME_KIND_CREDENTIAL_VERIFICATION
	OutcomeKindIdentitySigning        OutcomeKind = C.OUTCOME_KIND_IDENTITY_SIGNING
	OutcomeKindDevicePairing          OutcomeKind = C.OUTCOME_KIND_DEVICE_PAIRING
	OutcomeKindRevocationSigning      OutcomeKind = C.OUTCOME_KIND_REVOCATION_SIGNING
)

type PairwiseIdentity

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

PairwiseIdentity wraps a zktf_pairwise_identity handle.

func PairwiseIdentityDecode

func PairwiseIdentityDecode(data []byte) (*PairwiseIdentity, error)

PairwiseIdentityDecode decodes an encoded pairwise identity.

func (*PairwiseIdentity) BiometricAnchorHash

func (i *PairwiseIdentity) BiometricAnchorHash() []byte

BiometricAnchorHash returns the 20-byte biometric anchor hash, or nil.

func (*PairwiseIdentity) DocumentAddress

func (i *PairwiseIdentity) DocumentAddress() *DIDAddress

DocumentAddress returns the counterparty's document DID address.

func (*PairwiseIdentity) Encode

func (i *PairwiseIdentity) Encode() []byte

Encode returns the encoded bytes of the identity.

type PairwiseIntroduction

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

PairwiseIntroduction wraps a zktf_pairwise_introduction handle (the result of validating an introduction message).

func (*PairwiseIntroduction) DocumentAddress

func (i *PairwiseIntroduction) DocumentAddress() *DIDAddress

DocumentAddress returns the introduced party's document DID address.

func (*PairwiseIntroduction) Presentations

func (i *PairwiseIntroduction) Presentations() []*VerifiablePresentation

Presentations returns the presentations shared by the sender.

type PairwiseRelationship

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

PairwiseRelationship wraps a zktf_pairwise_relationship handle.

func (*PairwiseRelationship) AsIdentity

func (r *PairwiseRelationship) AsIdentity() *PairwiseIdentity

AsIdentity returns the identity this account presents to the counterparty.

func (*PairwiseRelationship) Status

Status returns the connection status.

func (*PairwiseRelationship) WithIdentity

func (r *PairwiseRelationship) WithIdentity() *PairwiseIdentity

WithIdentity returns the counterparty's identity.

type PairwiseStatus

type PairwiseStatus uint32

PairwiseStatus mirrors zktf_pairwise_status.

const (
	PairwiseStatusPending     PairwiseStatus = C.CONNECTION_STATUS_PENDING
	PairwiseStatusNegotiating PairwiseStatus = C.CONNECTION_STATUS_NEGOTIATING
	PairwiseStatusEstablished PairwiseStatus = C.CONNECTION_STATUS_ESTABLISHED
)

type ParameterValue

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

ParameterValue is a typed value carried by a verification parameter. Values map to and from native Go types via NewParameterValue and Value.

func NewParameterValue

func NewParameterValue(v any) *ParameterValue

NewParameterValue builds a parameter value from a supported Go type. Accepted types are []byte, string, bool, the signed integer types (int, int8, int16, int32, int64), the unsigned integer types (uint, uint8, uint16, uint32, uint64), float32, float64, [][]byte and []string. Any other type yields nil.

func (*ParameterValue) Value

func (v *ParameterValue) Value() any

Value decodes the parameter value into a native Go type: []byte, string, bool, int64, uint64, float64, [][]byte or []string. Null and object values, for which the ABI exposes no accessor, decode to nil.

type Predicate

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

Predicate wraps a zktf_credential_predicate handle. Predicates are intermediate values combined via And/Or and ultimately rooted in a PredicateTree.

func PredicateAnd

func PredicateAnd(a, b *Predicate) *Predicate

PredicateAnd combines two predicates with logical AND.

func PredicateContains

func PredicateContains(field, value string) *Predicate

PredicateContains checks if field contains value.

func PredicateEmpty

func PredicateEmpty(field string) *Predicate

PredicateEmpty checks if field is empty.

func PredicateEquals

func PredicateEquals(field, value string) *Predicate

PredicateEquals checks if the field equals value. Field is an RFC 6901 JSON pointer.

func PredicateGreaterThan

func PredicateGreaterThan(field, value string) *Predicate

PredicateGreaterThan checks if field > value.

func PredicateGreaterThanOrEquals

func PredicateGreaterThanOrEquals(field, value string) *Predicate

PredicateGreaterThanOrEquals checks if field >= value.

func PredicateLessThan

func PredicateLessThan(field, value string) *Predicate

PredicateLessThan checks if field < value.

func PredicateLessThanOrEquals

func PredicateLessThanOrEquals(field, value string) *Predicate

PredicateLessThanOrEquals checks if field <= value.

func PredicateNotContains

func PredicateNotContains(field, value string) *Predicate

PredicateNotContains is the negation of PredicateContains.

func PredicateNotEmpty

func PredicateNotEmpty(field string) *Predicate

PredicateNotEmpty checks if field is not empty.

func PredicateNotEquals

func PredicateNotEquals(field, value string) *Predicate

PredicateNotEquals is the negation of PredicateEquals.

func PredicateNotOneOf

func PredicateNotOneOf(field string, values []string) *Predicate

PredicateNotOneOf is the negation of PredicateOneOf.

func PredicateOneOf

func PredicateOneOf(field string, values []string) *Predicate

PredicateOneOf checks if field is one of the given values.

func PredicateOr

func PredicateOr(a, b *Predicate) *Predicate

PredicateOr combines two predicates with logical OR.

type PredicateReport

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

PredicateReport describes which requirements (predicate solutions) remain unsatisfied.

func (*PredicateReport) Requirements

func (r *PredicateReport) Requirements() []*PredicateSolution

Requirements returns the per-requirement solutions in the report.

type PredicateSolution

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

PredicateSolution is the per-requirement set of predicators that would satisfy it.

func (*PredicateSolution) Predicators

func (s *PredicateSolution) Predicators() []*Predicator

Predicators returns the predicators required to satisfy this solution.

type PredicateTree

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

PredicateTree is a built tree of predicates ready to evaluate against credentials.

func NewPredicateTree

func NewPredicateTree(root *Predicate) *PredicateTree

NewPredicateTree builds a tree rooted at the given predicate.

func PredicateTreeDecode

func PredicateTreeDecode(data []byte) (*PredicateTree, error)

PredicateTreeDecode decodes an encoded predicate tree.

func (*PredicateTree) Encode

func (t *PredicateTree) Encode() []byte

Encode returns the encoded bytes of the tree.

func (*PredicateTree) FindMissingPredicates

func (t *PredicateTree) FindMissingPredicates(credentials []*VerifiableCredential) *PredicateReport

FindMissingPredicates returns a report of predicates the credentials do not satisfy.

func (*PredicateTree) FindOptimalMatch

func (t *PredicateTree) FindOptimalMatch(credentials []*VerifiableCredential) []*VerifiableCredential

FindOptimalMatch selects the optimal set of credentials matching the tree, or returns nil if no match is possible.

func (*PredicateTree) Graphviz

func (t *PredicateTree) Graphviz() string

Graphviz renders the tree in graphviz dot format.

type Predicator

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

Predicator is a single field/op/values triple describing a needed predicate.

func (*Predicator) Field

func (p *Predicator) Field() string

Field returns the credential field (JSON pointer) the predicator operates on.

func (*Predicator) Kind

func (p *Predicator) Kind() PredicatorKind

Kind returns the predicator's operator.

func (*Predicator) Values

func (p *Predicator) Values() []string

Values returns the predicator's value(s).

type PredicatorKind

type PredicatorKind uint32

PredicatorKind mirrors zktf_credential_predicator_type.

const (
	PredicatorEquals             PredicatorKind = C.PREDICATOR_EQUALS
	PredicatorNotEquals          PredicatorKind = C.PREDICATOR_NOT_EQUALS
	PredicatorGreaterThan        PredicatorKind = C.PREDICATOR_GREATER_THAN
	PredicatorGreaterThanOrEqual PredicatorKind = C.PREDICATOR_GREATER_THAN_OR_EQUALS
	PredicatorLessThan           PredicatorKind = C.PREDICATOR_LESS_THAN
	PredicatorLessThanOrEqual    PredicatorKind = C.PREDICATOR_LESS_THAN_OR_EQUALS
	PredicatorContains           PredicatorKind = C.PREDICATOR_CONTAINS
	PredicatorNotContains        PredicatorKind = C.PREDICATOR_NOT_CONTAINS
	PredicatorOneOf              PredicatorKind = C.PREDICATOR_ONE_OF
	PredicatorNotOneOf           PredicatorKind = C.PREDICATOR_NOT_ONE_OF
	PredicatorEmpty              PredicatorKind = C.PREDICATOR_EMPTY
	PredicatorNotEmpty           PredicatorKind = C.PREDICATOR_NOT_EMPTY
)

type PresentationAction

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

PresentationAction is a credential-presentation request (verifier → holder).

func (*PresentationAction) AsAction

func (a *PresentationAction) AsAction() *Action

AsAction wraps this presentation action into a generic Action (consuming it).

func (*PresentationAction) Challenge

func (a *PresentationAction) Challenge() []byte

Challenge returns the random challenge bytes the verifier expects to be signed back, or nil.

func (*PresentationAction) Holder

func (a *PresentationAction) Holder() (*DIDAddress, error)

Holder returns the expected holder address, or nil.

func (*PresentationAction) Predicates

func (a *PresentationAction) Predicates() *PredicateTree

Predicates returns the predicate tree describing the request's credential constraints, or nil.

func (*PresentationAction) PresentationTypes

func (a *PresentationAction) PresentationTypes() []string

PresentationTypes returns the requested presentation types.

func (*PresentationAction) Proof

Proof returns the verifiable presentations attached as proof.

func (*PresentationAction) Term

Term returns the term the requester would like to access credentials under, or nil.

type PresentationActionBuilder

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

PresentationActionBuilder builds a credential presentation action.

func NewPresentationActionBuilder

func NewPresentationActionBuilder() *PresentationActionBuilder

NewPresentationActionBuilder initializes a presentation action builder.

func (*PresentationActionBuilder) Challenge

func (b *PresentationActionBuilder) Challenge(challenge []byte) *PresentationActionBuilder

Challenge sets the random challenge the verifier expects to be signed back.

func (*PresentationActionBuilder) Finish

Finish finalizes the presentation action.

func (*PresentationActionBuilder) Holder

Holder sets the expected holder address.

func (*PresentationActionBuilder) Predicates

Predicates sets the predicate tree describing the request's credential constraints.

func (*PresentationActionBuilder) PresentationType

PresentationType sets the requested presentation types.

func (*PresentationActionBuilder) Proof

Proof attaches a verifiable presentation as proof.

func (*PresentationActionBuilder) Term

Term sets the term the requester would like to access the credentials under.

type PresentationBuilder

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

PresentationBuilder wraps a zktf_presentation_builder handle.

func NewPresentationBuilder

func NewPresentationBuilder() *PresentationBuilder

NewPresentationBuilder initializes a new presentation builder.

func (*PresentationBuilder) CredentialAdd

func (b *PresentationBuilder) CredentialAdd(credential *VerifiableCredential) *PresentationBuilder

CredentialAdd adds a verifiable credential to the presentation.

func (*PresentationBuilder) Finish

Finish finalizes the presentation, ready to be signed via Account.PresentationSign.

func (*PresentationBuilder) Holder

Holder sets the holder/bearer address.

func (*PresentationBuilder) PresentationType

func (b *PresentationBuilder) PresentationType(types *TypeCollection) *PresentationBuilder

PresentationType sets the presentation's types.

type PresentationResult

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

PresentationResult is the response to a credential-presentation request.

func (*PresentationResult) Presentations

func (r *PresentationResult) Presentations() []*VerifiablePresentation

Presentations returns the verifiable presentations contained in the result.

type PresentationResultBuilder

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

PresentationResultBuilder builds a credential-presentation result.

func NewPresentationResultBuilder

func NewPresentationResultBuilder() *PresentationResultBuilder

NewPresentationResultBuilder initializes a presentation result builder.

func (*PresentationResultBuilder) Finish

Finish finalizes the presentation result.

func (*PresentationResultBuilder) Presentation

Presentation adds a verifiable presentation to the result.

type ProposalEvent

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

ProposalEvent wraps a zktf_proposal wire event.

func (*ProposalEvent) FromAddress

func (e *ProposalEvent) FromAddress() *SigningPublicKey

FromAddress returns the sender's address.

func (*ProposalEvent) Sequence

func (e *ProposalEvent) Sequence() uint64

Sequence returns the event's sequence number.

func (*ProposalEvent) Timestamp

func (e *ProposalEvent) Timestamp() int64

Timestamp returns the event's unix timestamp.

func (*ProposalEvent) ToAddress

func (e *ProposalEvent) ToAddress() *SigningPublicKey

ToAddress returns the recipient address.

type PushTokenBuilder

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

PushTokenBuilder builds a push token request.

func NewPushTokenBuilder

func NewPushTokenBuilder() *PushTokenBuilder

NewPushTokenBuilder initializes a push token builder.

func (*PushTokenBuilder) Delegatable

func (b *PushTokenBuilder) Delegatable(delegatable bool) *PushTokenBuilder

Delegatable allows the bearer to further delegate the issued token.

func (*PushTokenBuilder) Finish

func (b *PushTokenBuilder) Finish() (*TokenRequest, error)

Finish validates the configured fields and returns a token request.

func (*PushTokenBuilder) ForAddress

func (b *PushTokenBuilder) ForAddress(address *SigningPublicKey) *PushTokenBuilder

ForAddress sets the local group address the token authorizes notifications for.

func (*PushTokenBuilder) ProviderAddress

func (b *PushTokenBuilder) ProviderAddress(address *ExchangePublicKey) *PushTokenBuilder

ProviderAddress sets the exchange public key of the push provider.

type Receipt

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

Receipt wraps a zktf_message_content_receipt handle.

func ReceiptFromContent

func ReceiptFromContent(content *Content) (*Receipt, error)

ReceiptFromContent decodes message content as a receipt.

func (*Receipt) Delivered

func (r *Receipt) Delivered() [][]byte

Delivered returns the ids of messages marked delivered.

func (*Receipt) Read

func (r *Receipt) Read() [][]byte

Read returns the ids of messages marked read.

type ReceiptBuilder

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

ReceiptBuilder wraps a zktf_message_content_receipt_builder handle.

func NewReceiptBuilder

func NewReceiptBuilder() *ReceiptBuilder

NewReceiptBuilder initializes a new receipt content builder.

func (*ReceiptBuilder) Delivered

func (b *ReceiptBuilder) Delivered(messageID []byte) *ReceiptBuilder

Delivered marks a message id as delivered.

func (*ReceiptBuilder) Finish

func (b *ReceiptBuilder) Finish() (*Content, error)

Finish finalizes the receipt content, ready to send.

func (*ReceiptBuilder) Read

func (b *ReceiptBuilder) Read(messageID []byte) *ReceiptBuilder

Read marks a message id as read.

type ResponseStatus

type ResponseStatus uint32

ResponseStatus mirrors zktf_message_response_status.

const (
	ResponseStatusUnknown       ResponseStatus = C.RESPONSE_STATUS_UNKNOWN
	ResponseStatusOK            ResponseStatus = C.RESPONSE_STATUS_OK
	ResponseStatusAccepted      ResponseStatus = C.RESPONSE_STATUS_ACCEPTED
	ResponseStatusCreated       ResponseStatus = C.RESPONSE_STATUS_CREATED
	ResponseStatusBadRequest    ResponseStatus = C.RESPONSE_STATUS_BAD_REQUEST
	ResponseStatusUnauthorized  ResponseStatus = C.RESPONSE_STATUS_UNAUTHORIZED
	ResponseStatusForbidden     ResponseStatus = C.RESPONSE_STATUS_FORBIDDEN
	ResponseStatusNotFound      ResponseStatus = C.RESPONSE_STATUS_NOT_FOUND
	ResponseStatusNotAcceptable ResponseStatus = C.RESPONSE_STATUS_NOT_ACCEPTABLE
	ResponseStatusConflict      ResponseStatus = C.RESPONSE_STATUS_CONFLICT
)

type RevocationEntry

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

RevocationEntry is a single per-credential revocation entry in a statement.

func (*RevocationEntry) Hash

func (e *RevocationEntry) Hash() []byte

Hash returns the 32-byte revocation hash.

func (*RevocationEntry) Timestamp

func (e *RevocationEntry) Timestamp() int64

Timestamp returns the revocation timestamp.

type RevocationProof

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

RevocationProof wraps a zktf_revocation_proof handle — a single revocation entry plus the signers and statement metadata that produced it.

func (*RevocationProof) Issuer

func (p *RevocationProof) Issuer() *SigningPublicKey

Issuer returns the issuer's signing public key.

func (*RevocationProof) RevocationHash

func (p *RevocationProof) RevocationHash() []byte

RevocationHash returns the 32-byte hash of the revoked entity.

func (*RevocationProof) RevokedAt

func (p *RevocationProof) RevokedAt() int64

RevokedAt returns when the revocation took effect (unix seconds).

func (*RevocationProof) Sequence

func (p *RevocationProof) Sequence() uint64

Sequence returns the originating statement's sequence number.

func (*RevocationProof) Signers

func (p *RevocationProof) Signers() []*RevocationSigner

Signers returns the signer entries of the originating statement.

func (*RevocationProof) Timestamp

func (p *RevocationProof) Timestamp() int64

Timestamp returns the originating statement's timestamp (unix seconds).

type RevocationSigner

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

RevocationSigner is a single signer entry on a revocation statement.

func (*RevocationSigner) Address

func (s *RevocationSigner) Address() *SigningPublicKey

Address returns the signer's signing public key.

func (*RevocationSigner) Issued

func (s *RevocationSigner) Issued() int64

Issued returns the unix timestamp the signature was issued.

type RevocationSigningAction

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

RevocationSigningAction is a request asking a device to co-sign a revocation statement.

func (*RevocationSigningAction) AsAction

func (a *RevocationSigningAction) AsAction() *Action

AsAction wraps this revocation-signing action into a generic Action.

func (*RevocationSigningAction) Statement

Statement returns the revocation statement this device is asked to co-sign.

type RevocationSigningActionBuilder

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

RevocationSigningActionBuilder builds a revocation-signing action.

func NewRevocationSigningActionBuilder

func NewRevocationSigningActionBuilder() *RevocationSigningActionBuilder

NewRevocationSigningActionBuilder initializes the builder.

func (*RevocationSigningActionBuilder) Finish

Finish finalizes the action.

func (*RevocationSigningActionBuilder) Statement

Statement sets the revocation statement to be co-signed.

type RevocationSigningResult

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

RevocationSigningResult is the response to a revocation-signing request.

func (*RevocationSigningResult) Statement

Statement returns the co-signed revocation statement.

type RevocationSigningResultBuilder

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

RevocationSigningResultBuilder builds a revocation-signing result.

func NewRevocationSigningResultBuilder

func NewRevocationSigningResultBuilder() *RevocationSigningResultBuilder

NewRevocationSigningResultBuilder initializes the builder.

func (*RevocationSigningResultBuilder) Finish

Finish finalizes the result.

func (*RevocationSigningResultBuilder) Statement

Statement sets the co-signed revocation statement.

type RevocationStatement

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

RevocationStatement wraps a zktf_revocation_statement handle.

func RevocationStatementDecode

func RevocationStatementDecode(data []byte) (*RevocationStatement, error)

RevocationStatementDecode decodes an encoded revocation statement.

func (*RevocationStatement) Encode

func (s *RevocationStatement) Encode() ([]byte, error)

Encode returns the encoded bytes of the statement.

func (*RevocationStatement) Issuer

Issuer returns the issuer's signing public key.

func (*RevocationStatement) Revocations

func (s *RevocationStatement) Revocations() []*RevocationEntry

Revocations returns the per-credential revocations in the statement.

func (*RevocationStatement) RevokedAt

func (s *RevocationStatement) RevokedAt(hash []byte) (int64, bool)

RevokedAt returns the revocation timestamp for the given revocation hash, or false if the hash is not in the statement.

func (*RevocationStatement) Sequence

func (s *RevocationStatement) Sequence() uint64

Sequence returns the statement's sequence number.

func (*RevocationStatement) SignedBy

func (s *RevocationStatement) SignedBy(signer *SigningPublicKey) bool

SignedBy reports whether the given signer's signature appears on the statement.

func (*RevocationStatement) Signers

func (s *RevocationStatement) Signers() []*RevocationSigner

Signers returns the signer entries in the statement.

func (*RevocationStatement) Timestamp

func (s *RevocationStatement) Timestamp() int64

Timestamp returns the statement's unix timestamp (seconds).

type RevocationStatementBuilder

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

RevocationStatementBuilder builds a revocation statement.

func NewRevocationStatementBuilder

func NewRevocationStatementBuilder() *RevocationStatementBuilder

NewRevocationStatementBuilder initializes a revocation statement builder.

func (*RevocationStatementBuilder) Finish

Finish finalizes the revocation statement.

func (*RevocationStatementBuilder) Issuer

Issuer sets the statement's issuer.

func (*RevocationStatementBuilder) Revoke

Revoke revokes a verifiable credential at the given timestamp.

func (*RevocationStatementBuilder) RevokeBy

func (b *RevocationStatementBuilder) RevokeBy(hash []byte, revokedAtUnix int64) *RevocationStatementBuilder

RevokeBy revokes a credential identified by its 32-byte revocation hash.

func (*RevocationStatementBuilder) Sequence

Sequence sets the statement's sequence number.

func (*RevocationStatementBuilder) SignWith

SignWith records the signing key and issuance time for the statement.

func (*RevocationStatementBuilder) Timestamp

Timestamp sets the statement's timestamp.

type SigningPublicKey

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

SigningPublicKey wraps a zktf_signing_public_key handle. The C pointer is held in the unexported ptr field so it never leaks into an exported signature.

func AwaitSigningPublicKey

func AwaitSigningPublicKey(fut *C.zktf_future_signing_public_key, timeout time.Duration) (*SigningPublicKey, error)

AwaitSigningPublicKey drives a zktf_future_signing_public_key to completion.

func SigningPublicKeyFromAddress

func SigningPublicKeyFromAddress(hex string) (*SigningPublicKey, error)

SigningPublicKeyFromAddress decodes a hex address into a public key.

func SigningPublicKeyFromBytes

func SigningPublicKeyFromBytes(data []byte) (*SigningPublicKey, error)

SigningPublicKeyFromBytes constructs a public key from its raw bytes.

func (*SigningPublicKey) Bytes

func (k *SigningPublicKey) Bytes() []byte

Bytes returns the raw bytes of the public key.

func (*SigningPublicKey) Matches

func (k *SigningPublicKey) Matches(other *SigningPublicKey) bool

func (*SigningPublicKey) String

func (k *SigningPublicKey) String() string

String returns the hex encoded address.

func (*SigningPublicKey) Verify

func (k *SigningPublicKey) Verify(message, signature []byte) bool

Matches reports whether two public keys are equal. Verify reports whether signature is a valid signature of message by this key.

type Status

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

Status wraps a non-zero zktf_status code returned by the native library and implements the error interface. Public packages return it as a plain `error`, so the underlying C enum never appears in any exported signature.

func (*Status) Code

func (s *Status) Code() uint32

Code returns the raw zktf_status code. Public packages may compare it against the constants re-declared in the public status package.

func (*Status) Error

func (s *Status) Error() string

Error returns the human readable message for the status code, as provided by zktf_status_message.

type StatusEvent

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

StatusEvent wraps a zktf_status_event delivered to the on_status callback.

func (*StatusEvent) DisconnectReason

func (e *StatusEvent) DisconnectReason() error

DisconnectReason returns the reason for a disconnect event as an error, or nil.

func (*StatusEvent) Dropped

func (e *StatusEvent) Dropped() *DroppedEvent

Dropped returns the dropped-event details for a STATUS_EVENT_DROPPED, or nil.

func (*StatusEvent) Kind

func (e *StatusEvent) Kind() StatusEventType

Kind returns the kind of status event.

func (*StatusEvent) ReferenceID

func (e *StatusEvent) ReferenceID() []byte

ReferenceID returns the message id referenced by an acknowledged/send-failed event, or nil.

func (*StatusEvent) SendError

func (e *StatusEvent) SendError() error

SendError returns the error for a send-failed event, or nil.

type StatusEventType

type StatusEventType uint32

StatusEventType mirrors zktf_status_event_type.

const (
	StatusEventConnected    StatusEventType = C.STATUS_EVENT_CONNECTED
	StatusEventDisconnected StatusEventType = C.STATUS_EVENT_DISCONNECTED
	StatusEventAcknowledged StatusEventType = C.STATUS_EVENT_ACKNOWLEDGED
	StatusEventSendFailed   StatusEventType = C.STATUS_EVENT_SEND_FAILED
	StatusEventDropped      StatusEventType = C.STATUS_EVENT_DROPPED
)

type SummaryDescription

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

SummaryDescription is one structured element of a content summary.

func (*SummaryDescription) AsAsset

func (d *SummaryDescription) AsAsset() *Object

AsAsset returns the asset object (ASSET descriptions).

func (*SummaryDescription) AsChatAttachment

func (d *SummaryDescription) AsChatAttachment() *Object

AsChatAttachment returns the attached object (CHAT_ATTACHMENT descriptions).

func (*SummaryDescription) AsChatMessage

func (d *SummaryDescription) AsChatMessage() string

AsChatMessage returns the chat message text (CHAT_MESSAGE descriptions).

func (*SummaryDescription) AsChatReference

func (d *SummaryDescription) AsChatReference() []byte

AsChatReference returns the referenced message id (CHAT_REFERENCE descriptions).

func (*SummaryDescription) AsCredential

func (d *SummaryDescription) AsCredential() []string

AsCredential returns the credential types (CREDENTIAL descriptions).

func (*SummaryDescription) AsPairing

func (d *SummaryDescription) AsPairing() uint64

AsPairing returns the pairing roles bitmask (PAIRING descriptions).

func (*SummaryDescription) AsPresentation

func (d *SummaryDescription) AsPresentation() []string

AsPresentation returns the presentation types (PRESENTATION descriptions).

func (*SummaryDescription) AsSignature

func (d *SummaryDescription) AsSignature() []byte

AsSignature returns the signature bytes (SIGNATURE descriptions).

func (*SummaryDescription) AsVerification

func (d *SummaryDescription) AsVerification() []string

AsVerification returns the verified credential types (VERIFICATION descriptions).

func (*SummaryDescription) Kind

Kind returns which kind of description this is.

type SummaryDescriptionKind

type SummaryDescriptionKind uint32

SummaryDescriptionKind mirrors zktf_message_content_summary_description_type.

type Token

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

Token wraps a zktf_token handle.

func TokenDecode

func TokenDecode(data []byte) (*Token, error)

TokenDecode decodes an encoded token.

func (*Token) Application

func (t *Token) Application() *SigningPublicKey

Application returns the application the token is scoped to, or nil.

func (*Token) Bearer

func (t *Token) Bearer() *SigningPublicKey

Bearer returns the address the token is intended for, or nil.

func (*Token) Encode

func (t *Token) Encode() ([]byte, error)

Encode returns the encoded token bytes.

func (*Token) Expires

func (t *Token) Expires() int64

Expires returns the unix timestamp (seconds) the token expires.

func (*Token) Issued

func (t *Token) Issued() int64

Issued returns the unix timestamp (seconds) the token was issued.

func (*Token) Issuer

func (t *Token) Issuer() *SigningPublicKey

Issuer returns the address that issued the token, or nil.

func (*Token) Kind

func (t *Token) Kind() TokenKind

Kind returns the token kind.

func (*Token) Nonce

func (t *Token) Nonce() []byte

Nonce returns the 20-byte random nonce in the token header.

type TokenKind

type TokenKind uint8

TokenKind mirrors zktf_token_kind.

const (
	TokenKindUnknown        TokenKind = C.TOKEN_KIND_UNKNOWN
	TokenKindAuthentication TokenKind = C.TOKEN_KIND_AUTHENTICATION
	TokenKindSend           TokenKind = C.TOKEN_KIND_SEND
	TokenKindPush           TokenKind = C.TOKEN_KIND_PUSH
	TokenKindSubscription   TokenKind = C.TOKEN_KIND_SUBSCRIPTION
	TokenKindDelegation     TokenKind = C.TOKEN_KIND_DELEGATION
	TokenKindIdentity       TokenKind = C.TOKEN_KIND_IDENTITY
)

type TokenRequest

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

TokenRequest is a validated request ready to be issued into a token.

type TrustedIssuerRegistry

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

TrustedIssuerRegistry wraps a zktf_trusted_issuer_registry handle: the set of issuers (and their per-credential-type authority windows) a verifier trusts.

func DefaultProductionTrustedIssuerRegistry

func DefaultProductionTrustedIssuerRegistry() *TrustedIssuerRegistry

DefaultProductionTrustedIssuerRegistry returns the registry of self's production issuers.

func DefaultSandboxTrustedIssuerRegistry

func DefaultSandboxTrustedIssuerRegistry() *TrustedIssuerRegistry

DefaultSandboxTrustedIssuerRegistry returns the registry of self's sandbox issuers.

func NewTrustedIssuerRegistry

func NewTrustedIssuerRegistry() *TrustedIssuerRegistry

NewTrustedIssuerRegistry initializes an empty registry.

func (*TrustedIssuerRegistry) AuthorityAt

func (r *TrustedIssuerRegistry) AuthorityAt(issuer *DIDAddress, credentialType string, issuedUnix int64) bool

AuthorityAt reports whether the issuer was authorized for the credential type at the given timestamp.

func (*TrustedIssuerRegistry) AuthorityFor

func (r *TrustedIssuerRegistry) AuthorityFor(issuer *DIDAddress) ([]string, error)

AuthorityFor returns the credential types the issuer is authorized for.

func (*TrustedIssuerRegistry) AuthorityGrant

func (r *TrustedIssuerRegistry) AuthorityGrant(issuer *DIDAddress, credentialType string, grantedUnix int64, revokedUnix int64) error

AuthorityGrant grants the issuer authority over a credential type from a time, optionally bounded by a revocation time (pass 0 for no revocation).

func (*TrustedIssuerRegistry) AuthorityRevoke

func (r *TrustedIssuerRegistry) AuthorityRevoke(issuer *DIDAddress, credentialType string, revokedUnix int64) error

AuthorityRevoke marks the issuer's authority over a credential type revoked from the given time.

func (*TrustedIssuerRegistry) IssuerAdd

func (r *TrustedIssuerRegistry) IssuerAdd(issuer *DIDAddress) bool

IssuerAdd adds an issuer to the registry. Returns false if it was already present.

func (*TrustedIssuerRegistry) IssuerRemove

func (r *TrustedIssuerRegistry) IssuerRemove(issuer *DIDAddress) bool

IssuerRemove removes an issuer. Returns false if it was not present.

func (*TrustedIssuerRegistry) Issuers

func (r *TrustedIssuerRegistry) Issuers() []*DIDAddress

Issuers returns the DID addresses of all issuers in the registry.

type TypeCollection

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

TypeCollection wraps a zktf_collection_string_buffer handle holding a set of credential or presentation type names. It backs both NewCredentialTypes and NewPresentationTypes, which are otherwise identical.

func NewCredentialTypes

func NewCredentialTypes(types []string) *TypeCollection

NewCredentialTypes builds a credential type collection from the given type strings (e.g. "VerifiableCredential", "EmailCredential").

func NewPresentationTypes

func NewPresentationTypes(types []string) *TypeCollection

NewPresentationTypes builds a presentation type collection from type strings.

func (*TypeCollection) Strings

func (c *TypeCollection) Strings() []string

Strings returns the type strings in the collection.

type VerifiableCredential

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

VerifiableCredential wraps a signed zktf_verifiable_credential handle.

func VerifiableCredentialDecode

func VerifiableCredentialDecode(data []byte) (*VerifiableCredential, error)

VerifiableCredentialDecode decodes a JSON-encoded verifiable credential.

func (*VerifiableCredential) Created

func (c *VerifiableCredential) Created() int64

Created returns the unix timestamp (seconds) the credential was created.

func (*VerifiableCredential) Encode

func (c *VerifiableCredential) Encode() ([]byte, error)

Encode returns the JSON-encoded credential.

func (*VerifiableCredential) Issuer

func (c *VerifiableCredential) Issuer() *DIDAddress

Issuer returns the issuer DID address.

func (*VerifiableCredential) RevocationHashes

func (c *VerifiableCredential) RevocationHashes() ([][]byte, error)

RevocationHashes returns the revocation hashes of the credential, one per proof.

func (*VerifiableCredential) Signer

func (c *VerifiableCredential) Signer() (*DIDAddress, error)

Signer returns the DID address that signed the credential.

func (*VerifiableCredential) SigningKey

func (c *VerifiableCredential) SigningKey() (*SigningPublicKey, error)

SigningKey returns the signing key that signed the credential.

func (*VerifiableCredential) Subject

func (c *VerifiableCredential) Subject() *DIDAddress

Subject returns the subject DID address.

func (*VerifiableCredential) SubjectClaim

func (c *VerifiableCredential) SubjectClaim(key string) string

SubjectClaim returns a string claim about the subject, or "" if absent.

func (*VerifiableCredential) SubjectJSON

func (c *VerifiableCredential) SubjectJSON() []byte

SubjectJSON returns the subject claims as a raw JSON document, or nil.

func (*VerifiableCredential) TypeOf

func (c *VerifiableCredential) TypeOf() *TypeCollection

TypeOf returns the credential's type strings.

func (*VerifiableCredential) ValidFrom

func (c *VerifiableCredential) ValidFrom() int64

ValidFrom returns the unix timestamp (seconds) the credential is valid from.

func (*VerifiableCredential) ValidUntil

func (c *VerifiableCredential) ValidUntil() int64

ValidUntil returns the unix timestamp (seconds) the credential is valid until.

func (*VerifiableCredential) Validate

func (c *VerifiableCredential) Validate() error

Validate returns an error if the credential is invalid.

type VerifiablePresentation

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

VerifiablePresentation wraps a signed zktf_verifiable_presentation handle.

func VerifiablePresentationDecode

func VerifiablePresentationDecode(data []byte) (*VerifiablePresentation, error)

VerifiablePresentationDecode decodes a JSON-encoded verifiable presentation.

func (*VerifiablePresentation) Credentials

func (p *VerifiablePresentation) Credentials() []*VerifiableCredential

Credentials returns the credentials contained in the presentation.

func (*VerifiablePresentation) Encode

func (p *VerifiablePresentation) Encode() ([]byte, error)

Encode returns the JSON-encoded presentation.

func (*VerifiablePresentation) Holder

func (p *VerifiablePresentation) Holder() *DIDAddress

Holder returns the holder address, or nil.

func (*VerifiablePresentation) Types

func (p *VerifiablePresentation) Types() []string

Types returns the presentation's type strings.

func (*VerifiablePresentation) Validate

func (p *VerifiablePresentation) Validate() error

Validate returns an error if the presentation is invalid.

type VerificationAction

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

VerificationAction is a credential-verification request (issuer/verifier asking for proof a credential should be (re-)issued or verified).

func (*VerificationAction) AsAction

func (a *VerificationAction) AsAction() *Action

AsAction wraps this verification action into a generic Action (consuming it).

func (*VerificationAction) CredentialTypes

func (a *VerificationAction) CredentialTypes() []string

CredentialTypes returns the requested credential types.

func (*VerificationAction) Evidence

func (a *VerificationAction) Evidence() []*VerificationEvidence

Evidence returns the objects attached to the action as evidence.

func (*VerificationAction) Parameters

func (a *VerificationAction) Parameters() []*VerificationParameter

Parameters returns the typed parameters attached to the action.

func (*VerificationAction) Proof

Proof returns the verifiable presentations attached as proof.

type VerificationActionBuilder

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

VerificationActionBuilder builds a credential-verification action.

func NewVerificationActionBuilder

func NewVerificationActionBuilder() *VerificationActionBuilder

NewVerificationActionBuilder initializes a verification action builder.

func (*VerificationActionBuilder) CredentialType

CredentialType sets the requested credential types.

func (*VerificationActionBuilder) Evidence

func (b *VerificationActionBuilder) Evidence(evidenceType string, object *Object) *VerificationActionBuilder

Evidence attaches an object as supporting evidence under a named type.

func (*VerificationActionBuilder) Finish

Finish finalizes the verification action.

func (*VerificationActionBuilder) Parameter

Parameter attaches a typed key/value parameter.

func (*VerificationActionBuilder) Proof

Proof attaches a verifiable presentation as proof.

type VerificationEvidence

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

VerificationEvidence is an object attached to a verification action as supporting evidence, tagged with an evidence type.

func (*VerificationEvidence) EvidenceType

func (e *VerificationEvidence) EvidenceType() string

EvidenceType returns the evidence type tag.

func (*VerificationEvidence) Object

func (e *VerificationEvidence) Object() *Object

Object returns the object forming the evidence.

type VerificationParameter

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

VerificationParameter is a typed key/value parameter attached to a verification action.

func (*VerificationParameter) Key

func (p *VerificationParameter) Key() string

Key returns the parameter key.

func (*VerificationParameter) Value

func (p *VerificationParameter) Value() any

Value decodes the parameter value into a native Go type. See ParameterValue.Value for the supported types.

type VerificationResult

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

VerificationResult is the response to a credential-verification request.

func (*VerificationResult) Credentials

func (r *VerificationResult) Credentials() []*VerifiableCredential

Credentials returns the verifiable credentials carried in the result.

type VerificationResultBuilder

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

VerificationResultBuilder builds a credential-verification result.

func NewVerificationResultBuilder

func NewVerificationResultBuilder() *VerificationResultBuilder

NewVerificationResultBuilder initializes a verification result builder.

func (*VerificationResultBuilder) Credential

Credential adds a verifiable credential to the result.

func (*VerificationResultBuilder) Finish

Finish finalizes the verification result.

type WelcomeEvent

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

WelcomeEvent wraps a zktf_welcome wire event delivered to OnGroup.

func (*WelcomeEvent) CryptoWelcome

func (e *WelcomeEvent) CryptoWelcome() *CryptoWelcome

CryptoWelcome extracts the MLS welcome suitable for Account.Accept.

func (*WelcomeEvent) FromAddress

func (e *WelcomeEvent) FromAddress() *SigningPublicKey

FromAddress returns the sender's address.

func (*WelcomeEvent) Sequence

func (e *WelcomeEvent) Sequence() uint64

Sequence returns the event's sequence number.

func (*WelcomeEvent) Timestamp

func (e *WelcomeEvent) Timestamp() int64

Timestamp returns the event's unix timestamp.

func (*WelcomeEvent) ToAddress

func (e *WelcomeEvent) ToAddress() *SigningPublicKey

ToAddress returns the recipient address.

type WorkflowEvent

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

WorkflowEvent wraps a zktf_workflow_event delivered to on_workflow.

func (*WorkflowEvent) Attempt

func (e *WorkflowEvent) Attempt() uint32

Attempt returns the attempt number (for TaskFailed events).

func (*WorkflowEvent) Kind

func (e *WorkflowEvent) Kind() WorkflowEventKind

Kind returns the kind of workflow event.

func (*WorkflowEvent) Reason

func (e *WorkflowEvent) Reason() string

Reason returns a human-readable reason for the event, or "" if unset.

func (*WorkflowEvent) TaskID

func (e *WorkflowEvent) TaskID() []byte

TaskID returns the task id bytes (for TaskFailed events), or nil.

func (*WorkflowEvent) WillRetry

func (e *WorkflowEvent) WillRetry() bool

WillRetry reports whether the failed task will be retried.

func (*WorkflowEvent) WorkflowID

func (e *WorkflowEvent) WorkflowID() []byte

WorkflowID returns the workflow id bytes.

type WorkflowEventKind

type WorkflowEventKind uint32

WorkflowEventKind mirrors zktf_workflow_event_type.

const (
	WorkflowEventCompleted  WorkflowEventKind = C.WORKFLOW_EVENT_COMPLETED
	WorkflowEventTaskFailed WorkflowEventKind = C.WORKFLOW_EVENT_TASK_FAILED
)

Jump to

Keyboard shortcuts

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