Documentation
¶
Index ¶
- Constants
- Variables
- func BuildAgentANPMessageService(serviceEndpoint string, serviceDID string) (map[string]any, error)
- func CompleteBareHandle(target string, didDomain string) string
- func DefaultANPServiceDID(hostname string) string
- func DefaultANPServiceEndpoint(hostname string) string
- func EnsureKey1PrivatePEMCompatible(path string) error
- func HandlePathPrefixFromDID(did string) (string, []string, error)
- func IsE1DID(did string) bool
- func IsK1DID(did string) bool
- func PreviewDefaultIdentityName(requested string, existing []IdentitySummary, fallback string) string
- func PreviewNamedIdentity(requested string, existing []IdentitySummary, fallback string) string
- func PublicData(data map[string]any) map[string]any
- func PublicValue(value any) any
- func UserRegistrationError(identityName string, state UserState) error
- func ValidateANPServiceDID(serviceDID string) error
- func ValidateANPServiceEndpoint(serviceEndpoint string) error
- type BindParams
- type CommandResult
- type GenerateOptions
- type GeneratedIdentity
- type HandleLookupResult
- type IdentitySummary
- type ImportResult
- type IndexEntry
- type IndexPayload
- type LegacyFlatIdentity
- type LegacyScan
- type Manager
- func (m *Manager) BackupIdentitiesForHandleRecovery(handle string, candidates []IdentitySummary, plannedFinalName string, ...) (string, error)
- func (m *Manager) BackupIdentityForDIDReplacement(name string, plannedNewDID string) (string, error)
- func (m *Manager) BuildPaths(dirName string) Paths
- func (m *Manager) Current() (*IdentitySummary, error)
- func (m *Manager) EnsureRoot() error
- func (m *Manager) ImportAllLegacy() (*ImportResult, error)
- func (m *Manager) ImportLegacy(name string) (*ImportResult, error)
- func (m *Manager) LegacyRootDir() string
- func (m *Manager) List() ([]IdentitySummary, error)
- func (m *Manager) Load(name string) (*StoredIdentity, error)
- func (m *Manager) LoadIndex() (IndexPayload, error)
- func (m *Manager) PathsForIdentity(name string) (Paths, error)
- func (m *Manager) PreviewRecoverHandleBackupPath(handle string) string
- func (m *Manager) PromoteRecoveredHandle(finalIdentityName string, tempIdentityName string, ...) (*StoredIdentity, bool, error)
- func (m *Manager) ReplaceIdentity(name string, input SaveInput) (*StoredIdentity, error)
- func (m *Manager) RootDir() string
- func (m *Manager) Save(input SaveInput) (*StoredIdentity, error)
- func (m *Manager) SaveIndex(payload IndexPayload) error
- func (m *Manager) ScanLegacy() (*LegacyScan, error)
- func (m *Manager) SetDefault(name string) (*IdentitySummary, error)
- func (m *Manager) UpdateDisplayName(name string, displayName string) error
- func (m *Manager) UpdateJWT(name string, jwtToken string) error
- type NormalizedHandle
- type Paths
- type RecoverFinalizeError
- type RecoverParams
- type RegisterParams
- type RemoteClient
- func (c *RemoteClient) AuthenticatedRPCCall(ctx context.Context, endpoint string, method string, params any, ...) error
- func (c *RemoteClient) AuthenticatedRPCCallProfile(ctx context.Context, profile transportcfg.Profile, endpoint string, ...) error
- func (c *RemoteClient) AuthenticatedRestPost(ctx context.Context, endpoint string, requestPayload any, ...) error
- func (c *RemoteClient) Client() *http.Client
- func (c *RemoteClient) LookupHandleByDID(ctx context.Context, did string) (*HandleLookupResult, error)
- func (c *RemoteClient) RPCCall(ctx context.Context, endpoint string, method string, params any, bearer string, ...) error
- func (c *RemoteClient) RestGet(ctx context.Context, endpoint string, query url.Values, out any) error
- func (c *RemoteClient) RestPost(ctx context.Context, endpoint string, requestPayload any, bearer string, ...) error
- type ReplaceDIDParams
- type SaveInput
- type Service
- func (s *Service) Bind(ctx context.Context, params BindParams) (*CommandResult, error)
- func (s *Service) Config() *appconfig.Resolved
- func (s *Service) Create(displayName string, identityName string) (*CommandResult, error)
- func (s *Service) Current() (*CommandResult, error)
- func (s *Service) FinalizeRecoveredHandle(finalIdentityName string, tempIdentityName string, ...) (*StoredIdentity, error)
- func (s *Service) GetProfile(ctx context.Context, self bool, handle string, did string) (*CommandResult, error)
- func (s *Service) ImportV1(name string, all bool) (*CommandResult, error)
- func (s *Service) List() (*CommandResult, error)
- func (s *Service) Manager() *Manager
- func (s *Service) Recover(ctx context.Context, params RecoverParams) (*CommandResult, error)
- func (s *Service) RecoverPreview(params RecoverParams) (*CommandResult, error)
- func (s *Service) RefreshToken(ctx context.Context, identityName string) (*CommandResult, error)
- func (s *Service) Register(ctx context.Context, params RegisterParams) (*CommandResult, error)
- func (s *Service) ReplaceDID(ctx context.Context, params ReplaceDIDParams) (*CommandResult, error)
- func (s *Service) Resolve(ctx context.Context, handle string, did string) (*CommandResult, error)
- func (s *Service) SetProfile(ctx context.Context, params UpdateProfileParams) (*CommandResult, error)
- func (s *Service) Status() (*CommandResult, error)
- func (s *Service) Use(identityName string) (*CommandResult, error)
- type ServiceError
- type StoredIdentity
- type UpdateProfileParams
- type UserState
Constants ¶
const ( IndexSchemaVersion = 3 IndexFileName = "index.json" LegacyBackupDirName = ".legacy-backup" IdentityFileName = "identity.json" AuthFileName = "auth.json" DIDDocumentFileName = "did_document.json" Key1PrivateFileName = "key-1-private.pem" Key1PublicFileName = "key-1-public.pem" E2EESigningPrivateFileName = "e2ee-signing-private.pem" E2EEAgreementPrivateFileName = "e2ee-agreement-private.pem" E2EEStateFileName = "e2ee-state.json" LegacyE2EEPrefix = "e2ee_" LegacyLayoutHint = "Legacy credential layout detected. Import it before relying on the v2 identity store." DefaultEmailVerificationSecs = 300 DefaultEmailPollIntervalSecs = 5 )
Variables ¶
var ( ErrIdentityNotFound = errors.New("identity not found") ErrIdentityConflict = errors.New("identity conflict") ErrNoDefaultIdentity = errors.New("no default identity") ErrLegacyNotFound = errors.New("legacy identity not found") ErrInvalidInput = errors.New("invalid input") ErrAuthRequired = errors.New("authentication required") ErrUserRegistrationRequired = errors.New("registered handle user is required") )
Functions ¶
func CompleteBareHandle ¶
CompleteBareHandle expands bare and wba://bare handles to a canonical full handle. Explicit full handles and DID values pass through with their original trimmed spelling.
func DefaultANPServiceDID ¶
func EnsureKey1PrivatePEMCompatible ¶
EnsureKey1PrivatePEMCompatible rewrites legacy ANP/private-key PEM encodings into the standard PKCS#8 PEM accepted by ANP SDK 0.8.5+.
func PreviewDefaultIdentityName ¶
func PreviewDefaultIdentityName(requested string, existing []IdentitySummary, fallback string) string
func PreviewNamedIdentity ¶
func PreviewNamedIdentity(requested string, existing []IdentitySummary, fallback string) string
func PublicData ¶
PublicData returns a sanitized copy of identity-domain command output. Internal linkage fields such as user_id must not be exposed through the public CLI contract.
func PublicValue ¶
PublicValue returns a sanitized copy of any public CLI payload. Internal linkage fields such as user_id must not be exposed through the public CLI contract.
func UserRegistrationError ¶
func ValidateANPServiceDID ¶
Types ¶
type BindParams ¶
type CommandResult ¶
type GenerateOptions ¶
type GeneratedIdentity ¶
type GeneratedIdentity struct {
DID string
UniqueID string
DIDDocument map[string]any
Key1PrivatePEM string
Key1PublicPEM string
E2EESigningPrivatePEM string
E2EEAgreementPrivatePEM string
}
func GenerateIdentity ¶
func GenerateIdentity(options GenerateOptions) (*GeneratedIdentity, error)
type HandleLookupResult ¶
type IdentitySummary ¶
type IdentitySummary struct {
IdentityName string `json:"identity_name"`
DID string `json:"did"`
UniqueID string `json:"unique_id"`
UserID string `json:"user_id,omitempty"`
DisplayName string `json:"display_name,omitempty"`
Handle string `json:"handle,omitempty"`
FullHandle string `json:"full_handle,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
DirName string `json:"dir_name"`
IsDefault bool `json:"is_default"`
HasJWT bool `json:"has_jwt"`
HasDIDDocument bool `json:"has_did_document"`
HasKey1Private bool `json:"has_key1_private"`
HasKey1Public bool `json:"has_key1_public"`
HasE2EESigningPrivate bool `json:"has_e2ee_signing_private"`
HasE2EEAgreementPrivate bool `json:"has_e2ee_agreement_private"`
UserState UserState `json:"user_state"`
}
type ImportResult ¶
type ImportResult struct {
Imported []IdentitySummary `json:"imported,omitempty"`
Skipped []string `json:"skipped,omitempty"`
}
type IndexEntry ¶
type IndexEntry struct {
CredentialName string `json:"credential_name"`
DirName string `json:"dir_name"`
DID string `json:"did"`
UniqueID string `json:"unique_id"`
UserID string `json:"user_id,omitempty"`
Name string `json:"name,omitempty"`
Handle string `json:"handle,omitempty"`
FullHandle string `json:"full_handle,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
IsDefault bool `json:"is_default,omitempty"`
}
type IndexPayload ¶
type IndexPayload struct {
SchemaVersion int `json:"schema_version"`
DefaultCredentialName string `json:"default_credential_name,omitempty"`
Credentials map[string]IndexEntry `json:"credentials"`
}
type LegacyFlatIdentity ¶
type LegacyScan ¶
type LegacyScan struct {
RootDir string `json:"root_dir"`
IndexedLayout bool `json:"indexed_layout"`
IndexedEntries map[string]IndexEntry `json:"indexed_entries,omitempty"`
LegacyCredentials []LegacyFlatIdentity `json:"legacy_credentials,omitempty"`
InvalidJSONFiles []map[string]string `json:"invalid_json_files,omitempty"`
OrphanE2EEFiles []map[string]string `json:"orphan_e2ee_files,omitempty"`
HasLegacy bool `json:"has_legacy"`
Hint string `json:"hint,omitempty"`
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) BackupIdentitiesForHandleRecovery ¶
func (*Manager) BackupIdentityForDIDReplacement ¶
func (*Manager) BuildPaths ¶
func (*Manager) Current ¶
func (m *Manager) Current() (*IdentitySummary, error)
func (*Manager) EnsureRoot ¶
func (*Manager) ImportAllLegacy ¶
func (m *Manager) ImportAllLegacy() (*ImportResult, error)
func (*Manager) ImportLegacy ¶
func (m *Manager) ImportLegacy(name string) (*ImportResult, error)
func (*Manager) LegacyRootDir ¶
func (*Manager) List ¶
func (m *Manager) List() ([]IdentitySummary, error)
func (*Manager) LoadIndex ¶
func (m *Manager) LoadIndex() (IndexPayload, error)
func (*Manager) PreviewRecoverHandleBackupPath ¶
func (*Manager) PromoteRecoveredHandle ¶
func (*Manager) ReplaceIdentity ¶
func (m *Manager) ReplaceIdentity(name string, input SaveInput) (*StoredIdentity, error)
func (*Manager) SaveIndex ¶
func (m *Manager) SaveIndex(payload IndexPayload) error
func (*Manager) ScanLegacy ¶
func (m *Manager) ScanLegacy() (*LegacyScan, error)
func (*Manager) SetDefault ¶
func (m *Manager) SetDefault(name string) (*IdentitySummary, error)
func (*Manager) UpdateDisplayName ¶
type NormalizedHandle ¶
type NormalizedHandle struct {
LocalPart string
FullHandle string
EffectiveDomain string
ExplicitDomain bool
}
func NormalizeHandleInput ¶
func NormalizeHandleInput(raw string, didDomain string) (*NormalizedHandle, error)
NormalizeHandleInput normalizes bare/full/wba handle input into a canonical full handle. DID inputs are rejected because callers should route those through explicit DID-aware command flags instead.
type Paths ¶
type Paths struct {
RootDir string `json:"root_dir"`
DirName string `json:"dir_name"`
IdentityDir string `json:"identity_dir"`
IdentityPath string `json:"identity_path"`
AuthPath string `json:"auth_path"`
DIDDocumentPath string `json:"did_document_path"`
Key1PrivatePath string `json:"key1_private_path"`
Key1PublicPath string `json:"key1_public_path"`
E2EESigningPrivatePath string `json:"e2ee_signing_private_path"`
E2EEAgreementPrivatePath string `json:"e2ee_agreement_private_path"`
E2EEStatePath string `json:"e2ee_state_path"`
}
type RecoverFinalizeError ¶
type RecoverFinalizeError struct {
Err error
BackupPath string
TempIdentityName string
NewDID string
}
func (*RecoverFinalizeError) Error ¶
func (e *RecoverFinalizeError) Error() string
func (*RecoverFinalizeError) Unwrap ¶
func (e *RecoverFinalizeError) Unwrap() error
type RecoverParams ¶
type RegisterParams ¶
type RemoteClient ¶
type RemoteClient struct {
// contains filtered or unexported fields
}
func NewRemoteClient ¶
func NewRemoteClient(resolved *appconfig.Resolved) (*RemoteClient, error)
func (*RemoteClient) AuthenticatedRPCCall ¶
func (*RemoteClient) AuthenticatedRPCCallProfile ¶
func (*RemoteClient) AuthenticatedRestPost ¶
func (*RemoteClient) Client ¶
func (c *RemoteClient) Client() *http.Client
func (*RemoteClient) LookupHandleByDID ¶
func (c *RemoteClient) LookupHandleByDID(ctx context.Context, did string) (*HandleLookupResult, error)
type ReplaceDIDParams ¶
type SaveInput ¶
type SaveInput struct {
IdentityName string
DID string
UniqueID string
UserID string
DisplayName string
Handle string
FullHandle string
JWTToken string
DIDDocument map[string]any
Key1PrivatePEM string
Key1PublicPEM string
E2EESigningPrivatePEM string
E2EEAgreementPrivatePEM string
ReplaceExisting bool
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Bind ¶
func (s *Service) Bind(ctx context.Context, params BindParams) (*CommandResult, error)
func (*Service) Create ¶
func (s *Service) Create(displayName string, identityName string) (*CommandResult, error)
func (*Service) Current ¶
func (s *Service) Current() (*CommandResult, error)
func (*Service) FinalizeRecoveredHandle ¶
func (*Service) GetProfile ¶
func (*Service) ImportV1 ¶
func (s *Service) ImportV1(name string, all bool) (*CommandResult, error)
func (*Service) List ¶
func (s *Service) List() (*CommandResult, error)
func (*Service) Recover ¶
func (s *Service) Recover(ctx context.Context, params RecoverParams) (*CommandResult, error)
func (*Service) RecoverPreview ¶
func (s *Service) RecoverPreview(params RecoverParams) (*CommandResult, error)
func (*Service) RefreshToken ¶
func (*Service) Register ¶
func (s *Service) Register(ctx context.Context, params RegisterParams) (*CommandResult, error)
func (*Service) ReplaceDID ¶
func (s *Service) ReplaceDID(ctx context.Context, params ReplaceDIDParams) (*CommandResult, error)
func (*Service) SetProfile ¶
func (s *Service) SetProfile(ctx context.Context, params UpdateProfileParams) (*CommandResult, error)
func (*Service) Status ¶
func (s *Service) Status() (*CommandResult, error)
type ServiceError ¶
func (*ServiceError) Error ¶
func (e *ServiceError) Error() string
type StoredIdentity ¶
type StoredIdentity struct {
IdentityName string `json:"identity_name"`
DirName string `json:"dir_name"`
DID string `json:"did"`
UniqueID string `json:"unique_id"`
UserID string `json:"user_id,omitempty"`
DisplayName string `json:"display_name,omitempty"`
Handle string `json:"handle,omitempty"`
FullHandle string `json:"full_handle,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
JWTToken string `json:"jwt_token,omitempty"`
DIDDocument map[string]any `json:"did_document,omitempty"`
Key1PrivatePEM string `json:"key1_private_pem,omitempty"`
Key1PublicPEM string `json:"key1_public_pem,omitempty"`
E2EESigningPrivatePEM string `json:"e2ee_signing_private_pem,omitempty"`
E2EEAgreementPrivatePEM string `json:"e2ee_agreement_private_pem,omitempty"`
IsDefault bool `json:"is_default,omitempty"`
}
type UpdateProfileParams ¶
type UserState ¶
type UserState struct {
RegistrationState string `json:"registration_state"`
ReadyForMessaging bool `json:"ready_for_messaging"`
Missing []string `json:"missing,omitempty"`
}
func EvaluateIdentitySummaryUserState ¶
func EvaluateIdentitySummaryUserState(summary *IdentitySummary) UserState
func EvaluateStoredIdentityUserState ¶
func EvaluateStoredIdentityUserState(record *StoredIdentity) UserState