Documentation ¶
Index ¶
- func B64ToInterface(input string, output interface{}) error
- func CurrentTimestamp() uint64
- func InterfaceToB64(artifact interface{}) (string, error)
- func JwtToB64(jwt interface{}) (string, string, error)
- func SplitJWT(signedJWT string) (string, string, string, error)
- func ValidateAICPayload(payload *AICPayload) error
- func ValidateASPayload(payload *ASPayload) error
- func ValidateATPayload(payload *ATPayload) error
- func ValidateCredentialPayload(payload *CredentialPayload) error
- func ValidateExpiresAt(exp *uint64) error
- func ValidateHeader(header *alaTypes.Header) error
- func ValidateIssuedAt(iat *uint64) error
- func ValidateNotBefore(nbf *uint64) error
- func ValidatePRPayload(payload *PRPayload) error
- func ValidatePresentationPayload(payload *PresentationPayload) error
- func ValidateTimestamps(iat *uint64, exp *uint64, nbf *uint64) error
- type AIC
- type AICPayload
- type AS
- type ASPayload
- type AT
- type ATPayload
- type AlastriaJWT
- type Credential
- type CredentialPayload
- type CredentialPayloadVC
- type PR
- type PRPayload
- type PRPayloadVP
- type PRPayloadVPData
- type Presentation
- type PresentationPayload
- type PresentationPayloadVP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func B64ToInterface ¶
func CurrentTimestamp ¶
func CurrentTimestamp() uint64
func InterfaceToB64 ¶
func ValidateAICPayload ¶
func ValidateAICPayload(payload *AICPayload) error
Validates the AIC according to the specification https://github.com/alastria/alastria-identity/wiki/Artifacts-and-User-Stories-Definitions#03-alastria-identity-creation-aic Sets default values if they are empty and they are required
func ValidateASPayload ¶
Validates the AlastriaSession according to the specification https://github.com/alastria/alastria-identity/wiki/Artifacts-and-User-Stories-Definitions#02-alastria-session-as Sets default values if they are empty and they are required
func ValidateATPayload ¶
Validates the AlastriaToken according to the specification https://github.com/alastria/alastria-identity/wiki/Artifacts-and-User-Stories-Definitions#01-alastria-token-at Sets default values if they are empty and they are required
func ValidateCredentialPayload ¶
func ValidateCredentialPayload(payload *CredentialPayload) error
Validates the Credential according to the specification https://github.com/alastria/alastria-identity/wiki/Alastria-DID-Method-Specification-(Quorum-version)#3-credentials Sets default values if they are empty and they are required
func ValidateExpiresAt ¶
func ValidateHeader ¶
Validates that the header is valid following the specification found here: https://github.com/alastria/alastria-identity/wiki/Artifacts-and-User-Stories-Definitions#0-artifacts-definition Sets default values to header.Type and header.Algorithm if they are empty. If header.Type or header.Algorithm are invalid also throws an error.
func ValidateIssuedAt ¶
func ValidateNotBefore ¶
func ValidatePRPayload ¶
Validates the PresentationRequest according to the specification https://github.com/alastria/alastria-identity/wiki/Alastria-DID-Method-Specification-(Quorum-version)#5-presentation-request Sets default values if they are empty and they are required
func ValidatePresentationPayload ¶
func ValidatePresentationPayload(payload *PresentationPayload) error
Validates the Presentation according to the specification https://github.com/alastria/alastria-identity/wiki/Alastria-DID-Method-Specification-(Quorum-version)#4-presentation Sets default values if they are empty and they are required
Types ¶
type AIC ¶
type AIC struct { Header *alaTypes.Header `json:"header,omitempty"` Payload *AICPayload `json:"payload,omitempty"` }
func CreateAlastriaIdentityCreation ¶
func CreateAlastriaIdentityCreation(header *alaTypes.Header, payload *AICPayload) (*AIC, error)
Validates the AIC according to the specification Header: https://github.com/alastria/alastria-identity/wiki/Artifacts-and-User-Stories-Definitions#0-artifacts-definition Payload: https://github.com/alastria/alastria-identity/wiki/Artifacts-and-User-Stories-Definitions#03-alastria-identity-creation-aic The validation with timestamp will be done with the machine timestamp. This can cause a problem, if the time is not syncronize. Sets default values if they are empty and they are required Returns an error if a mandatory field is empty Mandatory fields are: payload.AlastriaToken, payload.CreateAlastriaTX and payload.PublicKey
type AICPayload ¶
type AICPayload struct { IssuedAt uint64 `json:"iat,omitempty"` ExpiresAt uint64 `json:"exp,omitempty"` NotBefore uint64 `json:"nbf,omitempty"` PublicKey string `json:"publicKey,omitempty"` JSONTokenId string `json:"jti,omitempty"` CreateAlastriaTX string `json:"createAlastriaTX,omitempty"` // ! Not the best name AlastriaToken string `json:"alastriaToken,omitempty"` Contexts []string `json:"@context,omitempty"` Types []string `json:"type,omitempty"` }
type AS ¶
type AS struct { Header *alaTypes.Header `json:"header,omitempty"` Payload *ASPayload `json:"payload,omitempty"` }
func CreateAlastriaSession ¶
Validates the AlastriaSession according to the specification Header: https://github.com/alastria/alastria-identity/wiki/Artifacts-and-User-Stories-Definitions#0-artifacts-definition Payload: https://github.com/alastria/alastria-identity/wiki/Artifacts-and-User-Stories-Definitions#02-alastria-session-as The validation with timestamp will be done with the machine timestamp. This can cause a problem, if the time is not syncronize. Sets default values if they are empty and they are required Returns an error if a mandatory field is empty Mandatory fields are: payload.AlastriaToken and AlastriaToken.Issuer
func DecodeAlastriaSession ¶
Decodes an AlastriaSession from a signed JWT
type ASPayload ¶
type ASPayload struct { JSONTokenId string `json:"jti,omitempty"` IssuedAt uint64 `json:"iat,omitempty"` ExpiresAt uint64 `json:"exp,omitempty"` NotBefore uint64 `json:"nbf,omitempty"` Issuer string `json:"iss,omitempty"` AlastriaToken string `json:"alastriaToken,omitempty"` Contexts []string `json:"@context,omitempty"` Types []string `json:"type,omitempty"` }
type AT ¶
type AT struct { Header *alaTypes.Header `json:"header,omitempty"` Payload *ATPayload `json:"payload,omitempty"` }
func CreateAlastriaToken ¶
Validates the AlastriaToken according to the specification Header: https://github.com/alastria/alastria-identity/wiki/Artifacts-and-User-Stories-Definitions#0-artifacts-definition Payload: https://github.com/alastria/alastria-identity/wiki/Artifacts-and-User-Stories-Definitions#01-alastria-token-at The validation with timestamp will be done with the machine timestamp. This can cause a problem, if the time is not syncronize. Sets default values if they are empty and they are required Returns an error if a mandatory field is empty Mandatory fields are: AlastriaToken.GatewayURL, AlastriaToken.Issuer, AlastriaToken.CallbackURL, AlastriaToken.AlastriaNetworkId
func DecodeAlastriaToken ¶
Decodes an AlastriaToken from a signed JWT
type ATPayload ¶
type ATPayload struct { // ! AT lacks of `@context` field JSONTokenId string `json:"jti,omitempty"` IssuedAt uint64 `json:"iat,omitempty"` ExpiresAt uint64 `json:"exp,omitempty"` NotBefore uint64 `json:"nbf,omitempty"` Issuer string `json:"iss,omitempty"` Types []string `json:"type,omitempty"` AlastriaNetworkId string `json:"ani,omitempty"` CallbackURL string `json:"cbu,omitempty"` GatewayURL string `json:"gwu,omitempty"` MultiFactorAuthentication string `json:"mfau,omitempty"` // ! probably better with just 3 letter "mfa" as the rest of properties }
type AlastriaJWT ¶
type AlastriaJWT struct { AlastriaToken AT AlastriaSession AS AIC AIC Credential Credential Presentation Presentation PR PR }
type Credential ¶
type Credential struct { Header *alaTypes.Header `json:"header,omitempty"` Payload *CredentialPayload `json:"payload,omitempty"` }
func CreateCredential ¶
func CreateCredential(header *alaTypes.Header, payload *CredentialPayload) (*Credential, error)
Validates the VerifiableCredential(aka Credential) according to the specification Header: https://github.com/alastria/alastria-identity/wiki/Artifacts-and-User-Stories-Definitions#0-artifacts-definition Payload: https://github.com/alastria/alastria-identity/wiki/Alastria-DID-Method-Specification-(Quorum-version)#3-credentials The validation with timestamp will be done with the machine timestamp. This can cause a problem, if the time is not syncronize. Sets default values if they are empty and they are required Returns an error if a mandatory field is empty Mandatory fields are: payload.AlastriaToken, payload.CreateAlastriaTX and payload.PublicKey
func DecodeCredential ¶
func DecodeCredential(signedCredential string) (*Credential, error)
Decodes an Credential from a signed JWT
type CredentialPayload ¶
type CredentialPayload struct { JSONTokenId string `json:"jti,omitempty"` IssuedAt uint64 `json:"iat,omitempty"` ExpiresAt uint64 `json:"exp,omitempty"` NotBefore uint64 `json:"nbf,omitempty"` Issuer string `json:"iss,omitempty"` Subject string `json:"sub,omitempty"` VerifiableCredential *CredentialPayloadVC `json:"vc,omitempty"` }
type CredentialPayloadVC ¶
type PR ¶
type PR struct { Header *alaTypes.Header `json:"header,omitempty"` Payload *PRPayload `json:"payload,omitempty"` }
func CreatePresentationRequest ¶
Validates the VerifiablePresentationRequest(aka PresentationRequest) according to the specification Header: https://github.com/alastria/alastria-identity/wiki/Artifacts-and-User-Stories-Definitions#0-artifacts-definition Payload: https://github.com/alastria/alastria-identity/wiki/Alastria-DID-Method-Specification-(Quorum-version)#5-presentation-request The validation with timestamp will be done with the machine timestamp. This can cause a problem, if the time is not syncronize. Sets default values if they are empty and they are required Returns an error if a mandatory field is empty Mandatory fields are: payload.Issuer, payload.CallbackURL, payload.VerifiableCredential.ProcessHash, payload.VerifiablePresentation.ProcessUrl and payload.VerifiablePresentation.Data
type PRPayload ¶
type PRPayload struct { JSONTokenId string `json:"jti,omitempty"` IssuedAt uint64 `json:"iat,omitempty"` ExpiresAt uint64 `json:"exp,omitempty"` NotBefore uint64 `json:"nbf,omitempty"` Issuer string `json:"iss,omitempty"` CallbackURL string `json:"cbu,omitempty"` VerifiablePresentation *PRPayloadVP `json:"vp,omitempty"` }
type PRPayloadVP ¶
type PRPayloadVP struct { Contexts []string `json:"@context,omitempty"` Types []string `json:"type,omitempty"` ProcessHash string `json:"procHash,omitempty"` ProcessUrl string `json:"procUrl,omitempty"` ProcessDescription string `json:"procDescription,omitempty"` Data *[]PRPayloadVPData `json:"data,omitempty"` // ! in a presentation is 'verifiableCredentials', and here data. It's not consistent }
type PRPayloadVPData ¶
type Presentation ¶
type Presentation struct { Header *alaTypes.Header `json:"header,omitempty"` Payload *PresentationPayload `json:"payload,omitempty"` }
func CreatePresentation ¶
func CreatePresentation(header *alaTypes.Header, payload *PresentationPayload) (*Presentation, error)
Validates the VerifiablePresentation(aka Presentation) according to the specification Header: https://github.com/alastria/alastria-identity/wiki/Artifacts-and-User-Stories-Definitions#0-artifacts-definition Payload: https://github.com/alastria/alastria-identity/wiki/Alastria-DID-Method-Specification-(Quorum-version)#4-presentation The validation with timestamp will be done with the machine timestamp. This can cause a problem, if the time is not syncronize. Sets default values if they are empty and they are required Returns an error if a mandatory field is empty Mandatory fields are: payload.Issuer, payload.Audience, payload.VerifiablePresentation.ProcessHash, payload.VerifiablePresentation.ProcessUrl and payload.VerifiableCredential.VerifiableCredentials
func DecodePresentation ¶
func DecodePresentation(signedPresenation string) (*Presentation, error)
Decodes an Presentation from a signed JWT
type PresentationPayload ¶
type PresentationPayload struct { JSONTokenId string `json:"jti,omitempty"` IssuedAt uint64 `json:"iat,omitempty"` ExpiresAt uint64 `json:"exp,omitempty"` NotBefore uint64 `json:"nbf,omitempty"` Issuer string `json:"iss,omitempty"` Audience string `json:"aud,omitempty"` PresentationRequestJSONTokenId string `json:"jtipr,omitempty"` VerifiablePresentation *PresentationPayloadVP `json:"vp,omitempty"` }
type PresentationPayloadVP ¶
type PresentationPayloadVP struct { Contexts []string `json:"@context,omitempty"` Types []string `json:"type,omitempty"` ProcessHash string `json:"procHash,omitempty"` ProcessUrl string `json:"procUrl,omitempty"` ProcessDescription string `json:"procDescription,omitempty"` VerifiableCredentials []string `json:"verifiableCredential,omitempty"` // ! Should be plural: 'verifiableCredentials' }