jws

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	Alg string   `json:"alg"`
	X5C []string `json:"x5c"`
}

Header JWSDecodedHeader https://developer.apple.com/documentation/appstoreserverapi/jwsdecodedheader

func (*Header) Certificate

func (h *Header) Certificate(index int) (*x509.Certificate, error)

Certificate 从 header x5c 证书链中获取证书 依次是:

  • Certificate(0) Apple leaf certificate
  • Certificate(1) Apple intermediate certificate
  • Certificate(2) Apple root certificate

func (*Header) Verify

func (h *Header) Verify() (*ecdsa.PublicKey, error)

Verify 验证 x5c 证书链,并返回用于 jws 签名的公钥

type JWS

type JWS struct {
	Header *Header
	// contains filtered or unexported fields
}

JWS App Store in JSON Web Signature (JWS) format

func Parse

func Parse(token string) (*JWS, error)

Parse return JWS by app store jws token

func (*JWS) VerifyAndBind

func (jws *JWS) VerifyAndBind(claims jwt.Claims) error

VerifyAndBind 验证 jsw 签名及 x5c 证书链,并绑定 jws payload 到 claims

type claims struct {
	jwt.RegisteredClaims
	CustomClaims
}

Jump to

Keyboard shortcuts

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