dscursor

package
v0.0.0-...-110cdec Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package dscursor contains a set of utilities that help performing common tasks associated with datastore.Cursor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Vault

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

Vault is a utility type that can convert datastore.Cursor to/from an encrypted, URL safe page token. It uses AEAD to ensure that 1. potential sensitive information contained in the cursor is not leaked. 2. user can not use a page token that is not generated by the server.

func NewVault

func NewVault(additionalData []byte) Vault

NewVault creates a new page token vault with the specified additional data.

Notes: * server/secrets module must be initialized with PrimaryTinkAEADKey during server start up. * The additionalData is used for encryption. Vaults used in different places should have different additional data.

func (*Vault) Cursor

func (v *Vault) Cursor(ctx context.Context, pageToken string) (datastore.Cursor, error)

Cursor converts a page token to a datastore.Cursor. Returns pagination.ErrInvalidPageToken if the token is malformed or can't be decrypted and secrets.ErrNoPrimaryAEAD if the encryption key is not configured.

func (*Vault) PageToken

func (v *Vault) PageToken(ctx context.Context, cursor datastore.Cursor) (string, error)

PageToken converts a datastore.Cursor to an encrypted, URL safe page token.

Jump to

Keyboard shortcuts

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