signature gem 的 Objective-C 客户端。使用 shared secret 和时间戳通过 SHA256 HMAC 签名 API 调用。
token = [[IGSignatureToken alloc] initWithKey:@"key" secret:@"secret"];
request = [[IGSignatureRequest alloc] initWithMethod:@"POST"
path:@"/some/path"
query:@{@"query": @"params", @"go": @"here"}];
[request sign:token];
NSMutableDictionary* queryParams = [NSMutableDictionary dictionaryWithDictionary:[request auth]];
[queryParams addEntriesFromDictionary:[request query]];
queryParams
类似于
{
@"query": @"params",
@"go": @"here",
@"auth_version": @"1.0",
@"auth_key": @"key",
@"auth_timestamp": 1234,
@"auth_signature": @"3b237953a5ba6619875cbb2a2d43e8da9ef5824e8a2c689f6284ac85bc1ea0db"
}
版权所有 (c) 2013 Francis Chong。此软件遵循 MIT 许可协议。有关详细信息,请参阅 LICENSE。