storage

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package storage provides in-memory implementations of every store interface the issuer package defines (NonceStore, CredentialOfferStore, DeferredTransactionStore, NotificationStore, PreAuthorizedCodeStore, DPoPNonceStore, DPoPReplayChecker) — for local development and testing only. Never production.

Every type here is non-durable (an in-process map, gone on restart) and grows unboundedly for the life of the process — there is no expiry-driven garbage collection. That's fine for a short local development session; it is not fine for anything long-running.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CredentialOfferStore

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

CredentialOfferStore is an in-memory issuer.CredentialOfferStore. See the package doc comment for why this is development/testing only.

func NewCredentialOfferStore

func NewCredentialOfferStore() *CredentialOfferStore

NewCredentialOfferStore builds an empty CredentialOfferStore.

func (*CredentialOfferStore) Get

Get implements issuer.CredentialOfferStore.

func (*CredentialOfferStore) Store

Store implements issuer.CredentialOfferStore.

type DPoPNonceStore

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

DPoPNonceStore is an in-memory issuer.DPoPNonceStore. See the package doc comment for why this is development/testing only.

func NewDPoPNonceStore

func NewDPoPNonceStore() *DPoPNonceStore

NewDPoPNonceStore builds an empty DPoPNonceStore.

func (*DPoPNonceStore) Consume

Consume implements issuer.DPoPNonceStore. Deleting the map entry on every call — whether or not it was present — is what makes this single-use: a second Consume of the same nonce always finds nothing.

func (*DPoPNonceStore) Issue

Issue implements issuer.DPoPNonceStore.

type DPoPReplayChecker

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

DPoPReplayChecker is an in-memory issuer.DPoPReplayChecker: it remembers every "jti" UseOnce has ever seen and rejects a repeat, per RFC 9449 §11.1's own "MUST reject any DPoP proof in which the jti has been seen before". expiresAt is accepted only to satisfy the interface — this store never evicts an entry, so a jti is rejected as reused indefinitely, past its own DPoP proof's validity window. See the package doc comment for why that's development/ testing only.

func NewDPoPReplayChecker

func NewDPoPReplayChecker() *DPoPReplayChecker

NewDPoPReplayChecker builds an empty DPoPReplayChecker.

func (*DPoPReplayChecker) UseOnce

func (s *DPoPReplayChecker) UseOnce(_ context.Context, jti string, _ time.Time) error

UseOnce implements issuer.DPoPReplayChecker.

type DeferredTransactionStore

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

DeferredTransactionStore is an in-memory issuer.DeferredTransactionStore. See the package doc comment for why this is development/testing only.

issuer.DeferredTransactionStore only defines Get/Invalidate — by design, issuer never creates or resolves a Deferred Issuance transaction itself (see issuer.DeferredTransactionRecord's own doc comment). Put is this store's own extra method, for whatever stands in here for that business process: call it once to create a transaction (ordinarily DeferredTransactionPending), and again, later, to move it to DeferredTransactionIssued or DeferredTransactionDenied.

func NewDeferredTransactionStore

func NewDeferredTransactionStore() *DeferredTransactionStore

NewDeferredTransactionStore builds an empty DeferredTransactionStore.

func (*DeferredTransactionStore) Get

Get implements issuer.DeferredTransactionStore.

func (*DeferredTransactionStore) Invalidate

func (s *DeferredTransactionStore) Invalidate(_ context.Context, transactionID string) error

Invalidate implements issuer.DeferredTransactionStore.

func (*DeferredTransactionStore) Put

Put creates or replaces the transaction identified by transactionID. It also un-invalidates transactionID, so a caller can reuse an invalidated transaction_id for a fresh transaction, though in practice each transaction_id should be its own unique, unguessable value.

type NonceStore

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

NonceStore is an in-memory issuer.NonceStore. See the package doc comment for why this is development/testing only.

func NewNonceStore

func NewNonceStore() *NonceStore

NewNonceStore builds an empty NonceStore.

func (*NonceStore) Consume

func (s *NonceStore) Consume(_ context.Context, consumption issuer.NonceConsumption) (issuer.NonceRecord, error)

Consume implements issuer.NonceStore. Deleting the map entry on every call — whether or not it was present — is what makes this single-use: a second Consume of the same nonce always finds nothing.

func (*NonceStore) Issue

func (s *NonceStore) Issue(_ context.Context, issuance issuer.NonceIssuance) error

Issue implements issuer.NonceStore.

type NotificationStore

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

NotificationStore is an in-memory issuer.NotificationStore. See the package doc comment for why this is development/testing only.

func NewNotificationStore

func NewNotificationStore() *NotificationStore

NewNotificationStore builds an empty NotificationStore.

func (*NotificationStore) Get

func (s *NotificationStore) Get(_ context.Context, notificationID string) (issuer.NotificationRecord, error)

Get implements issuer.NotificationStore.

func (*NotificationStore) Issue

func (s *NotificationStore) Issue(_ context.Context, notificationID string, record issuer.NotificationRecord) error

Issue implements issuer.NotificationStore.

type PreAuthorizedCodeStore

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

PreAuthorizedCodeStore is an in-memory issuer.PreAuthorizedCodeStore. See the package doc comment for why this is development/testing only.

func NewPreAuthorizedCodeStore

func NewPreAuthorizedCodeStore() *PreAuthorizedCodeStore

NewPreAuthorizedCodeStore builds an empty PreAuthorizedCodeStore.

func (*PreAuthorizedCodeStore) Consume

Consume implements issuer.PreAuthorizedCodeStore. Deleting the map entry on every call — whether or not it was present — is what makes this single-use: a second Consume of the same code always finds nothing, the same shape NonceStore.Consume already establishes.

func (*PreAuthorizedCodeStore) Issue

Issue implements issuer.PreAuthorizedCodeStore.

Jump to

Keyboard shortcuts

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