Skip to content

Stampery API for Cocoa/iOS. Notarize all your data using the blockchain

License

Notifications You must be signed in to change notification settings

stampery/StamperyKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StamperyKit

CI Status Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

TODO

  • Tests. Tests. Tests!!
  • Caching
  • Persistence

Installation

StamperyKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "StamperyKit"

Usage

First, import the library:

#import <StamperyKit/StamperyKit.h>

Then, calling to the +sharedInstance method will initialize the library.

Examples

Login

NSString *emailString = @"[email protected]"
NSString *passwordString = @"some-p@ssw0rd"
	
[[StamperyKit sharedInstance] loginWithEmail:emailString andPassword:passwordString completion:^(id response) {
	// Response contains the HTTP body
	// Once logged in, [[StamperyKit sharedInstance] userProfile] will contain the user profile
} errorBlock:^(NSError *error) {
	// error contains a NSError instance with the given error
}];

Sign up

NSString *emailString = @"[email protected]";
NSString *passwordString = @"some-p@ssw0rd";
NSString *nameString = @"John Doe";
	
[[StamperyKit sharedInstance] registerWithEmail:emailString password:passwordString name:nameString completion:^(id response) {
	// Response contains the HTTP body
	// Once logged in, [[StamperyKit sharedInstance] userProfile] will contain the user profile
} errorBlock:^(NSError *error) {
	// error contains a NSError instance with the given error
}];

List stamps [needs login]

[[StamperyKit sharedInstance] listStampsWithCompletion:^(id response) {
	// Response will contain a NSArray containing 'Stamp' elements
} errorBlock:^(NSError * error) {
	// error contains a NSError instance with the given error
}];

Get stamp details

NSString *stampHash = @"xxx-xxx-xxx";

[[StamperyKit sharedInstance] detailsForStampHash:stampHash completion:^(id response) {
	// response has an instance of Stamp, containing the specified stamp info
} errorBlock:^(NSError *error) {
	// error contains the raised error
}];

Stamping This part will change eventually to make the library less opinionated. For now you can only stamp a file, by creating a PreStamp instance

PreStamp *preStamp = [[PreStamp alloc] ...];
BOOL backupStamp = YES;

[[StamperyKit sharedInstance] stampFile:preStamp backupFile:backupStamp completion:^(id response) {
	// response contains the server response
} errorBlock:^(NSError *error) {
	// error contains the raised error
}];

These are the basic methods to start using basic functionality. Check StamperyKit.h for the full list of methods

Author

Pablo Merino, [email protected]

License

StamperyKit is available under the MIT license. See the LICENSE file for more info.

About

Stampery API for Cocoa/iOS. Notarize all your data using the blockchain

Resources

License

Stars

Watchers

Forks

Packages

No packages published