Documentation ¶
Index ¶
- Variables
- func DIDKeyIdentifier(did string) (string, error)
- func DIDKeyToPubKey(did string) (publicKey jwk.Key, err error)
- func DIDelsiIdentifier(did string) (string, error)
- func DIDelsiToPubKey(did string) (publicKey jwk.Key, err error)
- func Delete(cfg *yaml.YAML) error
- func GenDIDKey() (did string, privateKey jwk.Key, err error)
- func GenDIDelsi(subject x509util.ELSIName, keyparams x509util.KeyParams) (did string, privateKey jwk.Key, cert x509util.PEMCert, err error)
- func JSONRemarshal(bytes []byte) ([]byte, error)
- func MakeDBDirectory(cfg *yaml.YAML) error
- func PubKeyToDIDKey(pubKeyJWK jwk.Key) (did string, err error)
- type CredRawData
- type CredentialData
- type User
- func (u *User) CredentialExcludeList() []protocol.CredentialDescriptor
- func (u *User) DID() string
- func (u *User) WebAuthnAddCredential(cred webauthn.Credential)
- func (u *User) WebAuthnCredentials() []webauthn.Credential
- func (u User) WebAuthnDisplayName() string
- func (u User) WebAuthnID() []byte
- func (u User) WebAuthnIcon() string
- func (u User) WebAuthnName() string
- type Vault
- func (v *Vault) CreateCredentialJWTFromMap(credmap map[string]any) (credID string, rawJSONCred json.RawMessage, err error)
- func (v *Vault) CreateJWTtoken(credData map[string]any, issuerID string) ([]byte, error)
- func (v *Vault) CreateLEARCredentialJWTFromMap(credmap map[string]any, elsiName x509util.ELSIName) (credID string, rawJSONCred json.RawMessage, err error)
- func (v *Vault) CreateOrGetUserWithDIDKey(userid string, name string, usertype string, password string) (*User, error)
- func (v *Vault) CreateOrGetUserWithDIDelsi(userid string, name string, elsiName x509util.ELSIName, usertype string, ...) (*User, error)
- func (v *Vault) DB() *ent.Client
- func (v *Vault) DIDKeyToPrivateKey(did string) (privateKey jwk.Key, err error)
- func (v *Vault) DIDKeyToPublicKey(did string) (publicKey jwk.Key, err error)
- func (v *Vault) DIDelsiToKey(did string) (privateKey jwk.Key, publicKey jwk.Key, err error)
- func (v *Vault) DIDelsiToPrivateKey(did string) (privateKey jwk.Key, err error)
- func (v *Vault) DIDelsiToPublicKey(did string) (publicKey jwk.Key, err error)
- func (v *Vault) GetAllCredentials() (creds []*CredRawData)
- func (v *Vault) GetDIDForUser(userid string) (string, error)
- func (v *Vault) GetUserById(userid string) (*User, error)
- func (v *Vault) GetUserByName(name string) (*User, error)
- func (v *Vault) InitCredentialTemplates(credentialTemplatesPath string)
- func (v *Vault) NewDidKey() (did string, privateKey jwk.Key, err error)
- func (v *Vault) NewDidKeyForUser(user *User) (did string, privateKey jwk.Key, err error)
- func (v *Vault) NewDidelsiForUser(user *User, sub x509util.ELSIName, kp x509util.KeyParams) (did string, privateKey jwk.Key, pemBytes []byte, err error)
- func (v *Vault) SignWithDIDKey(did string, stringToSign string) (signedString string, err error)
- func (v *Vault) SignWithDIDelsi(did string, privateKey jwk.Key, cert x509util.PEMCert, stringToSign string) (signedString string, err error)
- func (v *Vault) VerifyJWTtoken(token []byte, issuerDID string) (jwt.Token, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DIDKeyIdentifier ¶
func DIDelsiIdentifier ¶
func GenDIDelsi ¶
func GenDIDelsi(subject x509util.ELSIName, keyparams x509util.KeyParams) (did string, privateKey jwk.Key, cert x509util.PEMCert, err error)
GenDIDelsi generates a new 'did:elsi' DID by creating an EC key pair
func JSONRemarshal ¶
func MakeDBDirectory ¶
Types ¶
type CredRawData ¶
type CredentialData ¶
type CredentialData struct { Jti string `json:"jti" yaml:"jti"` CredName string `json:"cred_name"` IssuerDID string `json:"iss"` SubjectDID string `json:"did"` Name string `json:"name"` Given_name string `json:"given_name"` Family_name string `json:"family_name"` Preferred_username string `json:"preferred_username"` Email string `json:"email"` }
type User ¶
type User struct {
// contains filtered or unexported fields
}
User represents the user model It also implements the webauthn.User interface
func (*User) CredentialExcludeList ¶
func (u *User) CredentialExcludeList() []protocol.CredentialDescriptor
CredentialExcludeList returns a CredentialDescriptor array filled with all a user's credentials
func (*User) WebAuthnAddCredential ¶
func (u *User) WebAuthnAddCredential(cred webauthn.Credential)
WebAuthnAddCredential associates the credential to the user
func (*User) WebAuthnCredentials ¶
func (u *User) WebAuthnCredentials() []webauthn.Credential
WebAuthnCredentials returns credentials owned by the user
func (User) WebAuthnDisplayName ¶
WebAuthnDisplayName returns the user's display name
func (User) WebAuthnIcon ¶
WebAuthnIcon is not (yet) implemented
func (User) WebAuthnName ¶
WebAuthnName returns the user's username
type Vault ¶
type Vault struct {
// contains filtered or unexported fields
}
func Must ¶
Must is a helper that wraps a call to a function returning (*Vault, error) and panics if the error is non-nil. It is intended for use in program initialization where the starting process has to be aborted in case of error. Usage is like this:
var issuerVault = vault.Must(vault.New(cfg))
func NewFromDBClient ¶
NewFromDBClient uses an existing client connection for creating the storage object
func (*Vault) CreateCredentialJWTFromMap ¶
func (v *Vault) CreateCredentialJWTFromMap(credmap map[string]any) (credID string, rawJSONCred json.RawMessage, err error)
CreateCredentialJWTFromMap receives a map with the hierarchical data of the credential and returns the id of a new credential and the raw JWT string representing the credential
func (*Vault) CreateJWTtoken ¶
CreateJWTtoken creates a JWT token from the given claims, signed with the first private key associated to the issuer DID
func (*Vault) CreateLEARCredentialJWTFromMap ¶
func (v *Vault) CreateLEARCredentialJWTFromMap(credmap map[string]any, elsiName x509util.ELSIName) (credID string, rawJSONCred json.RawMessage, err error)
CreateLEARCredentialJWTFromMap receives a map with the hierarchical data of the credential and returns the id of a new credential and the raw JWT string representing the credential
func (*Vault) CreateOrGetUserWithDIDKey ¶
func (v *Vault) CreateOrGetUserWithDIDKey(userid string, name string, usertype string, password string) (*User, error)
CreateOrGetUserWithDIDKey retrieves an existing User or creates a new one if it did not exist. The user created is associated to a did:key
func (*Vault) CreateOrGetUserWithDIDelsi ¶
func (v *Vault) CreateOrGetUserWithDIDelsi(userid string, name string, elsiName x509util.ELSIName, usertype string, password string) (*User, error)
CreateOrGetUserWithDIDKey retrieves an existing User or creates a new one if it did not exist. The user created is associated to a did:key
func (*Vault) DIDKeyToPrivateKey ¶
func (*Vault) DIDKeyToPublicKey ¶
func (*Vault) DIDelsiToKey ¶
func (*Vault) DIDelsiToPrivateKey ¶
func (*Vault) DIDelsiToPublicKey ¶
func (*Vault) GetAllCredentials ¶
func (v *Vault) GetAllCredentials() (creds []*CredRawData)
func (*Vault) GetUserById ¶
GetUser returns a *User by the user's username
func (*Vault) GetUserByName ¶
GetUser returns a *User by the user's username