Encryption / Authentication Library (SHA, HMAC, OTP)

@beardedinventor. you are a genius. MUCH MUCH MUCH thanks…

I think there’s lots of cleanup we could still do in this class, but this is a really good starting point, and super exciting!

Not being able to tweet from agents has been really annoying, any now we can!! :slight_smile:

Thanks for all your help with this @bodinegl - super work!

You guys rock! Now all of my Imp’s will want twitter accounts!

Decided to just give them all one account. @joelwehrsimps Just in case anyone really wants Imp spam all over their twitter account.

ok I have check the changes provided by @beardedinventor to my repo at https://bitbucket.org/bodinegl/implibs/src/1ba63a5aa9c1?at=master.

I do agree that a lot of cleanup is in order. We can also start adding in the other API’s that might seem useful like direct message

I just tweeted thermocouple temperature from an Imp. Nice work, guys!

Having a little trouble with the degree symbol. It is fine typed in the IDE, and logged, but twitter wants UTF-8. How do I escape that in Squirrel?
°F is U+2109.

have you tried to %encoding it in the status=“the temperature outside is 72 %F8 F” message.

Isn’t the editor already UTF-8? What do you get from this Squirrel?
`s <- “°F”;

foreach (x in s) {
In Firefox on Ubuntu, I get three bytes – 194, 176, 70 – which is the correct UTF-8 representation. (The degree symbol in your post is U+00B0, not U+2109.)


@bodinegl: I’m going to leave this snippet of (working) code here with the promise that documentation should be available by the end of the week :wink:

`// Hashing example from https://dev.twitter.com/docs/auth/creating-signature
signatureBase <- “POST&https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.json&include_entities%3Dtrue%26oauth_consumer_key%3Dxvz1evFS4wEEPTGEFPHBog%26oauth_nonce%3DkYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1318622958%26oauth_token%3D370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb%26oauth_version%3D1.0%26status%3DHello%2520Ladies%2520%252B%2520Gentlemen%252C%2520a%2520signed%2520OAuth%2520request%2521”;
signingKey <- “kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw&LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE”;

expectedSignature <- “tnnArxj06cWHq44gCs1OSKk/jLY=”;
actualSignature <- http.base64encode(http.hash.hmacsha1(signatureBase, signingKey));

server.log("Expect: " + expectedSignature);
server.log("Actual: " + actualSignature);`

@beardedinventor, this is great!!! I will move over to this shortly.

@beardedinventor, just read the doc on the new http.hash functions. looks great…