Documentation
¶
Overview ¶
Package business_unit implement the management functions of business unit.
Index ¶
- Variables
- func ValidateAddAuthenticationRequest(req AddAuthenticationRequest) error
- func ValidateCreateBusinessUnitRequest(req CreateBusinessUnitRequest) error
- func ValidateListAuthenticationRequest(req storage.ListAuthenticationRequest) error
- func ValidateListBusinessUnitRequest(req storage.ListBusinessUnitsRequest) error
- func ValidateRevokeAuthenticationRequest(req RevokeAuthenticationRequest) error
- func ValidateSetBusinessUnitStatusRequest(req SetBusinessUnitStatusRequest) error
- func ValidateUpdateBusinessUnitRequest(req UpdateBusinessUnitRequest) error
- type AddAuthenticationRequest
- type BusinessUnitManager
- type CreateBusinessUnitRequest
- type ECDSAEncryptor
- type ECDSASigner
- type GetJWEEncryptorsRequest
- type GetJWSSignerRequest
- type JWEEncryptor
- type JWSSigner
- type JWTFactory
- type RSAEncryptor
- type RSASigner
- type RevokeAuthenticationRequest
- type SetBusinessUnitStatusRequest
- type UpdateBusinessUnitRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultJWTFactory = _JWTFactory{}
Functions ¶
func ValidateAddAuthenticationRequest ¶
func ValidateAddAuthenticationRequest(req AddAuthenticationRequest) error
func ValidateCreateBusinessUnitRequest ¶
func ValidateCreateBusinessUnitRequest(req CreateBusinessUnitRequest) error
func ValidateListAuthenticationRequest ¶
func ValidateListAuthenticationRequest(req storage.ListAuthenticationRequest) error
func ValidateListBusinessUnitRequest ¶
func ValidateListBusinessUnitRequest(req storage.ListBusinessUnitsRequest) error
func ValidateRevokeAuthenticationRequest ¶
func ValidateRevokeAuthenticationRequest(req RevokeAuthenticationRequest) error
func ValidateSetBusinessUnitStatusRequest ¶
func ValidateSetBusinessUnitStatusRequest(req SetBusinessUnitStatusRequest) error
func ValidateUpdateBusinessUnitRequest ¶
func ValidateUpdateBusinessUnitRequest(req UpdateBusinessUnitRequest) error
Types ¶
type AddAuthenticationRequest ¶
type AddAuthenticationRequest struct { Requester string `json:"requester"` // User who makes the request. ApplicationID string `json:"application_id"` // The ID of the application this BusinessUnit belongs to. BusinessUnitID did.DID `json:"id"` // Unique DID of a BusinessUnit. PrivateKeyOption eblpkix.PrivateKeyOption `json:"private_key_option"` // Option of the private key. }
AddAuthenticationRequest is the request to add an authentication to a business unit.
type BusinessUnitManager ¶
type BusinessUnitManager interface { CreateBusinessUnit(ctx context.Context, ts int64, req CreateBusinessUnitRequest) (model.BusinessUnit, error) UpdateBusinessUnit(ctx context.Context, ts int64, req UpdateBusinessUnitRequest) (model.BusinessUnit, error) ListBusinessUnits(ctx context.Context, req storage.ListBusinessUnitsRequest) (storage.ListBusinessUnitsResult, error) SetStatus(ctx context.Context, ts int64, req SetBusinessUnitStatusRequest) (model.BusinessUnit, error) AddAuthentication(ctx context.Context, ts int64, req AddAuthenticationRequest) (model.BusinessUnitAuthentication, error) RevokeAuthentication(ctx context.Context, ts int64, req RevokeAuthenticationRequest) (model.BusinessUnitAuthentication, error) ListAuthentication(ctx context.Context, req storage.ListAuthenticationRequest) (storage.ListAuthenticationResult, error) GetJWSSigner(ctx context.Context, req GetJWSSignerRequest) (JWSSigner, error) GetJWEEncryptors(ctx context.Context, req GetJWEEncryptorsRequest) ([]JWEEncryptor, error) // ActivateAuthentication activates an authentication of a business unit with its certificate. // This function is NOT for REST API. // The returned error can be model.ErrAuthenticationNotFound, model.ErrAuthenticationNotPending, model.ErrInvalidParameter or any other errors. ActivateAuthentication(ctx context.Context, ts int64, certRaw []byte) (model.BusinessUnitAuthentication, error) // UpdateAuthenticationByExternalEvent updates an authentication by an external event from the relay network. UpdateAuthenticationByExternalEvent(ctx context.Context, ts int64, signedEvt envelope.JWS) error // UpdateBusinessUnitByExternalEvent updates a business unit by an external event from the relay network. UpdateBusinessUnitByExternalEvent(ctx context.Context, ts int64, signedEvt envelope.JWS) error }
BusinessUnitManager is the interface that wraps the basic management functions of business unit.
func NewBusinessUnitManager ¶
func NewBusinessUnitManager(storage storage.BusinessUnitStorage, cv cert.CertVerifier, webhookCtrl webhook.WebhookController, jwtFactory JWTFactory) BusinessUnitManager
type CreateBusinessUnitRequest ¶
type CreateBusinessUnitRequest struct { Requester string `json:"requester"` // User who makes the request. ApplicationID string `json:"application_id"` // The ID of the application this BusinessUnit belongs to. Name string `json:"name"` // Name of the BusinessUnit. Addresses []string `json:"addresses"` // List of addresses associated with the BusinessUnit. Country string `json:"country"` // Country Code of the BusinessUnit. (Eg: US, TW, JP) Emails []string `json:"emails"` // List of emails associated with the BusinessUnit. PhoneNumbers []string `json:"phone_numbers"` // List of phone numbers associated with the BusinessUnit. Status model.BusinessUnitStatus `json:"status"` // Status of the application. }
CreateBusinessUnitRequest is the request to create a business unit.
type ECDSAEncryptor ¶
type ECDSAEncryptor struct {
// contains filtered or unexported fields
}
func (*ECDSAEncryptor) AvailableJWEEncryptAlgorithms ¶
func (s *ECDSAEncryptor) AvailableJWEEncryptAlgorithms() []envelope.KeyEncryptionAlgorithm
func (*ECDSAEncryptor) Public ¶
func (s *ECDSAEncryptor) Public() crypto.PublicKey
type ECDSASigner ¶
type ECDSASigner struct {
// contains filtered or unexported fields
}
func (*ECDSASigner) AvailableJWSSignAlgorithms ¶
func (s *ECDSASigner) AvailableJWSSignAlgorithms() []envelope.SignatureAlgorithm
func (*ECDSASigner) Cert ¶
func (s *ECDSASigner) Cert() []*x509.Certificate
func (*ECDSASigner) Public ¶
func (s *ECDSASigner) Public() crypto.PublicKey
func (*ECDSASigner) Sign ¶
func (s *ECDSASigner) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error)
type GetJWEEncryptorsRequest ¶
type GetJWEEncryptorsRequest struct {
BusinessUnitIDs []string `json:"ids"` // Unique DID of a BusinessUnit.
}
type GetJWSSignerRequest ¶
type JWEEncryptor ¶
type JWEEncryptor interface { Public() crypto.PublicKey AvailableJWEEncryptAlgorithms() []envelope.KeyEncryptionAlgorithm }
type JWSSigner ¶
type JWSSigner interface { // Public returns the public key corresponding to the opaque, // private key. Public() crypto.PublicKey // Sign signs digest with the private key, possibly using entropy from // rand. For an RSA key, the resulting signature should be either a // PKCS #1 v1.5 or PSS signature (as indicated by opts). For an (EC)DSA // key, it should be a DER-serialised, ASN.1 signature structure. // // Hash implements the SignerOpts interface and, in most cases, one can // simply pass in the hash function used as opts. Sign may also attempt // to type assert opts to other types in order to obtain algorithm // specific values. See the documentation in each package for details. // // Note that when a signature of a hash of a larger message is needed, // the caller is responsible for hashing the larger message and passing // the hash (as digest) and the hash function (as opts) to Sign. Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error) AvailableJWSSignAlgorithms() []envelope.SignatureAlgorithm Cert() []*x509.Certificate }
type JWTFactory ¶
type JWTFactory interface { NewJWSSigner(authentication model.BusinessUnitAuthentication) (JWSSigner, error) NewJWEEncryptor(authentication model.BusinessUnitAuthentication) (JWEEncryptor, error) }
type RSAEncryptor ¶
type RSAEncryptor struct {
// contains filtered or unexported fields
}
func (*RSAEncryptor) AvailableJWEEncryptAlgorithms ¶
func (s *RSAEncryptor) AvailableJWEEncryptAlgorithms() []envelope.KeyEncryptionAlgorithm
func (*RSAEncryptor) Public ¶
func (s *RSAEncryptor) Public() crypto.PublicKey
type RSASigner ¶
type RSASigner struct {
// contains filtered or unexported fields
}
func (*RSASigner) AvailableJWSSignAlgorithms ¶
func (s *RSASigner) AvailableJWSSignAlgorithms() []envelope.SignatureAlgorithm
func (*RSASigner) Cert ¶
func (s *RSASigner) Cert() []*x509.Certificate
type RevokeAuthenticationRequest ¶
type RevokeAuthenticationRequest struct { Requester string `json:"requester"` // User who makes the request. ApplicationID string `json:"application_id"` // The ID of the application this BusinessUnit belongs to. BusinessUnitID did.DID `json:"id"` // Unique DID of a BusinessUnit. AuthenticationID string `json:"authentication_id"` // Unique ID of the authentication. }
RevokeAuthenticationRequest is the request to revoke an authentication from a business unit.
type SetBusinessUnitStatusRequest ¶
type SetBusinessUnitStatusRequest struct { Requester string `json:"requester"` // User who makes the request. ApplicationID string `json:"application_id"` // The ID of the application this BusinessUnit belongs to. ID did.DID `json:"id"` // Unique DID of a BusinessUnit. Status model.BusinessUnitStatus `json:"status"` // Status of the application. }
SetBusinessUnitStatusRequest is the request to set the status of a business unit.
type UpdateBusinessUnitRequest ¶
type UpdateBusinessUnitRequest struct { Requester string `json:"requester"` // User who makes the request. ApplicationID string `json:"application_id"` // The ID of the application this BusinessUnit belongs to. ID did.DID `json:"id"` // Unique DID of a BusinessUnit. Name string `json:"name"` // Name of the BusinessUnit. Addresses []string `json:"addresses"` // List of addresses associated with the BusinessUnit. Country string `json:"country"` // Country Code of the BusinessUnit. (Eg: US, TW, JP) Emails []string `json:"emails"` // List of emails associated with the BusinessUnit. PhoneNumbers []string `json:"phone_numbers"` // List of phone numbers associated with the BusinessUnit. }
UpdateBusinessUnitRequest is the request to update a business unit.
Click to show internal directories.
Click to hide internal directories.