Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyAccountUpdate(ctx context.Context, ai AccountIndex, update *AccountUpdate, dw DataWallet) error
- func ForceSyncRootIndex(dw DataWallet) error
- func InitAccountIndex(ctx context.Context, ai AccountIndex, dw DataWallet) error
- func SaveNewAccount(ctx context.Context, resp *account.GenerationResponse, nodeClient NodeClient, ...) error
- type AccountBackend
- type AccountIndex
- type AccountUpdate
- type AccountUpdateMessage
- type DataSetStoreConstructor
- type DataStore
- type DataWallet
- type DataWalletBackendBuilderFn
- type Factory
- type ForceSyncMessage
- type Identity
- type IdentityOption
- type IndexUpdater
- func (ixf *IndexUpdater) AddIndexes(ctx context.Context, dw DataWallet, indexes ...index.Index) error
- func (ixf *IndexUpdater) Close() error
- func (ixf *IndexUpdater) RemoveIndex(indexID string) error
- func (ixf *IndexUpdater) StartSyncOnEvents(ns notification.Service, syncOnStart bool, forceSyncInterval time.Duration) error
- func (ixf *IndexUpdater) StopSyncOnEvents()
- func (ixf *IndexUpdater) Sync(ctx context.Context) error
- func (ixf *IndexUpdater) SyncNoWait()
- type LocalDataWallet
- func (dw *LocalDataWallet) AccessKeys(ctx context.Context) ([]*model.AccessKey, error)
- func (dw *LocalDataWallet) Account() *account.Account
- func (dw *LocalDataWallet) AddIdentity(ctx context.Context, idy *account.Identity) error
- func (dw *LocalDataWallet) AddLocker(ctx context.Context, locker *model.Locker) (Locker, error)
- func (dw *LocalDataWallet) Backend() AccountBackend
- func (dw *LocalDataWallet) ChangeEmail(ctx context.Context, email string) error
- func (dw *LocalDataWallet) ChangePassphrase(ctx context.Context, oldPassphrase, newPassphrase string, isHash bool) (DataWallet, error)
- func (dw *LocalDataWallet) Close() error
- func (dw *LocalDataWallet) CreateAccessKey(ctx context.Context, accessLevel model.AccessLevel, duration time.Duration) (*model.AccessKey, error)
- func (dw *LocalDataWallet) CreateIndex(ctx context.Context, indexStoreName, indexType string, opts ...index.Option) (index.Index, error)
- func (dw *LocalDataWallet) CreateRootIndex(ctx context.Context, indexStoreName string) (index.RootIndex, error)
- func (dw *LocalDataWallet) CreateSubAccount(ctx context.Context, accessLevel model.AccessLevel, name string, ...) (DataWallet, error)
- func (dw *LocalDataWallet) DataStore() DataStore
- func (dw *LocalDataWallet) DeleteProperty(ctx context.Context, key string, lvl model.AccessLevel) error
- func (dw *LocalDataWallet) DeleteSubAccount(ctx context.Context, id string) error
- func (dw *LocalDataWallet) EncryptionKey(tag string, accessLevel model.AccessLevel) (*model.AESKey, error)
- func (dw *LocalDataWallet) GetAccessKey(ctx context.Context, keyID string) (*model.AccessKey, error)
- func (dw *LocalDataWallet) GetDID(ctx context.Context, iid string) (*model.DID, error)
- func (dw *LocalDataWallet) GetIdentities(ctx context.Context) (map[string]Identity, error)
- func (dw *LocalDataWallet) GetIdentity(ctx context.Context, iid string) (Identity, error)
- func (dw *LocalDataWallet) GetLocker(ctx context.Context, lockerID string) (Locker, error)
- func (dw *LocalDataWallet) GetLockers(ctx context.Context) ([]*model.Locker, error)
- func (dw *LocalDataWallet) GetProperties(ctx context.Context) (map[string]string, error)
- func (dw *LocalDataWallet) GetProperty(ctx context.Context, key string) (string, error)
- func (dw *LocalDataWallet) GetRootIdentity(ctx context.Context) (Identity, error)
- func (dw *LocalDataWallet) GetRootLocker(ctx context.Context, level model.AccessLevel) (Locker, error)
- func (dw *LocalDataWallet) GetSubAccount(ctx context.Context, id string) (*account.Account, error)
- func (dw *LocalDataWallet) GetSubAccountWallet(ctx context.Context, id string) (DataWallet, error)
- func (dw *LocalDataWallet) ID() string
- func (dw *LocalDataWallet) Index(ctx context.Context, id string) (index.Index, error)
- func (dw *LocalDataWallet) IndexUpdater(ctx context.Context, indexes ...index.Index) (*IndexUpdater, error)
- func (dw *LocalDataWallet) Lock() error
- func (dw *LocalDataWallet) LockLevel() model.AccessLevel
- func (dw *LocalDataWallet) NewIdentity(ctx context.Context, accessLevel model.AccessLevel, name string, ...) (Identity, error)
- func (dw *LocalDataWallet) Recover(ctx context.Context, cryptoKey *model.AESKey, newPassphrase string) (DataWallet, error)
- func (dw *LocalDataWallet) RestrictedWallet(identities []string) (DataWallet, error)
- func (dw *LocalDataWallet) RevokeAccessKey(ctx context.Context, keyID string) error
- func (dw *LocalDataWallet) RootIndex(ctx context.Context) (index.RootIndex, error)
- func (dw *LocalDataWallet) Services() Services
- func (dw *LocalDataWallet) SetProperty(ctx context.Context, key string, value string, lvl model.AccessLevel) error
- func (dw *LocalDataWallet) SubAccounts(ctx context.Context) ([]*account.Account, error)
- func (dw *LocalDataWallet) Unlock(ctx context.Context, passphrase string) error
- func (dw *LocalDataWallet) UnlockAsChild(ctx context.Context, parentNode slip10.Node) error
- func (dw *LocalDataWallet) UnlockAsManaged(ctx context.Context, managedKey *model.AESKey) error
- func (dw *LocalDataWallet) UnlockWithAccessKey(ctx context.Context, apiKey, apiSecret string) error
- type LocalFactory
- func (lf *LocalFactory) CreateDataWallet(acct *account.Account) (DataWallet, error)
- func (lf *LocalFactory) GetWalletWithAccessKey(ctx context.Context, apiKey, apiSecret string) (DataWallet, error)
- func (lf *LocalFactory) RegisterAccount(ctx context.Context, acctTemplate *account.Account, opts ...account.Option) (DataWallet, *RecoveryDetails, error)
- func (lf *LocalFactory) SaveAccount(ctx context.Context, acct *account.Account) (DataWallet, error)
- type LocalNodeClient
- func (lnc *LocalNodeClient) BlobManager() model.BlobManager
- func (lnc *LocalNodeClient) Close() error
- func (lnc *LocalNodeClient) CreateAccessKey(ctx context.Context, key *model.AccessKey) (*model.AccessKey, error)
- func (lnc *LocalNodeClient) CreateAccount(ctx context.Context, acct *account.Account, registrationCode string) error
- func (lnc *LocalNodeClient) CreateDIDDocument(ctx context.Context, ddoc *model.DIDDocument) error
- func (lnc *LocalNodeClient) CreateSubAccount(ctx context.Context, acct *account.Account) (*account.Account, error)
- func (lnc *LocalNodeClient) DIDProvider() model.DIDProvider
- func (lnc *LocalNodeClient) DeleteAccessKey(ctx context.Context, keyID string) error
- func (lnc *LocalNodeClient) DeleteAccount(ctx context.Context, id string) error
- func (lnc *LocalNodeClient) DeleteProperty(ctx context.Context, hash string) error
- func (lnc *LocalNodeClient) GetAccessKey(ctx context.Context, keyID string) (*model.AccessKey, error)
- func (lnc *LocalNodeClient) GetAccount(ctx context.Context, id string) (*account.Account, error)
- func (lnc *LocalNodeClient) GetDIDDocument(ctx context.Context, iid string) (*model.DIDDocument, error)
- func (lnc *LocalNodeClient) GetIdentity(ctx context.Context, hash string) (*account.DataEnvelope, error)
- func (lnc *LocalNodeClient) GetLocker(ctx context.Context, hash string) (*account.DataEnvelope, error)
- func (lnc *LocalNodeClient) GetOwnAccount(ctx context.Context) (*account.Account, error)
- func (lnc *LocalNodeClient) GetProperty(ctx context.Context, hash string) (*account.DataEnvelope, error)
- func (lnc *LocalNodeClient) Ledger() model.Ledger
- func (lnc *LocalNodeClient) ListAccessKeys(ctx context.Context) ([]*model.AccessKey, error)
- func (lnc *LocalNodeClient) ListIdentities(ctx context.Context) ([]*account.DataEnvelope, error)
- func (lnc *LocalNodeClient) ListLockers(ctx context.Context) ([]*account.DataEnvelope, error)
- func (lnc *LocalNodeClient) ListProperties(ctx context.Context) ([]*account.DataEnvelope, error)
- func (lnc *LocalNodeClient) ListSubAccounts(ctx context.Context, id string) ([]*account.Account, error)
- func (lnc *LocalNodeClient) NewInstance(ctx context.Context, email, passphrase string, isHash bool) (NodeClient, error)
- func (lnc *LocalNodeClient) NotificationService() (notification.Service, error)
- func (lnc *LocalNodeClient) OffChainStorage() model.OffChainStorage
- func (lnc *LocalNodeClient) PatchAccount(ctx context.Context, ...) error
- func (lnc *LocalNodeClient) StoreIdentity(ctx context.Context, idy *account.DataEnvelope) error
- func (lnc *LocalNodeClient) StoreLocker(ctx context.Context, l *account.DataEnvelope) error
- func (lnc *LocalNodeClient) StoreProperty(ctx context.Context, prop *account.DataEnvelope) error
- func (lnc *LocalNodeClient) SubAccountInstance(subAccountID string) (NodeClient, error)
- func (lnc *LocalNodeClient) UpdateAccount(ctx context.Context, acct *account.Account) error
- type Locker
- type LockerOption
- type NodeClient
- type RecoveryDetails
- type RestrictedNodeClient
- func (r *RestrictedNodeClient) BlobManager() model.BlobManager
- func (r *RestrictedNodeClient) Close() error
- func (r *RestrictedNodeClient) CreateAccessKey(ctx context.Context, key *model.AccessKey) (*model.AccessKey, error)
- func (r *RestrictedNodeClient) CreateAccount(ctx context.Context, acct *account.Account, registrationCode string) error
- func (r *RestrictedNodeClient) CreateSubAccount(ctx context.Context, acct *account.Account) (*account.Account, error)
- func (r *RestrictedNodeClient) DIDProvider() model.DIDProvider
- func (r *RestrictedNodeClient) DeleteAccessKey(ctx context.Context, keyID string) error
- func (r *RestrictedNodeClient) DeleteAccount(ctx context.Context, id string) error
- func (r *RestrictedNodeClient) DeleteProperty(ctx context.Context, hash string) error
- func (r *RestrictedNodeClient) GetAccessKey(ctx context.Context, aid string) (*model.AccessKey, error)
- func (r *RestrictedNodeClient) GetAccount(ctx context.Context, id string) (*account.Account, error)
- func (r *RestrictedNodeClient) GetIdentity(ctx context.Context, hash string) (*account.DataEnvelope, error)
- func (r *RestrictedNodeClient) GetLocker(ctx context.Context, hash string) (*account.DataEnvelope, error)
- func (r *RestrictedNodeClient) GetOwnAccount(ctx context.Context) (*account.Account, error)
- func (r *RestrictedNodeClient) GetProperty(ctx context.Context, hash string) (*account.DataEnvelope, error)
- func (r *RestrictedNodeClient) Ledger() model.Ledger
- func (r *RestrictedNodeClient) ListAccessKeys(ctx context.Context) ([]*model.AccessKey, error)
- func (r *RestrictedNodeClient) ListIdentities(ctx context.Context) ([]*account.DataEnvelope, error)
- func (r *RestrictedNodeClient) ListLockers(ctx context.Context) ([]*account.DataEnvelope, error)
- func (r *RestrictedNodeClient) ListProperties(ctx context.Context) ([]*account.DataEnvelope, error)
- func (r *RestrictedNodeClient) ListSubAccounts(ctx context.Context, id string) ([]*account.Account, error)
- func (r *RestrictedNodeClient) NewInstance(ctx context.Context, email, passphrase string, isHash bool) (NodeClient, error)
- func (r *RestrictedNodeClient) NotificationService() (notification.Service, error)
- func (r *RestrictedNodeClient) OffChainStorage() model.OffChainStorage
- func (r *RestrictedNodeClient) PatchAccount(ctx context.Context, ...) error
- func (r *RestrictedNodeClient) StoreIdentity(ctx context.Context, idy *account.DataEnvelope) error
- func (r *RestrictedNodeClient) StoreLocker(ctx context.Context, l *account.DataEnvelope) error
- func (r *RestrictedNodeClient) StoreProperty(ctx context.Context, prop *account.DataEnvelope) error
- func (r *RestrictedNodeClient) SubAccountInstance(subAccountID string) (NodeClient, error)
- func (r *RestrictedNodeClient) UpdateAccount(ctx context.Context, acct *account.Account) error
- type Services
Constants ¶
const ( AccountUpdateType = "AccountUpdate" MetaLeaseDurationYears = 100 )
Variables ¶
var ( ErrRecordNotFoundInRootIndex = errors.New("record not found in root index") ErrSenderNotFound = errors.New("sender not found") ErrRecipientNotFound = errors.New("recipient not found") ErrLeaseRevokedAndPurged = errors.New("lease revoked and purged") )
var ( ErrInsufficientLockLevel = errors.New("insufficient wallet lock level") ErrWalletLocked = errors.New("data wallet is locked") )
var (
ErrForbiddenOperation = errors.New("forbidden operation with restricted wallet")
)
Functions ¶
func ApplyAccountUpdate ¶ added in v1.2.0
func ApplyAccountUpdate(ctx context.Context, ai AccountIndex, update *AccountUpdate, dw DataWallet) error
func ForceSyncRootIndex ¶
func ForceSyncRootIndex(dw DataWallet) error
func InitAccountIndex ¶ added in v1.2.0
func InitAccountIndex(ctx context.Context, ai AccountIndex, dw DataWallet) error
func SaveNewAccount ¶
func SaveNewAccount(ctx context.Context, resp *account.GenerationResponse, nodeClient NodeClient, registrationCode string, hashFunction account.PasswordHashFunction) error
Types ¶
type AccountBackend ¶
type AccountBackend interface { CreateAccount(ctx context.Context, account *account.Account, registrationCode string) error GetOwnAccount(ctx context.Context) (*account.Account, error) GetAccount(ctx context.Context, id string) (*account.Account, error) UpdateAccount(ctx context.Context, account *account.Account) error PatchAccount(ctx context.Context, email, oldEncryptedPassword, newEncryptedPassword, name, givenName, familyName string) error DeleteAccount(ctx context.Context, id string) error CreateSubAccount(ctx context.Context, account *account.Account) (*account.Account, error) ListSubAccounts(ctx context.Context, id string) ([]*account.Account, error) CreateAccessKey(ctx context.Context, key *model.AccessKey) (*model.AccessKey, error) GetAccessKey(ctx context.Context, keyID string) (*model.AccessKey, error) DeleteAccessKey(ctx context.Context, keyID string) error ListAccessKeys(ctx context.Context) ([]*model.AccessKey, error) StoreIdentity(ctx context.Context, idy *account.DataEnvelope) error GetIdentity(ctx context.Context, hash string) (*account.DataEnvelope, error) ListIdentities(ctx context.Context) ([]*account.DataEnvelope, error) StoreLocker(ctx context.Context, l *account.DataEnvelope) error GetLocker(ctx context.Context, hash string) (*account.DataEnvelope, error) ListLockers(ctx context.Context) ([]*account.DataEnvelope, error) StoreProperty(ctx context.Context, prop *account.DataEnvelope) error GetProperty(ctx context.Context, hash string) (*account.DataEnvelope, error) ListProperties(ctx context.Context) ([]*account.DataEnvelope, error) DeleteProperty(ctx context.Context, hash string) error }
type AccountIndex ¶ added in v1.2.0
type AccountIndex interface { UpdateAccount(acct *account.Account) error UpdateIdentity(accountID string, idy Identity) error UpdateLocker(accountID string, l Locker) error }
AccountIndex allows indexing information that is not available in MetaLocker datasets. If you pass an index that implements AccountIndex interface to IndexUpdater, it will receive updates about account components.
type AccountUpdate ¶
type AccountUpdate struct { Type string `json:"type"` AccountID string `json:"a"` AccessLevel model.AccessLevel `json:"lvl"` IdentitiesAdded []string `json:"ida,omitempty"` IdentitiesRemoved []string `json:"idr,omitempty"` LockersOpened []string `json:"lop,omitempty"` LockersClosed []string `json:"lcl,omitempty"` SubAccountsAdded []string `json:"saa,omitempty"` SubAccountsRemoved []string `json:"sar,omitempty"` IndexesAdded []string `json:"ixa,omitempty"` IndexesRemoved []string `json:"ixr,omitempty"` }
type AccountUpdateMessage ¶
type DataSetStoreConstructor ¶
type DataSetStoreConstructor func(dataWallet DataWallet, services Services) (DataStore, error)
type DataStore ¶
type DataStore interface { // NewDataSetBuilder returns an instance of dataset.Builder that enables interactive construction // of a dataset. NewDataSetBuilder(ctx context.Context, lockerID string, opts ...dataset.BuilderOption) (dataset.Builder, error) // Load returns an interface to interact with the dataset behind the given record ID. Load(ctx context.Context, id string, opts ...dataset.LoadOption) (model.DataSet, error) // Revoke revokes for the lease for the dataset behind the given record ID. Revoke(ctx context.Context, id string) dataset.RecordFuture // AssetHead returns the dataset that is a head with the given ID. AssetHead(ctx context.Context, headID string, opts ...dataset.LoadOption) (model.DataSet, error) // SetAssetHead sets the record with the given ID as a head for the dataset with the given asset ID, // name and for the given locker. SetAssetHead(ctx context.Context, assetID string, locker *model.Locker, headName string, recordID string) dataset.RecordFuture // to this record) through the locker. Share(ctx context.Context, ds model.DataSet, locker Locker, vaultName string, expiryTime time.Time) dataset.RecordFuture // PurgeDataAssets purges all data assets (resources) for the given revoked lease. PurgeDataAssets(ctx context.Context, recordID string) error }
DataStore is a direct interface to dataset management operations for the enclosing data wallet.
type DataWallet ¶
type DataWallet interface { io.Closer // ID returns the account ID. ID() string // Account returns the full account definition. Account() *account.Account // ChangePassphrase updates the passphrase for the account. If isHash is true, // the provided passphrase is a double SHA256 of the passphrase, not the cleartext // passphrase. ChangePassphrase(ctx context.Context, oldPassphrase, newPassphrase string, isHash bool) (DataWallet, error) // ChangeEmail changes the email of the account. ChangeEmail(ctx context.Context, email string) error // Recover enables account recovery, in the passphrase has been lost. Recover(ctx context.Context, cryptoKey *model.AESKey, newPassphrase string) (DataWallet, error) // EncryptionKey derives a deterministic AES key for the given tag. We assume that this derivation // can be repeated by the user at any time, producing the same key. Only a party in possession of // the user's secrets can produce a key. // This is useful for encrypting data stored outside the main MetaLocker platform. For instance, // external indexes can rely on this function. EncryptionKey(tag string, accessLevel model.AccessLevel) (*model.AESKey, error) // LockLevel returns the wallet's current lock level LockLevel() model.AccessLevel // Lock locks the data wallet and clears all sensitive information held in memory. Lock() error // Unlock unlocks the data wallet using a passphrase. Data wallet needs to be unlocked // to perform the majority of operations with the underlying account and its data. Unlock(ctx context.Context, passphrase string) error // UnlockAsManaged unlocks the data wallet at 'managed' level using the provided key. UnlockAsManaged(ctx context.Context, managedKey *model.AESKey) error // UnlockWithAccessKey unlocks the data wallet using an access key. Access level depends on the underlying // key's access level. UnlockWithAccessKey(ctx context.Context, apiKey, apiSecret string) error // UnlockAsChild unlock the data wallet for sub-account using its parent secret. UnlockAsChild(ctx context.Context, parentNode slip10.Node) error CreateSubAccount(ctx context.Context, accessLevel model.AccessLevel, name string, opts ...account.Option) (DataWallet, error) GetSubAccount(ctx context.Context, id string) (*account.Account, error) DeleteSubAccount(ctx context.Context, id string) error SubAccounts(ctx context.Context) ([]*account.Account, error) GetSubAccountWallet(ctx context.Context, id string) (DataWallet, error) CreateAccessKey(ctx context.Context, accessLevel model.AccessLevel, duration time.Duration) (*model.AccessKey, error) GetAccessKey(ctx context.Context, keyID string) (*model.AccessKey, error) RevokeAccessKey(ctx context.Context, keyID string) error AccessKeys(ctx context.Context) ([]*model.AccessKey, error) RestrictedWallet(identities []string) (DataWallet, error) NewIdentity(ctx context.Context, accessLevel model.AccessLevel, name string, options ...IdentityOption) (Identity, error) AddIdentity(ctx context.Context, idy *account.Identity) error GetIdentities(ctx context.Context) (map[string]Identity, error) GetIdentity(ctx context.Context, iid string) (Identity, error) GetDID(ctx context.Context, iid string) (*model.DID, error) GetRootIdentity(ctx context.Context) (Identity, error) AddLocker(ctx context.Context, l *model.Locker) (Locker, error) GetLockers(ctx context.Context) ([]*model.Locker, error) GetLocker(ctx context.Context, lockerID string) (Locker, error) GetRootLocker(ctx context.Context, level model.AccessLevel) (Locker, error) GetProperty(ctx context.Context, key string) (string, error) SetProperty(ctx context.Context, key string, value string, lvl model.AccessLevel) error GetProperties(ctx context.Context) (map[string]string, error) DeleteProperty(ctx context.Context, key string, lvl model.AccessLevel) error CreateRootIndex(ctx context.Context, indexStoreName string) (index.RootIndex, error) RootIndex(ctx context.Context) (index.RootIndex, error) CreateIndex(ctx context.Context, indexStoreName, indexType string, opts ...index.Option) (index.Index, error) Index(ctx context.Context, id string) (index.Index, error) IndexUpdater(ctx context.Context, indexes ...index.Index) (*IndexUpdater, error) DataStore() DataStore Services() Services // Backend function is used to access raw identity and locker storage operations // in downstream infrastructure such as Digital Twins. Backend() AccountBackend }
DataWallet is the main interface to the user's account and its data stored in MetaLocker. It incorporates all the complexity of interacting with encrypted resources, the main MetaLocker ledger, indexes, etc.
type DataWalletBackendBuilderFn ¶
type DataWalletBackendBuilderFn func(acct *account.Account) (NodeClient, error)
type Factory ¶
type Factory interface { // GetWalletWithAccessKey returns an unlocked data wallet instance for the given access key and secret. GetWalletWithAccessKey(ctx context.Context, apiKey, apiSecret string) (DataWallet, error) }
Factory provides an interface for creating Data Wallets for the given API key ID and secret. This interface can hide details how the wallet is constructed and whether it's local or remote.
type ForceSyncMessage ¶
type Identity ¶
type Identity interface { // ID returns the identity's ID ID() string // DID returns the identity's full DID definition, including its keys. DID() *model.DID // CreatedAt returns the time when the identity was created. CreatedAt() *time.Time // Name returns the name of the identity (only accessible to the account owner // for navigation/documentation purposes). Name() string // SetName is NOT SUPPORTED YET. SetName(name string) error // AccessLevel returns the identity's access level. Data wallet needs to // be unlocked to a specific access level to gain access to identities // at this level or higher. AccessLevel() model.AccessLevel // Raw returns the raw identity definition (as stored in the backend). Raw() *account.Identity // NewLocker creates a new locker for the identity. Use Participant option // to add other participants to the locker. NewLocker(ctx context.Context, name string, options ...LockerOption) (Locker, error) }
Identity is an interface to a specific identity, one of many, stored in the account's data wallet.
type IdentityOption ¶
type IdentityOption func(opts *identityOptions) error
IdentityOption is for defining parameters when creating new identities
func WithDID ¶
func WithDID(did *model.DID) IdentityOption
func WithType ¶
func WithType(identityType string) IdentityOption
type IndexUpdater ¶
type IndexUpdater struct {
// contains filtered or unexported fields
}
func NewIndexUpdater ¶
func NewIndexUpdater(ledger model.Ledger) *IndexUpdater
func (*IndexUpdater) AddIndexes ¶
func (ixf *IndexUpdater) AddIndexes(ctx context.Context, dw DataWallet, indexes ...index.Index) error
func (*IndexUpdater) Close ¶
func (ixf *IndexUpdater) Close() error
func (*IndexUpdater) RemoveIndex ¶ added in v1.2.0
func (ixf *IndexUpdater) RemoveIndex(indexID string) error
func (*IndexUpdater) StartSyncOnEvents ¶
func (ixf *IndexUpdater) StartSyncOnEvents(ns notification.Service, syncOnStart bool, forceSyncInterval time.Duration) error
func (*IndexUpdater) StopSyncOnEvents ¶
func (ixf *IndexUpdater) StopSyncOnEvents()
func (*IndexUpdater) SyncNoWait ¶
func (ixf *IndexUpdater) SyncNoWait()
type LocalDataWallet ¶
type LocalDataWallet struct {
// contains filtered or unexported fields
}
func NewLocalDataWallet ¶
func NewLocalDataWallet(acct *account.Account, nodeClient NodeClient, dataStoreFn DataSetStoreConstructor, indexClient index.Client) (*LocalDataWallet, error)
func (*LocalDataWallet) AccessKeys ¶
func (*LocalDataWallet) Account ¶
func (dw *LocalDataWallet) Account() *account.Account
func (*LocalDataWallet) AddIdentity ¶
func (*LocalDataWallet) Backend ¶
func (dw *LocalDataWallet) Backend() AccountBackend
func (*LocalDataWallet) ChangeEmail ¶
func (dw *LocalDataWallet) ChangeEmail(ctx context.Context, email string) error
func (*LocalDataWallet) ChangePassphrase ¶
func (dw *LocalDataWallet) ChangePassphrase(ctx context.Context, oldPassphrase, newPassphrase string, isHash bool) (DataWallet, error)
func (*LocalDataWallet) Close ¶
func (dw *LocalDataWallet) Close() error
func (*LocalDataWallet) CreateAccessKey ¶
func (dw *LocalDataWallet) CreateAccessKey(ctx context.Context, accessLevel model.AccessLevel, duration time.Duration) (*model.AccessKey, error)
func (*LocalDataWallet) CreateIndex ¶
func (*LocalDataWallet) CreateRootIndex ¶
func (*LocalDataWallet) CreateSubAccount ¶
func (dw *LocalDataWallet) CreateSubAccount(ctx context.Context, accessLevel model.AccessLevel, name string, opts ...account.Option) (DataWallet, error)
func (*LocalDataWallet) DataStore ¶
func (dw *LocalDataWallet) DataStore() DataStore
func (*LocalDataWallet) DeleteProperty ¶
func (dw *LocalDataWallet) DeleteProperty(ctx context.Context, key string, lvl model.AccessLevel) error
func (*LocalDataWallet) DeleteSubAccount ¶
func (dw *LocalDataWallet) DeleteSubAccount(ctx context.Context, id string) error
func (*LocalDataWallet) EncryptionKey ¶
func (dw *LocalDataWallet) EncryptionKey(tag string, accessLevel model.AccessLevel) (*model.AESKey, error)
func (*LocalDataWallet) GetAccessKey ¶
func (*LocalDataWallet) GetIdentities ¶
func (*LocalDataWallet) GetIdentity ¶
func (*LocalDataWallet) GetLockers ¶
func (*LocalDataWallet) GetProperties ¶
func (*LocalDataWallet) GetProperty ¶
func (*LocalDataWallet) GetRootIdentity ¶
func (dw *LocalDataWallet) GetRootIdentity(ctx context.Context) (Identity, error)
func (*LocalDataWallet) GetRootLocker ¶
func (dw *LocalDataWallet) GetRootLocker(ctx context.Context, level model.AccessLevel) (Locker, error)
func (*LocalDataWallet) GetSubAccount ¶
func (*LocalDataWallet) GetSubAccountWallet ¶
func (dw *LocalDataWallet) GetSubAccountWallet(ctx context.Context, id string) (DataWallet, error)
func (*LocalDataWallet) ID ¶
func (dw *LocalDataWallet) ID() string
func (*LocalDataWallet) IndexUpdater ¶
func (dw *LocalDataWallet) IndexUpdater(ctx context.Context, indexes ...index.Index) (*IndexUpdater, error)
func (*LocalDataWallet) Lock ¶
func (dw *LocalDataWallet) Lock() error
Lock performs a best try effort to remove and zero all secret keys associated with the wallet.
This function will return an error if invoked on a watching-only wallet.
func (*LocalDataWallet) LockLevel ¶
func (dw *LocalDataWallet) LockLevel() model.AccessLevel
LockLevel returns the current level of wallet access.
func (*LocalDataWallet) NewIdentity ¶
func (dw *LocalDataWallet) NewIdentity(ctx context.Context, accessLevel model.AccessLevel, name string, options ...IdentityOption) (Identity, error)
func (*LocalDataWallet) Recover ¶
func (dw *LocalDataWallet) Recover(ctx context.Context, cryptoKey *model.AESKey, newPassphrase string) (DataWallet, error)
func (*LocalDataWallet) RestrictedWallet ¶
func (dw *LocalDataWallet) RestrictedWallet(identities []string) (DataWallet, error)
func (*LocalDataWallet) RevokeAccessKey ¶
func (dw *LocalDataWallet) RevokeAccessKey(ctx context.Context, keyID string) error
func (*LocalDataWallet) Services ¶
func (dw *LocalDataWallet) Services() Services
func (*LocalDataWallet) SetProperty ¶
func (dw *LocalDataWallet) SetProperty(ctx context.Context, key string, value string, lvl model.AccessLevel) error
func (*LocalDataWallet) SubAccounts ¶
func (*LocalDataWallet) Unlock ¶
func (dw *LocalDataWallet) Unlock(ctx context.Context, passphrase string) error
func (*LocalDataWallet) UnlockAsChild ¶
func (*LocalDataWallet) UnlockAsManaged ¶
func (*LocalDataWallet) UnlockWithAccessKey ¶
func (dw *LocalDataWallet) UnlockWithAccessKey(ctx context.Context, apiKey, apiSecret string) error
type LocalFactory ¶
type LocalFactory struct {
// contains filtered or unexported fields
}
func NewLocalFactory ¶
func NewLocalFactory(ledger model.Ledger, offChainStorage model.OffChainStorage, blobManager model.BlobManager, identityBackend storage.IdentityBackend, notificationService notification.Service, indexClient index.Client, hashFunction account.PasswordHashFunction) (*LocalFactory, error)
func (*LocalFactory) CreateDataWallet ¶
func (lf *LocalFactory) CreateDataWallet(acct *account.Account) (DataWallet, error)
func (*LocalFactory) GetWalletWithAccessKey ¶
func (lf *LocalFactory) GetWalletWithAccessKey(ctx context.Context, apiKey, apiSecret string) (DataWallet, error)
func (*LocalFactory) RegisterAccount ¶
func (lf *LocalFactory) RegisterAccount(ctx context.Context, acctTemplate *account.Account, opts ...account.Option) (DataWallet, *RecoveryDetails, error)
func (*LocalFactory) SaveAccount ¶
func (lf *LocalFactory) SaveAccount(ctx context.Context, acct *account.Account) (DataWallet, error)
type LocalNodeClient ¶
type LocalNodeClient struct {
// contains filtered or unexported fields
}
func NewLocalNodeClient ¶
func NewLocalNodeClient(accountID string, identityBackend storage.IdentityBackend, ledger model.Ledger, offChainStorage model.OffChainStorage, blobManager model.BlobManager, notificationService notification.Service) *LocalNodeClient
func (*LocalNodeClient) BlobManager ¶
func (lnc *LocalNodeClient) BlobManager() model.BlobManager
func (*LocalNodeClient) Close ¶
func (lnc *LocalNodeClient) Close() error
func (*LocalNodeClient) CreateAccessKey ¶
func (*LocalNodeClient) CreateAccount ¶
func (*LocalNodeClient) CreateDIDDocument ¶
func (lnc *LocalNodeClient) CreateDIDDocument(ctx context.Context, ddoc *model.DIDDocument) error
func (*LocalNodeClient) CreateSubAccount ¶
func (*LocalNodeClient) DIDProvider ¶
func (lnc *LocalNodeClient) DIDProvider() model.DIDProvider
func (*LocalNodeClient) DeleteAccessKey ¶
func (lnc *LocalNodeClient) DeleteAccessKey(ctx context.Context, keyID string) error
func (*LocalNodeClient) DeleteAccount ¶
func (lnc *LocalNodeClient) DeleteAccount(ctx context.Context, id string) error
func (*LocalNodeClient) DeleteProperty ¶
func (lnc *LocalNodeClient) DeleteProperty(ctx context.Context, hash string) error
func (*LocalNodeClient) GetAccessKey ¶
func (*LocalNodeClient) GetAccount ¶
func (*LocalNodeClient) GetDIDDocument ¶
func (lnc *LocalNodeClient) GetDIDDocument(ctx context.Context, iid string) (*model.DIDDocument, error)
func (*LocalNodeClient) GetIdentity ¶
func (lnc *LocalNodeClient) GetIdentity(ctx context.Context, hash string) (*account.DataEnvelope, error)
func (*LocalNodeClient) GetLocker ¶
func (lnc *LocalNodeClient) GetLocker(ctx context.Context, hash string) (*account.DataEnvelope, error)
func (*LocalNodeClient) GetOwnAccount ¶
func (*LocalNodeClient) GetProperty ¶
func (lnc *LocalNodeClient) GetProperty(ctx context.Context, hash string) (*account.DataEnvelope, error)
func (*LocalNodeClient) Ledger ¶
func (lnc *LocalNodeClient) Ledger() model.Ledger
func (*LocalNodeClient) ListAccessKeys ¶
func (*LocalNodeClient) ListIdentities ¶
func (lnc *LocalNodeClient) ListIdentities(ctx context.Context) ([]*account.DataEnvelope, error)
func (*LocalNodeClient) ListLockers ¶
func (lnc *LocalNodeClient) ListLockers(ctx context.Context) ([]*account.DataEnvelope, error)
func (*LocalNodeClient) ListProperties ¶
func (lnc *LocalNodeClient) ListProperties(ctx context.Context) ([]*account.DataEnvelope, error)
func (*LocalNodeClient) ListSubAccounts ¶
func (*LocalNodeClient) NewInstance ¶
func (lnc *LocalNodeClient) NewInstance(ctx context.Context, email, passphrase string, isHash bool) (NodeClient, error)
func (*LocalNodeClient) NotificationService ¶
func (lnc *LocalNodeClient) NotificationService() (notification.Service, error)
func (*LocalNodeClient) OffChainStorage ¶
func (lnc *LocalNodeClient) OffChainStorage() model.OffChainStorage
func (*LocalNodeClient) PatchAccount ¶
func (lnc *LocalNodeClient) PatchAccount(ctx context.Context, email, oldEncryptedPassword, newEncryptedPassword, name, givenName, familyName string) error
func (*LocalNodeClient) StoreIdentity ¶
func (lnc *LocalNodeClient) StoreIdentity(ctx context.Context, idy *account.DataEnvelope) error
func (*LocalNodeClient) StoreLocker ¶
func (lnc *LocalNodeClient) StoreLocker(ctx context.Context, l *account.DataEnvelope) error
func (*LocalNodeClient) StoreProperty ¶
func (lnc *LocalNodeClient) StoreProperty(ctx context.Context, prop *account.DataEnvelope) error
func (*LocalNodeClient) SubAccountInstance ¶
func (lnc *LocalNodeClient) SubAccountInstance(subAccountID string) (NodeClient, error)
func (*LocalNodeClient) UpdateAccount ¶
type Locker ¶
type Locker interface { // ID returns the locker ID. ID() string // CreatedAt returns the locker's creation time. For documentation purposes only. CreatedAt() *time.Time // Name returns the locker's name. These names are useful for locker documentation purposes. // They aren't used in any data processing. Name() string // SetName is NOT SUPPORTED YET. SetName(name string) error // AccessLevel returns the locker's access level. Data wallet needs to be unlocked // to a specific access level to gain access to lockers at this level or higher. AccessLevel() model.AccessLevel // Raw returns the raw locker definition (as stored in the backend). Raw() *model.Locker // IsUniLocker returns true, if the locker has just one participant (is a 'uni-locker'). IsUniLocker() bool // IsThirdParty returns true, if the account doesn't have control over any of the locker // participants, but has access to the locker's secrets (a delegated access). IsThirdParty() bool // Us returns the account controlled locker participant (if any). Us() *model.LockerParticipant // Them returns a list of all locker participants that aren't controlled by the account. Them() []*model.LockerParticipant // NewDataSetBuilder returns an instance of dataset.Builder that enables interactive construction // of a dataset. This builder assumes the dataset will be stored in this locker. NewDataSetBuilder(ctx context.Context, opts ...dataset.BuilderOption) (dataset.Builder, error) // Store is a convenience method that submits a dataset with no attachments to this locker. Store(ctx context.Context, meta any, expiryTime time.Time, opts ...dataset.BuilderOption) dataset.RecordFuture // to this record) through the locker. Share(ctx context.Context, id, vaultName string, expiryTime time.Time) dataset.RecordFuture // HeadID returns the ID of the dataset head for the given asset ID and head name (and linked // to the locker). HeadID(ctx context.Context, assetID string, headName string) string // SetAssetHead sets the record with the given ID as a head for the dataset with the given asset ID. SetAssetHead(ctx context.Context, assetID, headName, recordID string) dataset.RecordFuture // Seal closes the locker. NOT CURRENTLY SUPPORTED. Seal(ctx context.Context) error }
Locker is an interface to the account's lockers (secure, persistent, bidirectional communication channels between two or more participants).
type LockerOption ¶
type LockerOption func(opts *lockerOptions) error
LockerOption is for defining parameters when creating new lockers
func ExpiresAt ¶
func ExpiresAt(expiresAt time.Time) LockerOption
func FixedSeed ¶
func FixedSeed(seed []byte) LockerOption
func Participant ¶
func Participant(did *model.DID, seed []byte) LockerOption
type NodeClient ¶
type NodeClient interface { io.Closer AccountBackend Services NewInstance(ctx context.Context, email, passphrase string, isHash bool) (NodeClient, error) SubAccountInstance(subAccountID string) (NodeClient, error) }
NodeClient is an interface to a MetaLocker node that data wallets require to perform data management operations.
type RecoveryDetails ¶
type RestrictedNodeClient ¶
type RestrictedNodeClient struct {
// contains filtered or unexported fields
}
func NewRestrictedNodeClient ¶
func NewRestrictedNodeClient(identities []string, nodeClient NodeClient) *RestrictedNodeClient
NewRestrictedNodeClient is currently not in use, since we moved to encrypted identities/lockers
func (*RestrictedNodeClient) BlobManager ¶
func (r *RestrictedNodeClient) BlobManager() model.BlobManager
func (*RestrictedNodeClient) Close ¶
func (r *RestrictedNodeClient) Close() error
func (*RestrictedNodeClient) CreateAccessKey ¶
func (*RestrictedNodeClient) CreateAccount ¶
func (*RestrictedNodeClient) CreateSubAccount ¶
func (*RestrictedNodeClient) DIDProvider ¶
func (r *RestrictedNodeClient) DIDProvider() model.DIDProvider
func (*RestrictedNodeClient) DeleteAccessKey ¶
func (r *RestrictedNodeClient) DeleteAccessKey(ctx context.Context, keyID string) error
func (*RestrictedNodeClient) DeleteAccount ¶
func (r *RestrictedNodeClient) DeleteAccount(ctx context.Context, id string) error
func (*RestrictedNodeClient) DeleteProperty ¶
func (r *RestrictedNodeClient) DeleteProperty(ctx context.Context, hash string) error
func (*RestrictedNodeClient) GetAccessKey ¶
func (*RestrictedNodeClient) GetAccount ¶
func (*RestrictedNodeClient) GetIdentity ¶
func (r *RestrictedNodeClient) GetIdentity(ctx context.Context, hash string) (*account.DataEnvelope, error)
func (*RestrictedNodeClient) GetLocker ¶
func (r *RestrictedNodeClient) GetLocker(ctx context.Context, hash string) (*account.DataEnvelope, error)
func (*RestrictedNodeClient) GetOwnAccount ¶
func (*RestrictedNodeClient) GetProperty ¶
func (r *RestrictedNodeClient) GetProperty(ctx context.Context, hash string) (*account.DataEnvelope, error)
func (*RestrictedNodeClient) Ledger ¶
func (r *RestrictedNodeClient) Ledger() model.Ledger
func (*RestrictedNodeClient) ListAccessKeys ¶
func (*RestrictedNodeClient) ListIdentities ¶
func (r *RestrictedNodeClient) ListIdentities(ctx context.Context) ([]*account.DataEnvelope, error)
func (*RestrictedNodeClient) ListLockers ¶
func (r *RestrictedNodeClient) ListLockers(ctx context.Context) ([]*account.DataEnvelope, error)
func (*RestrictedNodeClient) ListProperties ¶
func (r *RestrictedNodeClient) ListProperties(ctx context.Context) ([]*account.DataEnvelope, error)
func (*RestrictedNodeClient) ListSubAccounts ¶
func (*RestrictedNodeClient) NewInstance ¶
func (r *RestrictedNodeClient) NewInstance(ctx context.Context, email, passphrase string, isHash bool) (NodeClient, error)
func (*RestrictedNodeClient) NotificationService ¶
func (r *RestrictedNodeClient) NotificationService() (notification.Service, error)
func (*RestrictedNodeClient) OffChainStorage ¶
func (r *RestrictedNodeClient) OffChainStorage() model.OffChainStorage
func (*RestrictedNodeClient) PatchAccount ¶
func (r *RestrictedNodeClient) PatchAccount(ctx context.Context, email, oldEncryptedPassword, newEncryptedPassword, name, givenName, familyName string) error
func (*RestrictedNodeClient) StoreIdentity ¶
func (r *RestrictedNodeClient) StoreIdentity(ctx context.Context, idy *account.DataEnvelope) error
func (*RestrictedNodeClient) StoreLocker ¶
func (r *RestrictedNodeClient) StoreLocker(ctx context.Context, l *account.DataEnvelope) error
func (*RestrictedNodeClient) StoreProperty ¶
func (r *RestrictedNodeClient) StoreProperty(ctx context.Context, prop *account.DataEnvelope) error
func (*RestrictedNodeClient) SubAccountInstance ¶
func (r *RestrictedNodeClient) SubAccountInstance(subAccountID string) (NodeClient, error)
func (*RestrictedNodeClient) UpdateAccount ¶
type Services ¶
type Services interface { DIDProvider() model.DIDProvider OffChainStorage() model.OffChainStorage Ledger() model.Ledger BlobManager() model.BlobManager NotificationService() (notification.Service, error) }
Services is an interface to MetaLocker services that are necessary for data wallet operations. It is assumed all the operations with these services will be authenticated against the data wallet's account.