File: blackhole.go

package info (click to toggle)
golang-github-smallstep-crypto 0.57.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 3,284 kB
  • sloc: sh: 53; makefile: 36
file content (21 lines) | stat: -rw-r--r-- 579 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package storage

import "context"

// BlackHole returns a [FeedthroughStore] without a backing
// storage, effectively resulting in no persistence. Note
// that some operations do require persistence, in which
// case [ErrNoStorageConfigured] will be returned by the
// [FeedthroughStore].
func BlackHole() TPMStore {
	return NewFeedthroughStore(nil)
}

// BlackholeContext adds a new BlackHole storage to the context.
func BlackHoleContext(ctx context.Context) context.Context {
	if ctx == nil {
		ctx = context.Background()
	}
	ctx = NewContext(ctx, BlackHole())
	return ctx
}