passkeyexample

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package passkeyexample demonstrates application-owned credential persistence. Package passkeyexample 演示应用自行管理的凭据持久化。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	DB   *pgxpool.Pool
	RPID string
}

Store uses schema.sql. The application owns DB and fixes RPID at construction. Store 使用 schema.sql。应用负责 DB 生命周期,并在构造时固定 RPID。

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, id, userID string) (bool, error)

Delete removes only the requested user's credential. Delete 仅删除指定用户的凭据。

func (*Store) Get

func (s *Store) Get(ctx context.Context, id string) (passkey.Credential, bool, error)

Get loads a credential by its base64url ID. Get 按 base64url ID 加载凭据。

func (*Store) Insert

func (s *Store) Insert(ctx context.Context, c passkey.Credential) error

Insert preserves credential ownership by rejecting duplicate IDs. Insert 拒绝重复 ID,保证凭据归属不变。

func (*Store) List

func (s *Store) List(ctx context.Context, id string) ([]passkey.Credential, error)

List loads credentials for one user. List 加载单个用户的凭据。

func (*Store) Rename

func (s *Store) Rename(ctx context.Context, id, userID, name string) (bool, error)

Rename updates only the requested user's credential. Rename 仅修改指定用户的凭据。

func (*Store) UpdateUsage

func (s *Store) UpdateUsage(ctx context.Context, id, userID string, a webauthn.Authenticator, flags webauthn.CredentialFlags, at time.Time) (bool, error)

UpdateUsage locks the existing row and preserves its key, owner, and name. UpdateUsage 锁定现有记录,并保留其密钥、所有者和名称。

Jump to

Keyboard shortcuts

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