response

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrorAlreadyInProgress is the status for when an auth or sign request with a personal number was sent,
	// but an order for the user is already in progress. The order is aborted. No order is created.
	ErrorAlreadyInProgress = ErrorCode("alreadyInProgress")
	// ErrorInvalidParameters is the status for when a invalid parameter was sent.
	ErrorInvalidParameters = ErrorCode("invalidParameters")
	// ErrorUnauthorized is the status for when RP does not have access to the service.
	ErrorUnauthorized = ErrorCode("unauthorized")
	// ErrorNotFound is the status for when an erroneous URL path was used.
	ErrorNotFound = ErrorCode("notFound")
	// ErrorMethodNotAllowed is the status for when an invalid method was used. Only http method POST is allowed.
	ErrorMethodNotAllowed = ErrorCode("methodNotAllowed")
	// ErrorRequestTimeout is the status for when it took to long time to transmit a request.
	ErrorRequestTimeout = ErrorCode("requestTimeout")
	// ErrorUnsupportedMediaType is the status for when an unsupported media type was provided.
	ErrorUnsupportedMediaType = ErrorCode("unsupportedMediaType")
	// ErrorInternalError is the status for when an internal technical error has occurred in the BankID system.
	ErrorInternalError = ErrorCode("internalError")
	// ErrorMaintenance is the status for when the BankID RP API is temporarily unavailable.
	ErrorMaintenance = ErrorCode("maintenance")
)
View Source
const (
	// HintCodeOutstandingTransaction is the hint for a order that is pending. The client has not yet received the order.
	// The hintCode will later change to noClient, started or userSign.
	HintCodeOutstandingTransaction = HintCode("outstandingTransaction")
	// HintCodeNoClient is the hint for a order that is pending. The client has not yet received the order.
	HintCodeNoClient = HintCode("noClient")
	// HintCodeStarted is the hint for a order that is pending. A Client has started with the 'autostarttoken'
	// but a usable ID has not yet been found in the started client.
	// When the client start the may be a short delay until all ID:s are registered.
	// The User may not have any usable ID:s at all, or has not yet inserted their smart card.
	HintCodeStarted = HintCode("started")
	// HintCodeUserSign is the hint for a order that is pending. A client has received the order.
	HintCodeUserSign = HintCode("userSign")
	// HintCodeExpiredTransaction is the hint for a order that has expired.
	HintCodeExpiredTransaction = HintCode("expiredTransaction")
	// HintCodeCertificateError is a hint for when the provided certificate is invalid.
	HintCodeCertificateError = HintCode("certificateErr")
	// HintCodeUserCancel is a hint for when a User has cancelled an order.
	HintCodeUserCancel = HintCode("userCancel")
	// HintCodeCancelled is a hint for a order that has been cancelled.
	HintCodeCancelled = HintCode("cancelled")
	// HintCodeStartFailed is a hint for when an order could not be initialized.
	HintCodeStartFailed = HintCode("startFailed")
)
View Source
const (
	// StatusPending is the status of a pending order. hintCode describes the status of the order.
	StatusPending = Status("pending")
	// StatusComplete is the status of a complete order. CompletionData holds User information.
	StatusComplete = Status("complete")
	// StatusFailed is the status of a failed order. hintCode describes the error.
	StatusFailed = Status("failed")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticateResponse

type AuthenticateResponse struct {
	// Used as reference to this order when the client is started automatically.
	AutoStartToken string `json:"autoStartToken"`
	// Used to collect the status of the order.
	OrderRef string `json:"orderRef"`
	// Used to compute the animated QR code.
	QrStartToken string `json:"qrStartToken"`
	// Used to compute the animated QR code.
	QrStartSecret string `json:"qrStartSecret"`
	// The time when response was returned.
	TimeOfResponse time.Time
}

AuthenticateResponse contains the fields specific for the authentication api response.

func (*AuthenticateResponse) OnDecode

func (a *AuthenticateResponse) OnDecode()

OnDecode is called on decode.

func (*AuthenticateResponse) String

func (a *AuthenticateResponse) String() string

type CancelResponse

type CancelResponse struct{}

CancelResponse contains fields for the cancel api response.

func (*CancelResponse) OnDecode

func (c *CancelResponse) OnDecode()

OnDecode is called on decode.

type Cert

type Cert struct {
	// Start of validity of the users BankID.
	NotBefore string `json:"notBefore"`
	// End of validity of the Users BankID.
	NotAfter string `json:"notAfter"`
}

Cert holds information related to the certificate.

type CollectResponse

type CollectResponse struct {
	OrderRef       string         `json:"orderRef"`
	Status         Status         `json:"status"`
	HintCode       string         `json:"hintCode"`
	CompletionData CompletionData `json:"CompletionData"`
}

CollectResponse contains the fields specific for the collect api response.

func (CollectResponse) IsComplete

func (c CollectResponse) IsComplete() bool

IsComplete return true if the order is complete. CompletionData holds User information.

func (CollectResponse) IsFailed

func (c CollectResponse) IsFailed() bool

IsFailed return true if something went wrong with the order. hintCode describes the error.

func (CollectResponse) IsPending

func (c CollectResponse) IsPending() bool

IsPending return true if the order is being processed. hintCode describes the status of the order.

func (*CollectResponse) OnDecode

func (c *CollectResponse) OnDecode()

OnDecode is called on decode.

func (CollectResponse) String

func (c CollectResponse) String() string

type CompletionData

type CompletionData struct {
	// Information related to the User
	User User `json:"user"`
	// Information related to the Device
	Device Device `json:"device"`
	// The date the BankID was issued to the user
	BankIDIssueDate time.Time `json:"bankIdIssueDate"`
	// Information about extra verifications that were part of the transaction.
	StepUp bool `json:"stepUp"`
	// The content of the signature is described in BankID Signature Profile specification. String. Base64-encoded
	Signature string `json:"signature"`
	// The OCSP response. String. Base64-encoded. The OCSP response is signed by a certificate that has the same issuer
	// as the certificate being verified. The OSCP response has an extension for Nonce
	OcspResponse string `json:"ocspResponse"`
}

CompletionData holds the final state of an order.

type Device

type Device struct {
	// The IP address of the User agent as the BankID server discovers it.
	IPAddress string `json:"ipAddress"`
	// Unique hardware identifier for the user’s device.
	UHI string `json:"uhi"`
}

Device holds information related to the device.

type ErrorCode

type ErrorCode string

ErrorCode corresponds to an error code returned by the RP API.

type HintCode

type HintCode string

HintCode corresponds to a hint code returned by the collect endpoint.

type PhoneAuthenticateResponse

type PhoneAuthenticateResponse struct {
	// Used to collect the status of the order.
	OrderRef string `json:"orderRef"`
}

PhoneAuthenticateResponse contains the fields specific for the phone authentication api response.

func (*PhoneAuthenticateResponse) OnDecode

func (a *PhoneAuthenticateResponse) OnDecode()

OnDecode is called on decode.

func (*PhoneAuthenticateResponse) String

func (a *PhoneAuthenticateResponse) String() string

type PhoneSignResponse

type PhoneSignResponse struct {
	PhoneAuthenticateResponse
}

PhoneSignResponse contains the fields specific for the phone sign api response.

func (*PhoneSignResponse) OnDecode

func (s *PhoneSignResponse) OnDecode()

OnDecode is called on decode.

type SignResponse

type SignResponse struct {
	AuthenticateResponse
}

SignResponse contains the fields specific for the sign api response.

func (*SignResponse) OnDecode

func (s *SignResponse) OnDecode()

OnDecode is called on decode.

type Status

type Status string

Status corresponds to a status of an order.

type User

type User struct {
	// The personal number
	PersonalNumber string `json:"personalNumber"`
	// The given name and surname of the User
	Name string `json:"name"`
	// The given name of the User
	GivenName string `json:"givenName"`
	// The surname of the User
	Surname string `json:"surname"`
}

User holds information related to the user.

Jump to

Keyboard shortcuts

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