jwx_repository

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: MIT Imports: 8 Imported by: 4

README

概要

JWK の生成、取得、削除を行う関数定義

想定テーブル構造

create table jwk (
    id char(21) primary key comment "キーID",
    jwk blob not null comment "JWK",
    expired_at datetime not null comment "有効期限"
) comment = "JWK";

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 対象リソースが存在しない
	NotFoundError = errors.New("Not Found")
	// DB関連のエラー
	DBError = errors.New("DB error")
	// JWK作成に失敗
	CreateJWKError = errors.New("Create JWK failed")
)

Functions

func CreateKey

func CreateKey() (jwk.Key, error)

Types

type JWK

type JWK struct {
	ID        string
	JWK       []byte
	ExpiredAt time.Time
}

func (*JWK) ConvertToJwkKey

func (j *JWK) ConvertToJwkKey() (jwk.Key, error)

type JWKRepository

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

func NewJWKRepository

func NewJWKRepository(db *sql.DB) *JWKRepository

func (*JWKRepository) Create

func (r *JWKRepository) Create(now time.Time) error

func (*JWKRepository) DeleteOldKey

func (r *JWKRepository) DeleteOldKey(now time.Time) error

func (*JWKRepository) GetLatestKey

func (r *JWKRepository) GetLatestKey(now time.Time) (*JWK, error)

func (*JWKRepository) GetValidKeySet

func (r *JWKRepository) GetValidKeySet(now time.Time) (jwk.Set, error)

Jump to

Keyboard shortcuts

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