assertions

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package assertions is used for signing assertions that are used when authenticating with a data holder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SingleKeySigner

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

SingleKeySigner can sign assertions with a single pub private key.

func NewSignerFromEnv

func NewSignerFromEnv() (*SingleKeySigner, error)

NewSignerFromEnv creates a new signer from environment variables.

CDR_SIGNER_KID
CDR_SIGNER_PRIVATE_KEY

func NewSingleKeySigner

func NewSingleKeySigner(kid string, pk []byte) (*SingleKeySigner, error)

NewSingleKeySigner creates a new single key signer.

kid := "fiskil_kid_sig"
privKey := []byte(`-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIIrYSSNQFaA2Hwf1duRSxKtLYX5CB04fSeQ6tF1aY/PuoAoGCCqGSM49
AwEHoUQDQgAEPR3tU2Fta9ktY+6P9G0cWO+0kETA6SFs38GecTyudlHz6xvCdz8q
EKTcWGekdmdDPsHloRNtsiCa697B2O9IFA==
-----END EC PRIVATE KEY-----`)

signer, err := assertions.NewSingleKeySigner(kid, privKey)

func (*SingleKeySigner) ClientAssertions

func (s *SingleKeySigner) ClientAssertions(sub string, aud string) (string, error)

ClientAssertions generates and signs client assertions used to authenticate against a bank.

The sub field is (normally) your data holder specific client id. While the audience will be the endpoint your are requesting from.

signer := cdr.NewSingleKeySignerFromEnv()
token, err := signer.ClientAssertions("my-client-id-with-bank-australia", "https://identity-mtls.cdr-api.bankaust.com.au/par")

func (*SingleKeySigner) GenerateToken

func (s *SingleKeySigner) GenerateToken(claims jwt.Claims) (string, error)

GenerateToken generates a signed JWT token string representing the user Claims.

Jump to

Keyboard shortcuts

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