Documentation ¶
Overview ¶
Package mobile contains the simplified mobile APIs to Storj Network.
For API limitations see https://github.com/ethereum/go-ethereum/blob/461291882edce0ac4a28f64c4e8725b7f57cbeae/mobile/doc.go#L23
build loop for development
watchrun gobind -lang=java -outdir=../mobile-out storj.io/storj/mobile == pt skipped ../mobile-out
gomobile bind -target android
To use:
gomobile bind -target android
Create a new project in AndroidStudio ¶
Copy mobile-source.jar and mobile.aar into `AndroidStudioProjects\MyApplication\app\libs\`
Modify build.gradle to also find *.aar files:
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
See example Java file
Index ¶
- Constants
- type APIKey
- type Bucket
- func (bucket *Bucket) Close() error
- func (bucket *Bucket) DeleteObject(objectPath string) error
- func (bucket *Bucket) ListObjects(options *ListOptions) (*ObjectList, error)
- func (bucket *Bucket) NewRangeReader(path storj.Path, start, limit int64, options *ReaderOptions) (*Reader, error)
- func (bucket *Bucket) NewReader(path storj.Path, options *ReaderOptions) (*Reader, error)
- func (bucket *Bucket) NewWriter(path storj.Path, options *WriterOptions) (*Writer, error)
- func (bucket *Bucket) OpenObject(objectPath string) (*ObjectInfo, error)
- type BucketConfig
- type BucketInfo
- type BucketList
- type Caveat
- type CaveatPath
- type Config
- type EncryptionAccess
- func NewEncryptionAccess() *EncryptionAccess
- func NewEncryptionAccessWithDefaultKey(defaultKey []byte) (_ *EncryptionAccess, err error)
- func NewEncryptionAccessWithRoot(bucket, unencryptedPath, encryptedPath string, keyData []byte) (*EncryptionAccess, error)
- func ParseEncryptionAccess(b58data string) (*EncryptionAccess, error)
- func (e *EncryptionAccess) Import(other *EncryptionAccess) error
- func (e *EncryptionAccess) Restrict(satelliteAddr string, apiKey *APIKey, restrictions *EncryptionRestrictions) (_ *Scope, err error)
- func (e *EncryptionAccess) Serialize() (b58data string, err error)
- func (e *EncryptionAccess) SetDefaultKey(keyData []byte) error
- type EncryptionParameters
- type EncryptionRestriction
- type EncryptionRestrictions
- type ListOptions
- type ObjectInfo
- type ObjectList
- type Project
- func (project *Project) Close() error
- func (project *Project) CreateBucket(bucketName string, opts *BucketConfig) (*BucketInfo, error)
- func (project *Project) DeleteBucket(bucketName string) error
- func (project *Project) GetBucketInfo(bucketName string) (*BucketInfo, error)
- func (project *Project) ListBuckets(after string, limit int) (*BucketList, error)
- func (project *Project) OpenBucket(bucketName string, access *EncryptionAccess) (*Bucket, error)
- func (project *Project) SaltedKeyFromPassphrase(passphrase string) (keyData []byte, err error)
- type Reader
- type ReaderOptions
- type RedundancyScheme
- type Scope
- type Uplink
- type Writer
- type WriterOptions
Constants ¶
const ( // CipherSuiteEncUnspecified indicates no encryption suite has been selected. CipherSuiteEncUnspecified = byte(storj.EncUnspecified) // CipherSuiteEncNull indicates use of the NULL cipher; that is, no encryption is // done. The ciphertext is equal to the plaintext. CipherSuiteEncNull = byte(storj.EncNull) // CipherSuiteEncAESGCM indicates use of AES128-GCM encryption. CipherSuiteEncAESGCM = byte(storj.EncAESGCM) // CipherSuiteEncSecretBox indicates use of XSalsa20-Poly1305 encryption, as provided // by the NaCl cryptography library under the name "Secretbox". CipherSuiteEncSecretBox = byte(storj.EncSecretBox) // DirectionForward lists forwards from cursor, including cursor DirectionForward = int(storj.Forward) // DirectionAfter lists forwards from cursor, without cursor DirectionAfter = int(storj.After) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey struct {
// contains filtered or unexported fields
}
APIKey represents an access credential to certain resources
type Bucket ¶
type Bucket struct { Name string // contains filtered or unexported fields }
Bucket represents operations you can perform on a bucket
func (*Bucket) DeleteObject ¶
DeleteObject removes an object, if authorized.
func (*Bucket) ListObjects ¶
func (bucket *Bucket) ListObjects(options *ListOptions) (*ObjectList, error)
ListObjects list objects in bucket, if authorized.
func (*Bucket) NewRangeReader ¶ added in v0.24.0
func (bucket *Bucket) NewRangeReader(path storj.Path, start, limit int64, options *ReaderOptions) (*Reader, error)
NewRangeReader returns new reader for downloading a range from the object.
func (*Bucket) OpenObject ¶
func (bucket *Bucket) OpenObject(objectPath string) (*ObjectInfo, error)
OpenObject returns an Object handle, if authorized.
type BucketConfig ¶
type BucketConfig struct { // PathCipher indicates which cipher suite is to be used for path // encryption within the new Bucket. If not set, AES-GCM encryption // will be used. PathCipher byte // EncryptionParameters specifies the default encryption parameters to // be used for data encryption of new Objects in this bucket. EncryptionParameters *EncryptionParameters // RedundancyScheme defines the default Reed-Solomon and/or // Forward Error Correction encoding parameters to be used by // objects in this Bucket. RedundancyScheme *RedundancyScheme // SegmentsSize is the default segment size to use for new // objects in this Bucket. SegmentsSize int64 }
BucketConfig bucket configuration
type BucketInfo ¶
type BucketInfo struct { Name string Created int64 PathCipher byte SegmentsSize int64 RedundancyScheme *RedundancyScheme EncryptionParameters *EncryptionParameters }
BucketInfo bucket meta struct
type BucketList ¶
type BucketList struct {
// contains filtered or unexported fields
}
BucketList is a list of buckets
func (*BucketList) Item ¶
func (bl *BucketList) Item(index int) (*BucketInfo, error)
Item gets item from specific index
func (*BucketList) Length ¶
func (bl *BucketList) Length() int
Length returns number of returned items
func (*BucketList) More ¶
func (bl *BucketList) More() bool
More returns true if list request was not able to return all results
type Caveat ¶
type Caveat struct { DisallowReads bool DisallowWrites bool DisallowLists bool DisallowDeletes bool AllowedPaths []*CaveatPath // if set, the validity time window NotAfter int64 NotBefore int64 // nonce is set to some random bytes so that you can make arbitrarily // many restricted macaroons with the same (or no) restrictions. Nonce []byte }
Caveat TODO
func (Caveat) AddCaveatPath ¶
func (caveat Caveat) AddCaveatPath(path *CaveatPath)
AddCaveatPath TODO
type CaveatPath ¶
CaveatPath If any entries exist, require all access to happen in at least one of them.
type Config ¶
type Config struct { // MaxInlineSize determines whether the uplink will attempt to // store a new object in the satellite's metainfo. Objects at // or below this size will be marked for inline storage, and // objects above this size will not. (The satellite may reject // the inline storage and require remote storage, still.) MaxInlineSize int64 // MaxMemory is the default maximum amount of memory to be // allocated for read buffers while performing decodes of // objects. (This option is overrideable per Bucket if the user // so desires.) If set to zero, the library default (4 MiB) will // be used. If set to a negative value, the system will use the // smallest amount of memory it can. MaxMemory int64 // SkipPeerCAWhitelist determines whether to require all // remote hosts to have identity certificates signed by // Certificate Authorities in the default whitelist. If // set to true, the whitelist will be ignored. SkipPeerCAWhitelist bool }
Config represents configuration options for an Uplink
type EncryptionAccess ¶
type EncryptionAccess struct {
// contains filtered or unexported fields
}
EncryptionAccess holds data about encryption keys for a bucket.
func NewEncryptionAccess ¶
func NewEncryptionAccess() *EncryptionAccess
NewEncryptionAccess constructs an empty encryption context.
func NewEncryptionAccessWithDefaultKey ¶
func NewEncryptionAccessWithDefaultKey(defaultKey []byte) (_ *EncryptionAccess, err error)
NewEncryptionAccessWithDefaultKey creates an encryption access context with a default key set. Use Project.SaltedKeyFromPassphrase to generate a default key
func NewEncryptionAccessWithRoot ¶
func NewEncryptionAccessWithRoot(bucket, unencryptedPath, encryptedPath string, keyData []byte) (*EncryptionAccess, error)
NewEncryptionAccessWithRoot constructs an encryption access with a key rooted at the provided path inside of a bucket.
func ParseEncryptionAccess ¶
func ParseEncryptionAccess(b58data string) (*EncryptionAccess, error)
ParseEncryptionAccess parses the base58 encoded encryption context data and returns the resulting context.
func (*EncryptionAccess) Import ¶ added in v0.24.0
func (e *EncryptionAccess) Import(other *EncryptionAccess) error
Import merges the other encryption access context into this one. In cases of conflicting path decryption settings (including if both accesses have a default key), the new settings are kept.
func (*EncryptionAccess) Restrict ¶ added in v0.24.0
func (e *EncryptionAccess) Restrict(satelliteAddr string, apiKey *APIKey, restrictions *EncryptionRestrictions) (_ *Scope, err error)
Restrict creates a new EncryptionAccess with no default key, where the key material in the new access is just enough to allow someone to access all of the given restrictions but no more.
func (*EncryptionAccess) Serialize ¶
func (e *EncryptionAccess) Serialize() (b58data string, err error)
Serialize returns a base58-serialized encryption access for use with later parsing.
func (*EncryptionAccess) SetDefaultKey ¶
func (e *EncryptionAccess) SetDefaultKey(keyData []byte) error
SetDefaultKey sets the default key to use when no matching keys are found for the encryption context.
type EncryptionParameters ¶
type EncryptionParameters struct { // CipherSuite specifies the cipher suite to be used for encryption. CipherSuite byte // BlockSize determines the unit size at which encryption is performed. // It is important to distinguish this from the block size used by the // cipher suite (probably 128 bits). There is some small overhead for // each encryption unit, so BlockSize should not be too small, but // smaller sizes yield shorter first-byte latency and better seek times. // Note that BlockSize itself is the size of data blocks _after_ they // have been encrypted and the authentication overhead has been added. // It is _not_ the size of the data blocks to _be_ encrypted. BlockSize int32 }
EncryptionParameters is the cipher suite and parameters used for encryption
type EncryptionRestriction ¶ added in v0.24.0
type EncryptionRestriction struct {
// contains filtered or unexported fields
}
EncryptionRestriction represents a scenario where some set of objects may need to be encrypted/decrypted
func NewEncryptionRestriction ¶ added in v0.24.0
func NewEncryptionRestriction(bucket, path string) *EncryptionRestriction
NewEncryptionRestriction creates new EncryptionRestriction
type EncryptionRestrictions ¶ added in v0.24.0
type EncryptionRestrictions struct {
// contains filtered or unexported fields
}
EncryptionRestrictions combines EncryptionRestriction to overcome gomobile limitation (no arrays)
func NewEncryptionRestrictions ¶ added in v0.24.0
func NewEncryptionRestrictions() *EncryptionRestrictions
NewEncryptionRestrictions creates new EncryptionRestrictions
func (*EncryptionRestrictions) Add ¶ added in v0.24.0
func (e *EncryptionRestrictions) Add(restriction *EncryptionRestriction)
Add adds EncryptionRestriction
type ListOptions ¶
type ListOptions struct { Prefix string Cursor string // Cursor is relative to Prefix, full path is Prefix + Cursor Delimiter int32 Recursive bool Direction int Limit int }
ListOptions options for listing objects
type ObjectInfo ¶
type ObjectInfo struct { Version int32 Bucket string Path string IsPrefix bool Size int64 ContentType string Created int64 Modified int64 Expires int64 // contains filtered or unexported fields }
ObjectInfo object metadata
func (*ObjectInfo) GetMetadata ¶
func (bl *ObjectInfo) GetMetadata(key string) string
GetMetadata gets objects custom metadata
type ObjectList ¶
type ObjectList struct {
// contains filtered or unexported fields
}
ObjectList represents list of objects
func (*ObjectList) Item ¶
func (bl *ObjectList) Item(index int) (*ObjectInfo, error)
Item gets item from specific index
func (*ObjectList) Length ¶
func (bl *ObjectList) Length() int
Length returns number of returned items
func (*ObjectList) More ¶
func (bl *ObjectList) More() bool
More returns true if list request was not able to return all results
func (*ObjectList) Prefix ¶
func (bl *ObjectList) Prefix() string
Prefix prefix for objects from list
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
Project represents a specific project access session.
func (*Project) CreateBucket ¶
func (project *Project) CreateBucket(bucketName string, opts *BucketConfig) (*BucketInfo, error)
CreateBucket creates buckets in project
func (*Project) DeleteBucket ¶
DeleteBucket deletes a bucket if authorized. If the bucket contains any Objects at the time of deletion, they may be lost permanently.
func (*Project) GetBucketInfo ¶
func (project *Project) GetBucketInfo(bucketName string) (*BucketInfo, error)
GetBucketInfo returns info about the requested bucket if authorized.
func (*Project) ListBuckets ¶
func (project *Project) ListBuckets(after string, limit int) (*BucketList, error)
ListBuckets will list authorized buckets.
func (*Project) OpenBucket ¶
func (project *Project) OpenBucket(bucketName string, access *EncryptionAccess) (*Bucket, error)
OpenBucket returns a Bucket handle with the given EncryptionAccess information.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reader for downloading object
type RedundancyScheme ¶
type RedundancyScheme struct { // Algorithm determines the algorithm to be used for redundancy. Algorithm byte ShareSize int32 // segment. RequiredShares int16 // before a repair is triggered. RepairShares int16 OptimalShares int16 // OptimalShares, slower uploads of the excess shares will be aborted in // order to improve performance. TotalShares int16 }
RedundancyScheme specifies the parameters and the algorithm for redundancy
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope is a serializable type that represents all of the credentials you need to open a project and some amount of buckets
func NewScope ¶ added in v0.24.0
func NewScope(satelliteAddr string, apiKey *APIKey, encryptionAccess *EncryptionAccess) *Scope
NewScope creates new Scope
func ParseScope ¶
ParseScope unmarshals a base58 encoded scope protobuf and decodes the fields into the Scope convenience type. It will return an error if the protobuf is malformed or field validation fails.
func (*Scope) EncryptionAccess ¶
func (s *Scope) EncryptionAccess() *EncryptionAccess
EncryptionAccess returns encryption address
func (*Scope) SatelliteAddr ¶
SatelliteAddr return satellite address
type Uplink ¶
type Uplink struct {
// contains filtered or unexported fields
}
Uplink represents the main entrypoint to Storj V3. An Uplink connects to a specific Satellite and caches connections and resources, allowing one to create sessions delineated by specific access controls.
func NewUplink ¶
NewUplink creates a new Uplink. This is the first step to create an uplink session with a user specified config or with default config, if nil config. Uplink needs also writable temporary directory.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer writes data into object
type WriterOptions ¶
type WriterOptions struct { // ContentType, if set, gives a MIME content-type for the Object. ContentType string // Metadata contains additional information about an Object. It can // hold arbitrary textual fields and can be retrieved together with the // Object. Field names can be at most 1024 bytes long. Field values are // not individually limited in size, but the total of all metadata // (fields and values) can not exceed 4 kiB. Metadata map[string]string // Expires is the time at which the new Object can expire (be deleted // automatically from storage nodes). Expires int // EncryptionParameters determines the cipher suite to use for // the Object's data encryption. If not set, the Bucket's // defaults will be used. EncryptionParameters *EncryptionParameters // RedundancyScheme determines the Reed-Solomon and/or Forward // Error Correction encoding parameters to be used for this // Object. RedundancyScheme *RedundancyScheme }
WriterOptions controls options about writing a new Object
func NewWriterOptions ¶
func NewWriterOptions() *WriterOptions
NewWriterOptions creates writer options