Versions in this module Expand all Collapse all v1 v1.1.0 Jan 28, 2023 v1.0.0 Dec 31, 2022 Changes in this version + const AccountUpdateType + const MetaLeaseDurationYears + var ErrForbiddenOperation = errors.New("forbidden operation with restricted wallet") + var ErrInsufficientLockLevel = errors.New("insufficient wallet lock level") + var ErrLeaseRevokedAndPurged = errors.New("lease revoked and purged") + var ErrRecipientNotFound = errors.New("recipient not found") + var ErrRecordNotFoundInRootIndex = errors.New("record not found in root index") + var ErrSenderNotFound = errors.New("sender not found") + var ErrWalletLocked = errors.New("data wallet is locked") + func ForceSyncRootIndex(dw DataWallet) error + func SaveNewAccount(resp *account.GenerationResponse, nodeClient NodeClient, ...) error + type AccountBackend interface + CreateAccessKey func(key *model.AccessKey) (*model.AccessKey, error) + CreateAccount func(account *account.Account, registrationCode string) error + CreateSubAccount func(account *account.Account) (*account.Account, error) + DeleteAccessKey func(keyID string) error + DeleteAccount func(id string) error + DeleteProperty func(hash string) error + GetAccessKey func(keyID string) (*model.AccessKey, error) + GetAccount func(id string) (*account.Account, error) + GetIdentity func(hash string) (*account.DataEnvelope, error) + GetLocker func(hash string) (*account.DataEnvelope, error) + GetOwnAccount func() (*account.Account, error) + GetProperty func(hash string) (*account.DataEnvelope, error) + ListAccessKeys func() ([]*model.AccessKey, error) + ListIdentities func() ([]*account.DataEnvelope, error) + ListLockerHashes func() ([]string, error) + ListLockers func() ([]*account.DataEnvelope, error) + ListProperties func() ([]*account.DataEnvelope, error) + ListSubAccounts func(id string) ([]*account.Account, error) + PatchAccount func(...) error + StoreIdentity func(idy *account.DataEnvelope) error + StoreLocker func(l *account.DataEnvelope) error + StoreProperty func(prop *account.DataEnvelope) error + UpdateAccount func(account *account.Account) error + type AccountUpdate struct + AccessLevel model.AccessLevel + AccountID string + IdentitiesAdded []string + IdentitiesRemoved []string + IndexesAdded []string + IndexesRemoved []string + LockersClosed []string + LockersOpened []string + SubAccountsAdded []string + SubAccountsRemoved []string + Type string + type AccountUpdateMessage struct + Type string + UserID string + type DataSetStoreConstructor func(dataWallet DataWallet, services Services) (DataStore, error) + type DataStore interface + AssetHead func(headID string, opts ...dataset.LoadOption) (model.DataSet, error) + Load func(id string, opts ...dataset.LoadOption) (model.DataSet, error) + NewDataSetBuilder func(lockerID string, opts ...dataset.BuilderOption) (dataset.Builder, error) + PurgeDataAssets func(recordID string) error + Revoke func(id string) dataset.RecordFuture + SetAssetHead func(assetID string, locker *model.Locker, headName string, recordID string) dataset.RecordFuture + Share func(ds model.DataSet, locker Locker, vaultName string, expiryTime time.Time) dataset.RecordFuture + type DataWallet interface + AccessKeys func() ([]*model.AccessKey, error) + Account func() *account.Account + AddIdentity func(idy *account.Identity) error + AddLocker func(l *model.Locker) (Locker, error) + Backend func() AccountBackend + ChangeEmail func(email string) error + ChangePassphrase func(oldPassphrase, newPassphrase string, isHash bool) (DataWallet, error) + CreateAccessKey func(accessLevel model.AccessLevel, duration time.Duration) (*model.AccessKey, error) + CreateIndex func(indexStoreName, indexType string, opts ...index.Option) (index.Index, error) + CreateRootIndex func(indexStoreName string) (index.RootIndex, error) + CreateSubAccount func(accessLevel model.AccessLevel, name string, opts ...account.Option) (DataWallet, error) + DataStore func() DataStore + DeleteProperty func(key string, lvl model.AccessLevel) error + DeleteSubAccount func(id string) error + EncryptionKey func(tag string, accessLevel model.AccessLevel) (*model.AESKey, error) + GetAccessKey func(keyID string) (*model.AccessKey, error) + GetDID func(iid string) (*model.DID, error) + GetIdentities func() (map[string]Identity, error) + GetIdentity func(iid string) (Identity, error) + GetLocker func(lockerID string) (Locker, error) + GetLockers func() ([]*model.Locker, error) + GetProperties func() (map[string]string, error) + GetProperty func(key string) (string, error) + GetRootIdentity func() (Identity, error) + GetRootLocker func(level model.AccessLevel) (Locker, error) + GetSubAccount func(id string) (*account.Account, error) + GetSubAccountWallet func(id string) (DataWallet, error) + ID func() string + Index func(id string) (index.Index, error) + IndexUpdater func(indexes ...index.Index) (*IndexUpdater, error) + Lock func() error + NewIdentity func(accessLevel model.AccessLevel, name string, options ...IdentityOption) (Identity, error) + Recover func(cryptoKey *model.AESKey, newPassphrase string) (DataWallet, error) + RestrictedWallet func(identities []string) (DataWallet, error) + RevokeAccessKey func(keyID string) error + RootIndex func() (index.RootIndex, error) + Services func() Services + SetProperty func(key string, value string, lvl model.AccessLevel) error + SubAccounts func() ([]*account.Account, error) + Unlock func(passphrase string) error + UnlockAsChild func(parentNode slip10.Node) error + UnlockAsManaged func(managedKey *model.AESKey) error + UnlockWithAccessKey func(apiKey, apiSecret string) error + type DataWalletBackendBuilderFn func(acct *account.Account) (NodeClient, error) + type Factory interface + GetWalletWithAccessKey func(apiKey, apiSecret string) (DataWallet, error) + type ForceSyncMessage struct + Reason string + Type string + type Identity interface + AccessLevel func() model.AccessLevel + CreatedAt func() *time.Time + DID func() *model.DID + ID func() string + Name func() string + NewLocker func(name string, options ...LockerOption) (Locker, error) + Raw func() *account.Identity + SetName func(name string) error + type IdentityOption func(opts *identityOptions) error + func WithDID(did *model.DID) IdentityOption + func WithType(identityType string) IdentityOption + type IndexUpdater struct + func NewIndexUpdater(ledger model.Ledger) *IndexUpdater + func (ixf *IndexUpdater) AddIndexes(dw DataWallet, indexes ...index.Index) error + func (ixf *IndexUpdater) Close() error + func (ixf *IndexUpdater) StartSyncOnEvents(ns notification.Service, syncOnStart bool, forceSyncInterval time.Duration) error + func (ixf *IndexUpdater) StopSyncOnEvents() + func (ixf *IndexUpdater) Sync() error + func (ixf *IndexUpdater) SyncNoWait() + type LocalDataWallet struct + func NewLocalDataWallet(acct *account.Account, nodeClient NodeClient, ...) (*LocalDataWallet, error) + func (dw *LocalDataWallet) AccessKeys() ([]*model.AccessKey, error) + func (dw *LocalDataWallet) Account() *account.Account + func (dw *LocalDataWallet) AddIdentity(idy *account.Identity) error + func (dw *LocalDataWallet) AddLocker(locker *model.Locker) (Locker, error) + func (dw *LocalDataWallet) Backend() AccountBackend + func (dw *LocalDataWallet) ChangeEmail(email string) error + func (dw *LocalDataWallet) ChangePassphrase(oldPassphrase, newPassphrase string, isHash bool) (DataWallet, error) + func (dw *LocalDataWallet) Close() error + func (dw *LocalDataWallet) CreateAccessKey(accessLevel model.AccessLevel, duration time.Duration) (*model.AccessKey, error) + func (dw *LocalDataWallet) CreateIndex(indexStoreName, indexType string, opts ...index.Option) (index.Index, error) + func (dw *LocalDataWallet) CreateRootIndex(indexStoreName string) (index.RootIndex, error) + func (dw *LocalDataWallet) CreateSubAccount(accessLevel model.AccessLevel, name string, opts ...account.Option) (DataWallet, error) + func (dw *LocalDataWallet) DataStore() DataStore + func (dw *LocalDataWallet) DeleteProperty(key string, lvl model.AccessLevel) error + func (dw *LocalDataWallet) DeleteSubAccount(id string) error + func (dw *LocalDataWallet) EncryptionKey(tag string, accessLevel model.AccessLevel) (*model.AESKey, error) + func (dw *LocalDataWallet) GetAccessKey(keyID string) (*model.AccessKey, error) + func (dw *LocalDataWallet) GetDID(iid string) (*model.DID, error) + func (dw *LocalDataWallet) GetIdentities() (map[string]Identity, error) + func (dw *LocalDataWallet) GetIdentity(iid string) (Identity, error) + func (dw *LocalDataWallet) GetLocker(lockerID string) (Locker, error) + func (dw *LocalDataWallet) GetLockers() ([]*model.Locker, error) + func (dw *LocalDataWallet) GetProperties() (map[string]string, error) + func (dw *LocalDataWallet) GetProperty(key string) (string, error) + func (dw *LocalDataWallet) GetRootIdentity() (Identity, error) + func (dw *LocalDataWallet) GetRootLocker(level model.AccessLevel) (Locker, error) + func (dw *LocalDataWallet) GetSubAccount(id string) (*account.Account, error) + func (dw *LocalDataWallet) GetSubAccountWallet(id string) (DataWallet, error) + func (dw *LocalDataWallet) ID() string + func (dw *LocalDataWallet) Index(id string) (index.Index, error) + func (dw *LocalDataWallet) IndexUpdater(indexes ...index.Index) (*IndexUpdater, error) + func (dw *LocalDataWallet) Lock() error + func (dw *LocalDataWallet) LockLevel() model.AccessLevel + func (dw *LocalDataWallet) NewIdentity(accessLevel model.AccessLevel, name string, options ...IdentityOption) (Identity, error) + func (dw *LocalDataWallet) Recover(cryptoKey *model.AESKey, newPassphrase string) (DataWallet, error) + func (dw *LocalDataWallet) RestrictedWallet(identities []string) (DataWallet, error) + func (dw *LocalDataWallet) RevokeAccessKey(keyID string) error + func (dw *LocalDataWallet) RootIndex() (index.RootIndex, error) + func (dw *LocalDataWallet) Services() Services + func (dw *LocalDataWallet) SetProperty(key string, value string, lvl model.AccessLevel) error + func (dw *LocalDataWallet) SubAccounts() ([]*account.Account, error) + func (dw *LocalDataWallet) Unlock(passphrase string) error + func (dw *LocalDataWallet) UnlockAsChild(parentNode slip10.Node) error + func (dw *LocalDataWallet) UnlockAsManaged(managedKey *model.AESKey) error + func (dw *LocalDataWallet) UnlockWithAccessKey(apiKey, apiSecret string) error + type LocalFactory struct + func NewLocalFactory(ledger model.Ledger, offChainStorage model.OffChainStorage, ...) (*LocalFactory, error) + func (lf *LocalFactory) CreateDataWallet(acct *account.Account) (DataWallet, error) + func (lf *LocalFactory) GetWalletWithAccessKey(apiKey, apiSecret string) (DataWallet, error) + func (lf *LocalFactory) RegisterAccount(acctTemplate *account.Account, opts ...account.Option) (DataWallet, *RecoveryDetails, error) + func (lf *LocalFactory) SaveAccount(acct *account.Account) (DataWallet, error) + type LocalNodeClient struct + func NewLocalNodeClient(accountID string, identityBackend storage.IdentityBackend, ledger model.Ledger, ...) *LocalNodeClient + func (lnc *LocalNodeClient) BlobManager() model.BlobManager + func (lnc *LocalNodeClient) Close() error + func (lnc *LocalNodeClient) CreateAccessKey(key *model.AccessKey) (*model.AccessKey, error) + func (lnc *LocalNodeClient) CreateAccount(acct *account.Account, registrationCode string) error + func (lnc *LocalNodeClient) CreateDIDDocument(ddoc *model.DIDDocument) error + func (lnc *LocalNodeClient) CreateSubAccount(acct *account.Account) (*account.Account, error) + func (lnc *LocalNodeClient) DIDProvider() model.DIDProvider + func (lnc *LocalNodeClient) DeleteAccessKey(keyID string) error + func (lnc *LocalNodeClient) DeleteAccount(id string) error + func (lnc *LocalNodeClient) DeleteProperty(hash string) error + func (lnc *LocalNodeClient) GetAccessKey(keyID string) (*model.AccessKey, error) + func (lnc *LocalNodeClient) GetAccount(id string) (*account.Account, error) + func (lnc *LocalNodeClient) GetDIDDocument(iid string) (*model.DIDDocument, error) + func (lnc *LocalNodeClient) GetIdentity(hash string) (*account.DataEnvelope, error) + func (lnc *LocalNodeClient) GetLocker(hash string) (*account.DataEnvelope, error) + func (lnc *LocalNodeClient) GetOwnAccount() (*account.Account, error) + func (lnc *LocalNodeClient) GetProperty(hash string) (*account.DataEnvelope, error) + func (lnc *LocalNodeClient) Ledger() model.Ledger + func (lnc *LocalNodeClient) ListAccessKeys() ([]*model.AccessKey, error) + func (lnc *LocalNodeClient) ListIdentities() ([]*account.DataEnvelope, error) + func (lnc *LocalNodeClient) ListLockerHashes() ([]string, error) + func (lnc *LocalNodeClient) ListLockers() ([]*account.DataEnvelope, error) + func (lnc *LocalNodeClient) ListProperties() ([]*account.DataEnvelope, error) + func (lnc *LocalNodeClient) ListSubAccounts(id string) ([]*account.Account, error) + func (lnc *LocalNodeClient) NewInstance(email, passphrase string, isHash bool) (NodeClient, error) + func (lnc *LocalNodeClient) NotificationService() (notification.Service, error) + func (lnc *LocalNodeClient) OffChainStorage() model.OffChainStorage + func (lnc *LocalNodeClient) PatchAccount(...) error + func (lnc *LocalNodeClient) StoreIdentity(idy *account.DataEnvelope) error + func (lnc *LocalNodeClient) StoreLocker(l *account.DataEnvelope) error + func (lnc *LocalNodeClient) StoreProperty(prop *account.DataEnvelope) error + func (lnc *LocalNodeClient) SubAccountInstance(subAccountID string) (NodeClient, error) + func (lnc *LocalNodeClient) UpdateAccount(acct *account.Account) error + type Locker interface + AccessLevel func() model.AccessLevel + CreatedAt func() *time.Time + HeadID func(assetID string, headName string) string + ID func() string + IsThirdParty func() bool + IsUniLocker func() bool + Name func() string + NewDataSetBuilder func(opts ...dataset.BuilderOption) (dataset.Builder, error) + Raw func() *model.Locker + Seal func() error + SetAssetHead func(assetID, headName, recordID string) dataset.RecordFuture + SetName func(name string) error + Share func(id, vaultName string, expiryTime time.Time) dataset.RecordFuture + Store func(meta any, expiryTime time.Time, opts ...dataset.BuilderOption) dataset.RecordFuture + Them func() []*model.LockerParticipant + Us func() *model.LockerParticipant + type LockerOption func(opts *lockerOptions) error + func ExpiresAt(expiresAt time.Time) LockerOption + func FixedSeed(seed []byte) LockerOption + func Participant(did *model.DID, seed []byte) LockerOption + type NodeClient interface + NewInstance func(email, passphrase string, isHash bool) (NodeClient, error) + SubAccountInstance func(subAccountID string) (NodeClient, error) + type RecoveryDetails struct + RecoveryPhrase string + SecondLevelRecoveryCode string + type RestrictedNodeClient struct + func NewRestrictedNodeClient(identities []string, nodeClient NodeClient) *RestrictedNodeClient + func (r *RestrictedNodeClient) BlobManager() model.BlobManager + func (r *RestrictedNodeClient) Close() error + func (r *RestrictedNodeClient) CreateAccessKey(key *model.AccessKey) (*model.AccessKey, error) + func (r *RestrictedNodeClient) CreateAccount(acct *account.Account, registrationCode string) error + func (r *RestrictedNodeClient) CreateSubAccount(acct *account.Account) (*account.Account, error) + func (r *RestrictedNodeClient) DIDProvider() model.DIDProvider + func (r *RestrictedNodeClient) DeleteAccessKey(keyID string) error + func (r *RestrictedNodeClient) DeleteAccount(id string) error + func (r *RestrictedNodeClient) DeleteProperty(hash string) error + func (r *RestrictedNodeClient) GetAccessKey(aid string) (*model.AccessKey, error) + func (r *RestrictedNodeClient) GetAccount(id string) (*account.Account, error) + func (r *RestrictedNodeClient) GetIdentity(hash string) (*account.DataEnvelope, error) + func (r *RestrictedNodeClient) GetLocker(hash string) (*account.DataEnvelope, error) + func (r *RestrictedNodeClient) GetOwnAccount() (*account.Account, error) + func (r *RestrictedNodeClient) GetProperty(hash string) (*account.DataEnvelope, error) + func (r *RestrictedNodeClient) Ledger() model.Ledger + func (r *RestrictedNodeClient) ListAccessKeys() ([]*model.AccessKey, error) + func (r *RestrictedNodeClient) ListIdentities() ([]*account.DataEnvelope, error) + func (r *RestrictedNodeClient) ListLockerHashes() ([]string, error) + func (r *RestrictedNodeClient) ListLockers() ([]*account.DataEnvelope, error) + func (r *RestrictedNodeClient) ListProperties() ([]*account.DataEnvelope, error) + func (r *RestrictedNodeClient) ListSubAccounts(id string) ([]*account.Account, error) + func (r *RestrictedNodeClient) NewInstance(email, passphrase string, isHash bool) (NodeClient, error) + func (r *RestrictedNodeClient) NotificationService() (notification.Service, error) + func (r *RestrictedNodeClient) OffChainStorage() model.OffChainStorage + func (r *RestrictedNodeClient) PatchAccount(...) error + func (r *RestrictedNodeClient) StoreIdentity(idy *account.DataEnvelope) error + func (r *RestrictedNodeClient) StoreLocker(l *account.DataEnvelope) error + func (r *RestrictedNodeClient) StoreProperty(prop *account.DataEnvelope) error + func (r *RestrictedNodeClient) SubAccountInstance(subAccountID string) (NodeClient, error) + func (r *RestrictedNodeClient) UpdateAccount(acct *account.Account) error + type Services interface + BlobManager func() model.BlobManager + DIDProvider func() model.DIDProvider + Ledger func() model.Ledger + NotificationService func() (notification.Service, error) + OffChainStorage func() model.OffChainStorage