Documentation
¶
Index ¶
- Constants
- func GenerateMnemonic() string
- func GetDID(mnemonic string) (string, error)
- func GetPublicJWK(mnemonic string) (*jwk.JWK, error)
- func InitializeGlobalStores(mnemonic, terminusName string) error
- func ResetPassword(baseURL, localName, currentPassword, newPassword, accessToken string) error
- func RunActivationWizard(baseURL, accessToken string, config WizardConfig) error
- func SetPlatform(p Platform)
- func UserBindTerminus(mnemonic, bflUrl, vaultUrl, osPwd, terminusName, localName string) (string, error)
- type Account
- type AccountProvisioning
- type AccountSettings
- type AccountStatus
- type ActivationWizard
- type ActiveAccountParams
- type App
- type AppAPI
- type Auth
- type AuthClient
- type AuthError
- type AuthPurpose
- type AuthRequestStatus
- type AuthType
- type AuthenticateRequest
- type AuthenticateResponse
- type Base64Bytes
- type Client
- func (c *Client) ActiveAccount(params ActiveAccountParams) error
- func (c *Client) CompleteAuthRequest(params CompleteAuthRequestParams) (*CompleteAuthRequestResponse, error)
- func (c *Client) CompleteCreateSession(params CompleteCreateSessionParams) (*Session, error)
- func (c *Client) CreateAccount(params CreateAccountParams) (*CreateAccountResponse, error)
- func (c *Client) GetAccount() (*Account, error)
- func (c *Client) StartAuthRequest(params StartAuthRequestParams) (*StartAuthRequestResponse, error)
- func (c *Client) StartCreateSession(params StartCreateSessionParams) (*StartCreateSessionResponse, error)
- func (c *Client) UpdateVault(vault Vault) (*Vault, error)
- type ClientState
- type CompleteAuthRequestParams
- type CompleteAuthRequestResponse
- type CompleteCreateSessionParams
- type CreateAccountParams
- type CreateAccountResponse
- type CreateVaultItemParams
- type DIDKeyResult
- type DeviceInfo
- type EncryptionParams
- type ErrorCode
- type ErrorInfo
- type FRPConfig
- type Field
- type FieldType
- type FirstFactorRequest
- type FirstFactorResponse
- type HDNode
- type HDWalletGo
- type HTTPSender
- type ISOTime
- type ItemTemplate
- type KeyParams
- type LoginParams
- type MainVault
- type OrgInfo
- type PBKDF2Params
- type PasswordConfig
- type Platform
- type Request
- type RequestAuth
- type Response
- type SRPClient
- type SRPCore
- func (c *SRPCore) A(a *big.Int) *big.Int
- func (c *SRPCore) B(v, b *big.Int) (*big.Int, error)
- func (c *SRPCore) ClientS(B, x, a, u *big.Int) (*big.Int, error)
- func (c *SRPCore) H(inputs ...*big.Int) (*big.Int, error)
- func (c *SRPCore) IsZeroWhenModN(n *big.Int) bool
- func (c *SRPCore) K(S *big.Int) (*big.Int, error)
- func (c *SRPCore) K_multiplier() (*big.Int, error)
- func (c *SRPCore) M1(A, B, K *big.Int) (*big.Int, error)
- func (c *SRPCore) M2(A, M1, K *big.Int) (*big.Int, error)
- func (c *SRPCore) ServerS(A, v, u, b *big.Int) *big.Int
- func (c *SRPCore) U(A, B *big.Int) (*big.Int, error)
- func (c *SRPCore) V(x *big.Int) *big.Int
- type SRPGroupLength
- type SRPParams
- type SRPServer
- type SRPSession
- type SSIAuthClient
- type Sender
- type Session
- type SignupParams
- type SimpleClientState
- type StartAuthRequestOptions
- type StartAuthRequestParams
- type StartAuthRequestResponse
- type StartCreateSessionParams
- type StartCreateSessionResponse
- type SystemConfig
- type TerminusInfo
- type Token
- type UserStore
- func (u *UserStore) GetAuthURL() string
- func (u *UserStore) GetCurrentID() string
- func (u *UserStore) GetCurrentUserPrivateKey() (*jwk.JWK, error)
- func (u *UserStore) GetDid() string
- func (u *UserStore) GetDomainName() string
- func (u *UserStore) GetLocalName() string
- func (u *UserStore) GetMFA() (string, error)
- func (u *UserStore) GetPrivateJWK() *jwk.JWK
- func (u *UserStore) GetTerminusName() string
- func (u *UserStore) GetVaultURL() string
- func (u *UserStore) SetMFA(mfa string) error
- func (u *UserStore) SignJWS(payload map[string]any) (string, error)
- type Vault
- type VaultItem
- type VaultType
- type WebPlatform
- type WizardConfig
Constants ¶
const ED25519_CODEC_ID = 0xed
Ed25519 multicodec identifier
const TerminusDefaultDomain = "olares.cn"
Variables ¶
This section is empty.
Functions ¶
func GenerateMnemonic ¶
func GenerateMnemonic() string
GenerateMnemonic generates new BIP39 mnemonic
func GetPublicJWK ¶
GetPublicJWK convenience function: generate public JWK from mnemonic
func InitializeGlobalStores ¶
InitializeGlobalStores initializes global storage
func ResetPassword ¶
ResetPassword implements password reset functionality (ref: account.ts reset_password)
func RunActivationWizard ¶
func RunActivationWizard(baseURL, accessToken string, config WizardConfig) error
RunActivationWizard convenient function to run activation wizard
func SetPlatform ¶
func SetPlatform(p Platform)
func UserBindTerminus ¶
func UserBindTerminus(mnemonic, bflUrl, vaultUrl, osPwd, terminusName, localName string) (string, error)
UserBindTerminus main user binding function (ref: TypeScript version)
Types ¶
type Account ¶
type Account struct {
ID string `json:"id"`
DID string `json:"did"`
Name string `json:"name"`
Local bool `json:"local,omitempty"`
Created string `json:"created,omitempty"` // ISO 8601 format
Updated string `json:"updated,omitempty"` // ISO 8601 format
PublicKey string `json:"publicKey,omitempty"` // Base64 encoded RSA public key
EncryptedData string `json:"encryptedData,omitempty"` // Base64 encoded encrypted data
EncryptionParams EncryptionParams `json:"encryptionParams,omitempty"` // AES encryption parameters
KeyParams KeyParams `json:"keyParams,omitempty"` // PBKDF2 key derivation parameters
MainVault MainVault `json:"mainVault"` // Main vault information
Orgs []OrgInfo `json:"orgs"` // Organization list (important: prevent undefined)
Revision string `json:"revision,omitempty"` // Version control
Kid string `json:"kid,omitempty"` // Key ID
Settings AccountSettings `json:"settings,omitempty"` // Account settings
Version string `json:"version,omitempty"` // Version
}
type AccountProvisioning ¶
type AccountProvisioning struct {
ID string `json:"id"`
DID string `json:"did"`
Name *string `json:"name,omitempty"`
AccountID *string `json:"accountId,omitempty"`
Status string `json:"status"`
StatusLabel string `json:"statusLabel"`
StatusMessage string `json:"statusMessage"`
ActionURL *string `json:"actionUrl,omitempty"`
ActionLabel *string `json:"actionLabel,omitempty"`
MetaData map[string]any `json:"metaData,omitempty"`
SkipTos bool `json:"skipTos"`
BillingPage any `json:"billingPage,omitempty"`
Quota map[string]any `json:"quota"`
Features map[string]any `json:"features"`
Orgs []string `json:"orgs"`
}
AccountProvisioning represents account provisioning information
type AccountStatus ¶
type AccountStatus string
const ( AccountStatusUnregistered AccountStatus = "unregistered" AccountStatusActive AccountStatus = "active" AccountStatusBlocked AccountStatus = "blocked" AccountStatusDeleted AccountStatus = "deleted" )
type ActivationWizard ¶
type ActivationWizard struct {
BaseURL string
Config WizardConfig
AccessToken string
MaxRetries int
PollInterval time.Duration
}
ActivationWizard activation wizard
func NewActivationWizard ¶
func NewActivationWizard(baseURL, accessToken string, config WizardConfig) *ActivationWizard
NewActivationWizard creates a new activation wizard
func (*ActivationWizard) RunWizard ¶
func (w *ActivationWizard) RunWizard() error
RunWizard runs the complete activation wizard process (ref: ActivateWizard.vue updateInfo)
type ActiveAccountParams ¶
type App ¶
type App struct {
Version string `json:"version"`
API *Client `json:"-"` // Uses Client from client.go
}
App class - simplified version for backend CLI use
func NewApp ¶
NewApp constructor - initializes with Client (corresponds to original TypeScript constructor)
func NewAppWithBaseURL ¶
NewAppWithBaseURL creates App with base URL (convenience function)
func (*App) Login ¶
func (a *App) Login(params LoginParams) error
Login function - simplified version
func (*App) Signup ¶
func (a *App) Signup(params SignupParams) (*CreateAccountResponse, error)
Signup function - based on original TypeScript signup method (ref: app.ts)
type AppAPI ¶
type AppAPI interface {
StartAuthRequest(params StartAuthRequestParams) (*StartAuthRequestResponse, error)
CompleteAuthRequest(params CompleteAuthRequestParams) (*CompleteAuthRequestResponse, error)
}
AppAPI interface for app-level operations
type Auth ¶
type Auth struct {
ID string `json:"id"`
DID string `json:"did"`
Verifier []byte `json:"verifier"`
KeyParams PBKDF2Params `json:"keyParams"`
}
type AuthClient ¶
AuthClient interface for authentication clients
type AuthError ¶
type AuthError struct {
Code ErrorCode `json:"code"`
Message string `json:"message"`
Data any `json:"data,omitempty"`
}
AuthError represents authentication errors
type AuthPurpose ¶
type AuthPurpose string
const ( AuthPurposeSignup AuthPurpose = "signup" AuthPurposeLogin AuthPurpose = "login" AuthPurposeRecover AuthPurpose = "recover" AuthPurposeAccessKeyStore AuthPurpose = "access_key_store" AuthPurposeTestAuthenticator AuthPurpose = "test_authenticator" AuthPurposeAdminLogin AuthPurpose = "admin_login" )
type AuthRequestStatus ¶
type AuthRequestStatus string
const ( AuthRequestStatusStarted AuthRequestStatus = "started" AuthRequestStatusVerified AuthRequestStatus = "verified" AuthRequestStatusExpired AuthRequestStatus = "expired" )
type AuthType ¶
type AuthType string
============================================================================ Type Definitions and Enums ============================================================================
const (
AuthTypeSSI AuthType = "ssi"
)
type AuthenticateRequest ¶
type AuthenticateRequest struct {
DID string `json:"did"`
Type AuthType `json:"type"`
Purpose AuthPurpose `json:"purpose"`
AuthenticatorIndex int `json:"authenticatorIndex"`
PendingRequest *StartAuthRequestResponse `json:"pendingRequest,omitempty"`
Caller string `json:"caller"`
}
type AuthenticateResponse ¶
type AuthenticateResponse struct {
DID string `json:"did"`
Token string `json:"token"`
AccountStatus AccountStatus `json:"accountStatus"`
Provisioning AccountProvisioning `json:"provisioning"`
DeviceTrusted bool `json:"deviceTrusted"`
}
func Authenticate ¶
func Authenticate(req AuthenticateRequest) (*AuthenticateResponse, error)
Main authentication function - corresponds to original TypeScript _authenticate function
type Base64Bytes ¶
type Base64Bytes []byte
Base64Bytes automatically handles base64 encoding/decoding for byte arrays
func (Base64Bytes) Bytes ¶
func (b Base64Bytes) Bytes() []byte
Bytes returns the underlying byte array
func (Base64Bytes) MarshalJSON ¶
func (b Base64Bytes) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON serialization, automatically encoding to base64 string
func (*Base64Bytes) UnmarshalJSON ¶
func (b *Base64Bytes) UnmarshalJSON(data []byte) error
UnmarshalJSON implements JSON deserialization, automatically decoding from base64 string
type Client ¶
type Client struct {
State ClientState
Sender Sender
}
Client implementation - based on original TypeScript Client class
func NewClient ¶
func NewClient(state ClientState, sender Sender) *Client
func (*Client) ActiveAccount ¶
func (c *Client) ActiveAccount(params ActiveAccountParams) error
func (*Client) CompleteAuthRequest ¶
func (c *Client) CompleteAuthRequest(params CompleteAuthRequestParams) (*CompleteAuthRequestResponse, error)
func (*Client) CompleteCreateSession ¶
func (c *Client) CompleteCreateSession(params CompleteCreateSessionParams) (*Session, error)
func (*Client) CreateAccount ¶
func (c *Client) CreateAccount(params CreateAccountParams) (*CreateAccountResponse, error)
Extend Client interface to support App-required methods
func (*Client) GetAccount ¶
func (*Client) StartAuthRequest ¶
func (c *Client) StartAuthRequest(params StartAuthRequestParams) (*StartAuthRequestResponse, error)
Implement AppAPI interface
func (*Client) StartCreateSession ¶
func (c *Client) StartCreateSession(params StartCreateSessionParams) (*StartCreateSessionResponse, error)
type ClientState ¶
type ClientState interface {
GetSession() *Session
SetSession(session *Session)
GetAccount() *Account
SetAccount(account *Account)
GetDevice() *DeviceInfo
}
ClientState interface for managing client session state
type CompleteAuthRequestResponse ¶
type CompleteAuthRequestResponse struct {
AccountStatus AccountStatus `json:"accountStatus"`
DeviceTrusted bool `json:"deviceTrusted"`
Provisioning AccountProvisioning `json:"provisioning"`
}
type CompleteCreateSessionParams ¶
type CompleteCreateSessionParams struct {
SRPId string `json:"srpId"`
AccountID string `json:"accountId"`
A Base64Bytes `json:"A"` // Use Base64Bytes to handle @AsBytes() decorator
M Base64Bytes `json:"M"` // Use Base64Bytes to handle @AsBytes() decorator
AddTrustedDevice bool `json:"addTrustedDevice"` // Add missing field
Kind string `json:"kind"` // Add kind field
Version string `json:"version"` // Add version field
}
type CreateAccountParams ¶
type CreateAccountParams struct {
Account Account `json:"account"`
Auth Auth `json:"auth"`
AuthToken string `json:"authToken"`
BFLToken string `json:"bflToken"`
SessionID string `json:"sessionId"`
BFLUser string `json:"bflUser"`
JWS string `json:"jws"`
}
New data structures
type CreateAccountResponse ¶
type CreateAccountResponse struct {
MFA string `json:"mfa"`
}
type CreateVaultItemParams ¶
type CreateVaultItemParams struct {
Name string
Vault *Vault
Fields []Field
Tags []string
Icon string
Type VaultType
}
CreateVaultItemParams parameters for creating a vault item
type DIDKeyResult ¶
type DIDKeyResult struct {
DID string `json:"did"`
PublicJWK jwk.JWK `json:"publicJwk"`
PrivateJWK jwk.JWK `json:"privateJwk"`
}
DIDKeyResult represents the result of DID key generation
func GetPrivateJWK ¶
func GetPrivateJWK(mnemonic string) (*DIDKeyResult, error)
GetPrivateJWK convenience function: generate private JWK from mnemonic
type DeviceInfo ¶
type EncryptionParams ¶
type EncryptionParams struct {
Algorithm string `json:"algorithm"` // "AES-GCM"
TagSize int `json:"tagSize"` // 128
KeySize int `json:"keySize"` // 256
IV string `json:"iv"` // Base64 encoded initialization vector
AdditionalData string `json:"additionalData"` // Base64 encoded additional data
Version string `json:"version"` // "3.0.14"
}
EncryptionParams represents AES encryption parameters
type Field ¶
type Field struct {
Name string `json:"name"`
Type FieldType `json:"type"`
Value string `json:"value"`
}
Field represents a field in a vault item
type FieldType ¶
type FieldType string
FieldType represents the type of field in a vault item
const ( FieldTypeUsername FieldType = "username" FieldTypePassword FieldType = "password" FieldTypeApiSecret FieldType = "apiSecret" FieldTypeMnemonic FieldType = "mnemonic" FieldTypeUrl FieldType = "url" FieldTypeEmail FieldType = "email" FieldTypeDate FieldType = "date" FieldTypeMonth FieldType = "month" FieldTypeCredit FieldType = "credit" FieldTypePhone FieldType = "phone" FieldTypePin FieldType = "pin" FieldTypeTotp FieldType = "totp" FieldTypeNote FieldType = "note" FieldTypeText FieldType = "text" )
type FirstFactorRequest ¶
type FirstFactorRequest struct {
Username string `json:"username"`
Password string `json:"password"`
KeepMeLoggedIn bool `json:"keepMeLoggedIn"`
RequestMethod string `json:"requestMethod"`
TargetURL string `json:"targetURL"`
AcceptCookie bool `json:"acceptCookie"`
}
FirstFactorRequest represents first factor request structure
type FirstFactorResponse ¶
FirstFactorResponse represents first factor response structure
type HDNode ¶
type HDNode struct {
// contains filtered or unexported fields
}
HDNode represents BIP32 hierarchical deterministic node
type HDWalletGo ¶
type HDWalletGo struct {
// contains filtered or unexported fields
}
HDWalletGo is a pure Go HD wallet based on Trust Wallet Core implementation
func NewHDWalletFromMnemonic ¶
func NewHDWalletFromMnemonic(mnemonic, passphrase string) (*HDWalletGo, error)
NewHDWalletFromMnemonic creates HD wallet from mnemonic (simulates Trust Wallet Core implementation)
func (*HDWalletGo) GetMasterKeyEd25519 ¶
func (w *HDWalletGo) GetMasterKeyEd25519() (ed25519.PrivateKey, ed25519.PublicKey, error)
GetMasterKeyEd25519 gets Ed25519 master key (simulates Trust Wallet Core's getMasterKey)
func (*HDWalletGo) GetPrivateJWKTrustWalletCore ¶
func (w *HDWalletGo) GetPrivateJWKTrustWalletCore() (*DIDKeyResult, error)
GetPrivateJWKTrustWalletCore generates private JWK using Trust Wallet Core compatible method
type HTTPSender ¶
HTTPSender implements HTTP-based Sender interface
func NewHTTPSender ¶
func NewHTTPSender(baseURL string) *HTTPSender
NewHTTPSender creates new HTTP Sender
type ISOTime ¶
ISOTime is a custom time type that ensures JSON serialization matches JavaScript toISOString() format
func (ISOTime) MarshalJSON ¶
MarshalJSON implements JSON serialization using JavaScript toISOString() format
func (*ISOTime) UnmarshalJSON ¶
UnmarshalJSON implements JSON deserialization
type ItemTemplate ¶
type ItemTemplate struct {
ID string `json:"id"`
Name string `json:"name"`
Icon string `json:"icon"`
Fields []Field `json:"fields"`
}
ItemTemplate represents a template for creating vault items
func GetAuthenticatorTemplate ¶
func GetAuthenticatorTemplate() *ItemTemplate
GetAuthenticatorTemplate returns the authenticator template for TOTP items
type KeyParams ¶
type KeyParams struct {
Algorithm string `json:"algorithm"` // "PBKDF2"
Hash string `json:"hash"` // "SHA-256"
KeySize int `json:"keySize"` // 256
Iterations int `json:"iterations"` // 100000
Salt string `json:"salt"` // Base64 encoded salt
Version string `json:"version"` // "3.0.14"
}
KeyParams represents PBKDF2 key derivation parameters
type LoginParams ¶
type MainVault ¶
type MainVault struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Revision string `json:"revision,omitempty"`
}
MainVault represents main vault information
type OrgInfo ¶
type OrgInfo struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Revision string `json:"revision,omitempty"`
}
OrgInfo represents organization information
type PBKDF2Params ¶
type PasswordConfig ¶
type PasswordConfig struct {
CurrentPassword string `json:"current_password"` // Current password (from wizard settings)
NewPassword string `json:"new_password"` // New password (for reset)
}
PasswordConfig password configuration
type Platform ¶
type Platform interface {
StartAuthRequest(opts StartAuthRequestOptions) (*StartAuthRequestResponse, error)
CompleteAuthRequest(req *StartAuthRequestResponse) (*AuthenticateResponse, error)
}
Platform interface for authentication operations
type Request ¶
type Request struct {
Method string `json:"method"`
Params []interface{} `json:"params,omitempty"`
Device *DeviceInfo `json:"device,omitempty"`
Auth *RequestAuth `json:"auth,omitempty"`
}
Request represents an RPC request
type RequestAuth ¶
type RequestAuth struct {
Session string `json:"session"`
Time ISOTime `json:"time"` // Use custom ISOTime type
Signature Base64Bytes `json:"signature"` // Use Base64Bytes to automatically handle base64 encoding
}
type Response ¶
type Response struct {
Result interface{} `json:"result,omitempty"`
Error *ErrorInfo `json:"error,omitempty"`
}
type SRPClient ¶
type SRPClient struct {
// contains filtered or unexported fields
}
SRPClient represents SRP client
func NewSRPClient ¶
func NewSRPClient(length SRPGroupLength) *SRPClient
func (*SRPClient) Initialize ¶
Initialize initializes SRP client
type SRPCore ¶
type SRPCore struct {
// contains filtered or unexported fields
}
SRPCore implements core SRP algorithms
func NewSRPCore ¶
func NewSRPCore(length SRPGroupLength) *SRPCore
func (*SRPCore) IsZeroWhenModN ¶
IsZeroWhenModN checks if value is zero mod N
func (*SRPCore) K_multiplier ¶
K_multiplier calculates multiplier k = H(N | g)
type SRPGroupLength ¶
type SRPGroupLength int
SRPGroupLength represents SRP group length types
const ( SRPGroup3072 SRPGroupLength = 3072 SRPGroup4096 SRPGroupLength = 4096 SRPGroup6144 SRPGroupLength = 6144 SRPGroup8192 SRPGroupLength = 8192 )
type SRPServer ¶
type SRPServer struct {
// contains filtered or unexported fields
}
SRPServer represents SRP server
func NewSRPServer ¶
func NewSRPServer(length SRPGroupLength) *SRPServer
func (*SRPServer) Initialize ¶
Initialize initializes SRP server
type SRPSession ¶
type SRPSession struct {
ID string `json:"id"`
Created time.Time `json:"created"`
FailedAttempts int `json:"failedAttempts"`
AsAdmin bool `json:"asAdmin"`
X *big.Int `json:"x,omitempty"`
V *big.Int `json:"v,omitempty"`
A *big.Int `json:"a,omitempty"`
BigA *big.Int `json:"A,omitempty"`
B *big.Int `json:"b,omitempty"`
BigB *big.Int `json:"B,omitempty"`
K *big.Int `json:"K,omitempty"`
M1 *big.Int `json:"M1,omitempty"`
M2 *big.Int `json:"M2,omitempty"`
}
SRPSession represents SRP session state
func NewSRPSession ¶
func NewSRPSession() *SRPSession
type SSIAuthClient ¶
type SSIAuthClient struct {
UserStore *UserStore // Direct use of UserStore struct
}
SSI authentication client implementation
func (*SSIAuthClient) PrepareAuthentication ¶
PrepareAuthentication implements authentication functionality for SSI client
type SignupParams ¶
type SignupParams struct {
DID string `json:"did"`
MasterPassword string `json:"masterPassword"`
Name string `json:"name"`
AuthToken string `json:"authToken"`
SessionID string `json:"sessionId"`
BFLToken string `json:"bflToken"`
BFLUser string `json:"bflUser"`
JWS string `json:"jws"`
}
Parameter structures
type SimpleClientState ¶
type SimpleClientState struct {
// contains filtered or unexported fields
}
SimpleClientState - simplified client state for backend CLI
func (*SimpleClientState) GetAccount ¶
func (s *SimpleClientState) GetAccount() *Account
func (*SimpleClientState) GetDevice ¶
func (s *SimpleClientState) GetDevice() *DeviceInfo
func (*SimpleClientState) GetSession ¶
func (s *SimpleClientState) GetSession() *Session
func (*SimpleClientState) SetAccount ¶
func (s *SimpleClientState) SetAccount(account *Account)
func (*SimpleClientState) SetSession ¶
func (s *SimpleClientState) SetSession(session *Session)
type StartAuthRequestOptions ¶
type StartAuthRequestOptions struct {
Purpose AuthPurpose `json:"purpose"`
Type *AuthType `json:"type,omitempty"`
DID *string `json:"did,omitempty"`
AuthenticatorID *string `json:"authenticatorId,omitempty"`
AuthenticatorIndex *int `json:"authenticatorIndex,omitempty"`
}
type StartAuthRequestParams ¶
type StartAuthRequestParams struct {
DID string `json:"did"`
Type *AuthType `json:"type,omitempty"`
SupportedTypes []AuthType `json:"supportedTypes"`
Purpose AuthPurpose `json:"purpose"`
AuthenticatorID *string `json:"authenticatorId,omitempty"`
AuthenticatorIndex *int `json:"authenticatorIndex,omitempty"`
}
type StartAuthRequestResponse ¶
type StartAuthRequestResponse struct {
ID string `json:"id"`
DID string `json:"did"`
Token string `json:"token"`
Data map[string]any `json:"data"`
Type AuthType `json:"type"`
Purpose AuthPurpose `json:"purpose"`
AuthenticatorID string `json:"authenticatorId"`
RequestStatus AuthRequestStatus `json:"requestStatus"`
AccountStatus *AccountStatus `json:"accountStatus,omitempty"`
Provisioning *AccountProvisioning `json:"provisioning,omitempty"`
DeviceTrusted bool `json:"deviceTrusted"`
}
type StartCreateSessionResponse ¶
type StartCreateSessionResponse struct {
AccountID string `json:"accountId"`
KeyParams PBKDF2Params `json:"keyParams"`
SRPId string `json:"srpId"`
B Base64Bytes `json:"B"`
Kind string `json:"kind,omitempty"`
Version string `json:"version,omitempty"`
}
type SystemConfig ¶
type SystemConfig struct {
Location string `json:"location"` // Timezone location, e.g. "Asia/Shanghai"
Language string `json:"language"` // Language, e.g. "zh-CN" or "en-US"
Theme string `json:"theme"` // Theme, e.g. "dark" or "light"
FRP *FRPConfig `json:"frp,omitempty"` // Optional FRP configuration
}
SystemConfig system configuration
type TerminusInfo ¶
type TerminusInfo struct {
WizardStatus string `json:"wizardStatus"`
OlaresId string `json:"olaresId"`
}
TerminusInfo Terminus information response
type Token ¶
type Token struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"`
ExpiresAt int `json:"expires_at"`
SessionID string `json:"session_id"`
FA2 bool `json:"fa2"`
}
Token struct, corresponds to TypeScript Token interface
type UserStore ¶
type UserStore struct {
// contains filtered or unexported fields
}
UserStore implementation using actual DID keys
func NewUserStore ¶
NewUserStore creates user store, generating all keys from mnemonic (using methods from did_key_utils.go)
func (*UserStore) GetAuthURL ¶
func (*UserStore) GetCurrentID ¶
UserStore method implementations
func (*UserStore) GetCurrentUserPrivateKey ¶
func (*UserStore) GetDomainName ¶
func (*UserStore) GetLocalName ¶
func (*UserStore) GetPrivateJWK ¶
func (*UserStore) GetTerminusName ¶
func (*UserStore) GetVaultURL ¶
type Vault ¶
type Vault struct {
Kind string `json:"kind"` // Always "vault" for Vault objects
ID string `json:"id"`
Name string `json:"name"`
Owner string `json:"owner"`
Created string `json:"created"` // ISO 8601 format
Updated string `json:"updated"` // ISO 8601 format
Revision string `json:"revision,omitempty"`
Items []VaultItem `json:"items,omitempty"`
KeyParams interface{} `json:"keyParams,omitempty"`
EncryptionParams interface{} `json:"encryptionParams,omitempty"`
Accessors interface{} `json:"accessors,omitempty"`
EncryptedData interface{} `json:"encryptedData,omitempty"`
Version string `json:"version,omitempty"` // Serialization version
}
Vault represents a vault containing items
type VaultItem ¶
type VaultItem struct {
ID string `json:"id"`
Name string `json:"name"`
Type VaultType `json:"type"`
Icon string `json:"icon,omitempty"`
Fields []Field `json:"fields"`
Tags []string `json:"tags"`
Updated string `json:"updated"` // ISO 8601 format
UpdatedBy string `json:"updatedBy"`
}
VaultItem represents an item in a vault
type WebPlatform ¶
type WebPlatform struct {
SupportedAuthTypes []AuthType
App AppAPI // App interface, currently only interface definition
Mnemonic string // Mnemonic for real JWS signing
DID string // DID for user identification
}
WebPlatform implementation - based on original TypeScript WebPlatform
func NewWebPlatform ¶
func NewWebPlatform(app AppAPI) *WebPlatform
func NewWebPlatformWithMnemonic ¶
func NewWebPlatformWithMnemonic(app AppAPI, mnemonic, did string) *WebPlatform
NewWebPlatformWithMnemonic creates WebPlatform with mnemonic
func (*WebPlatform) CompleteAuthRequest ¶
func (p *WebPlatform) CompleteAuthRequest(req *StartAuthRequestResponse) (*AuthenticateResponse, error)
func (*WebPlatform) StartAuthRequest ¶
func (p *WebPlatform) StartAuthRequest(opts StartAuthRequestOptions) (*StartAuthRequestResponse, error)
type WizardConfig ¶
type WizardConfig struct {
System SystemConfig `json:"system"`
Password PasswordConfig `json:"password"`
}
WizardConfig contains activation wizard configuration
func CustomWizardConfig ¶
func CustomWizardConfig(location, language string, enableTunnel bool, host, jws, currentPassword, newPassword string) WizardConfig
CustomWizardConfig creates custom wizard configuration