Skip to content
No description, website, or topics provided.
Objective-C Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Update ci version of xcode Nov 13, 2019
Example
IpfsLiteApi Update to latest grpc-ipfs-lite, fix up method names Nov 16, 2019
pb Update to latest grpc-ipfs-lite, fix up method names Nov 16, 2019
.gitignore Add fastlane and circle ci config Nov 13, 2019
.travis.yml Initial commit Nov 7, 2019
CONTRIBUTING.md Updated readme, added contributing Nov 13, 2019
Gemfile Add fastlane and circle ci config Nov 13, 2019
Gemfile.lock Add fastlane and circle ci config Nov 13, 2019
IpfsLiteApi.podspec Update to latest grpc-ipfs-lite, fix up method names Nov 16, 2019
LICENSE Initial commit Nov 7, 2019
README.md Update to latest grpc-ipfs-lite, fix up method names Nov 16, 2019
_Pods.xcodeproj Initial commit Nov 7, 2019

README.md

ios-ipfs-lite

Made by Textile Chat on Slack GitHub license Release Version License Platform CircleCI branch docs standard-readme compliant

A lightweight, extensible IPFS peer for iOS.

IPFS Lite runs the minimal setup required to get and put IPLD DAGs on the IPFS network. It is a port of the Go IPFS Lite library.

Table of Contents

Background

IPFS Lite runs the minimal setup required to provide a DAG service. It is a port of the Go IPFS Lite library, and as such, has the same requirements. The goal of IPFS Lite is to run the bare minimal functionality for any IPLD-based application to interact with the IPFS network (by getting and putting blocks). This saves having to deal with the complexities of using a full IPFS daemon, while maintaining the ability to share the underlying libp2p host and DHT with other components.

Roadmap

  • Launch IPFS Lite
  • Stop IPFS Lite
  • addFileFromInput:params:completion: Add data via NSInputStream.
  • getFileWithCid:completion: Asynchronously get file by content address.
  • getFileToOutput:cid:completion: Asynchronously get file by content address and write it to a NSOutputStream
  • getNodeForCid:completion: Asynchronously get an IPLD node from IPFS.
  • getNodesForCids:completion: Get multiple IPLD nodes.
  • hasBlock:completion: Query if the local peer has the specified block
  • removeNodeForCid:completion: Remove an IPLD node.
  • removeNodesForCids:completion: Remove multiple IPLD nodes.
  • resolveLinkInNodeWithCid:path:completion: Resolve a link though a path in an IPLD node.
  • treeInNodeWithCid:fromPath:depth:completion: List all data paths in an IPLD node.
  • addNode And an IPLD node.
  • addNodes And multiple IPLD nodes.

Install

The IPFS Lite library is published as a Cocoapod.

First, you'll need to configure your project to use Cocoapods.

Then, simple add IpfsLiteApi to your Podfile

...
pod 'IpfsLiteApi'
...

and run pod install

Usage

Initialize and start a Peer

NSString *documents = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *repoPath = [documents stringByAppendingPathComponent:@"ipfs-lite"];
NSError *error;
BOOL success = [IpfsLiteApi launch:repoPath debug: false error:&error];

Add data

NSInputStream *input = [[NSInputStream alloc] initWithData:[@"Hello there\n" dataUsingEncoding:NSUTF8StringEncoding]];
[IpfsLiteApi.instance addFileFromInput:input parms:[[TTEAddParams alloc] init] completion:^(Node * _Nullable node, NSError * _Nullable error) {
    // handle the node or error
}];

Add a file

NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"jpeg"];
NSInputStream *input = [[NSInputStream alloc] initWithFileAtPath:path];
[IpfsLiteApi.instance addFileFromInput:input params:[[TTEAddParams alloc] init] completion:^(Node * _Nullable node, NSError * _Nullable error) {
    // handle the node or error
}];

Fetch a file by CID to a NSOutputStream

NSString *documents = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *outputPath = [documents stringByAppendingPathComponent:@"out.jpeg"];
NSOutputStream *output = [NSOutputStream outputStreamToFileAtPath:outputPath append:NO];
[IpfsLiteApi.instance getFileToOutput:output cid:@"<a-file-cid>" completion:^(NSError * _Nullable error) {
    // Handle error if it exists or interact with data written to disk
}];

Fetch a node by CID

[IpfsLiteApi.instance getNodeForCid:@"QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D" completion:^(Node * _Nullable node, NSError * _Nullable error) {
    // handle the node or error
}];

Maintainers

Aaron Sutula

Contributing

See the contributing file!

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT (c) 2019 Textile

You can’t perform that action at this time.