Documentation
¶
Index ¶
Constants ¶
View Source
const MaxClockSkew = 5 * time.Minute
MaxClockSkew は許容する Date のずれ。リプレイの窓を狭めるためで、 Mastodon も同程度の値を使う。
Variables ¶
View Source
var ErrNoSignature = errors.New("request has no http signature")
ErrNoSignature は Signature ヘッダが無いことを表す。呼び出し側が 「署名されていない」と「署名が壊れている」を区別できるようにしてある。
Functions ¶
func CurrentTime ¶
func CurrentTime() string
CurrentTime は HTTP の Date ヘッダ用の書式を返す。ActivityStreams の published は ISO8601 なので、こちらを流用してはならない。
func KeyIDFromRequest ¶
KeyIDFromRequest は Signature ヘッダから keyId を取り出す。公開鍵を どこから引くか (キャッシュか actor 取得か) は呼び出し側が決めるため、 検証本体とは分けてある。
func ParsePublicKey ¶
ParsePublicKey は actor の publicKeyPem を読む。ほとんどの実装は PKIX (BEGIN PUBLIC KEY) を出すが、PKCS#1 (BEGIN RSA PUBLIC KEY) を出すものも あるので両方受ける。
Types ¶
Click to show internal directories.
Click to hide internal directories.