ChastiKey API

  • 31 Replies
  • 3264 Views
ChastiKey API
« on: November 06, 2018, 10:44:13 PM »
Hi

I've amended the API to use user id on the URLs instead of the token meaning anyone can easily work with this without requiring a token from me. I'm hoping with the more people that play around with it the more feedback and suggestions I'd get to help improve it.

I've produced a page of documentation here https://www.chastikey.com/api

I've left the v0.1 and v0.2 folder and files as they are incase anyone is using them, but going forwards please disregard the last forum post discussing the ChastiKey API.

Let me know what you think.
« Last Edit: February 11, 2019, 11:21:55 PM by KevinCross »
Developer of ChastiKey - The timed keyholder for your chastity device (Available on Google Play and App Store)

ChastiKey.com | Twitter | Facebook | Discord Chat

Want to sign up for beta testing?: Android | iOS

*

Offline gibby

  • *
  • 78
  • Total likes: 46
  • Gender: Male
  • Growing old is mandatory growing up is optional
    • View Profile
Re: ChastiKey API v0.2
« Reply #1 on: December 27, 2018, 08:28:40 PM »
Link seems to be broken

Re: ChastiKey API v0.2
« Reply #2 on: December 28, 2018, 08:10:25 AM »
Link seems to be broken
Sorry must have changed the link when moving to the new server. The link works now
Developer of ChastiKey - The timed keyholder for your chastity device (Available on Google Play and App Store)

ChastiKey.com | Twitter | Facebook | Discord Chat

Want to sign up for beta testing?: Android | iOS

Re: ChastiKey API v0.2
« Reply #3 on: January 25, 2019, 02:27:37 AM »
Suggestion: For the check call, if the result is unlocked then also return the combination lock.

The use case I'm thinking of is a semi-smart lock that has a simple command interface ("lock 12345", "unlock 12345").  The user could create a session as normal, enter the combo into the smart lock and then have external code (eg running on the PC) which periodically checks the lock status.  If the session is unlocked the code can then send the combo to the smart-lock ("unlock 12345") and have it unlock.   Obviously all user interaction (card draws, etc) would be via the mobile app.

Splitting the logic between the semi-smart lock and external code has a number of advantages from a build perspective; no networking needed for the lock, itself.  But it means the combination must be known to unlock; you can't just send a "session complete" message.

Such a system might also be usable for self-unlocking self-bondage locks, or door locks ("locked in a room until Zoe lets you free") where the lock and controls are unreachable; you just have your mobile app to play the game and hope you'll be released :-)

Re: ChastiKey API v0.2
« Reply #4 on: January 25, 2019, 09:10:28 AM »
Sounds good @sweh. I can add it to show when unlocked. I can't see a problem with that.
Developer of ChastiKey - The timed keyholder for your chastity device (Available on Google Play and App Store)

ChastiKey.com | Twitter | Facebook | Discord Chat

Want to sign up for beta testing?: Android | iOS

Re: ChastiKey API v0.2
« Reply #5 on: January 27, 2019, 10:41:09 AM »
@sweh the combination is now available in the API data. I've also included the combination for the fake locks. If the lock is still locked the combination will return 0

The API page has been updated: https://chastikey.com/api
Developer of ChastiKey - The timed keyholder for your chastity device (Available on Google Play and App Store)

ChastiKey.com | Twitter | Facebook | Discord Chat

Want to sign up for beta testing?: Android | iOS

Re: ChastiKey API v0.2
« Reply #6 on: January 27, 2019, 12:07:30 PM »
Nice :-)

Re: ChastiKey API v0.2
« Reply #7 on: January 27, 2019, 12:58:27 PM »
I'm trying to think of other things you can expose which won't drive people away from the app-first nature of this  (I'm assuming you get non-zero revenue from advertising and I don't want to reduce that).

Two possible thoughts

  1.  Add "Frozen" to locks.status option
  2.  Add "time remaining until next card draw" to locks  ("-1" if frozen).

This would allow for silly things like if someone has a Hue light bulb system then the lights could turn blue if the lock was frozen, and the lights could flash if the lock is ready to be tried again.

These shouldn't take eyeballs away from the app; already my smart watch buzzes when the "one of your locks is ready" android notifications appears.

If you're not too worried about app eyeballs (but still require the app, for session creation and for emergency key purchases) then extend the lock structure to include card counts (unless hidden).  Someone could write an Alexa skill "Alexa ask chastikey for status"... "you have been locked for 7 days 3 hours by Zoe.  There are 7 red, 1 green, 2 freeze, 4 double cards remaining.  You can try next in 3 hours".

Once we go down this path, adding a new endpoint to perform the interaction "select card <n>"  ("Alexa tell chastikey to turn card 27"; "you picked red".  "Alexa add 3 reds"; "OK there are now 16 cards on the table") but this might be going too far away from the app-first design.

Ideas?  I have them :-)

Re: ChastiKey API v0.2
« Reply #8 on: January 27, 2019, 02:56:23 PM »
I think those are good ideas. I specifically like the Alexa one. I'm not too fussed missing out on a few pennies because a couple of users use the API to get the data without ever going in to the app until it's time for them to pick. The ad revenue is quite small.

I will have a look at adding more data soon, like the data you've suggested
Developer of ChastiKey - The timed keyholder for your chastity device (Available on Google Play and App Store)

ChastiKey.com | Twitter | Facebook | Discord Chat

Want to sign up for beta testing?: Android | iOS

Re: ChastiKey API v0.2
« Reply #9 on: January 27, 2019, 08:53:31 PM »
Question: Should `combination` be a string?  I just created some test locks of type ABC and the results are wrong;

{"lockID":1548621080,"lockedBy":"Zoe","timestampLocked":1548621080,"timestampUnlocked":1548622082,"status":"UnlockedFake","combination":0},{"lockID":1548621080,"lockedBy":"Zoe","timestampLocked":1548621080,"timestampUnlocked":1548622102,"status":"UnlockedReal","combination":3},{"lockID":1548621080,"lockedBy":"Zoe","timestampLocked":1548621080,"timestampUnlocked":1548622112,"status":"UnlockedFake","combination":8}

The combinations are U44UD6B3, 3STFTKE6, 8LWU7QBH so it looks like the value returned by the API is the leading digits(if any).  (U...->0; 3S...->3; 8L...->8 ).

EDIT: It should probably be a string even for numeric combinations 'cos leading zeros need to be preserved.
« Last Edit: January 27, 2019, 09:36:54 PM by sweh »

Re: ChastiKey API v0.2
« Reply #10 on: January 27, 2019, 11:33:33 PM »
Something silly that only took a few minutes to put together...

https://bdsm.spuddy.org/test/chastikey.mp3

(That's a real session, but I faked the holder's name in my code to prevent her name from leaking; she doesn't use this site).
« Last Edit: January 27, 2019, 11:37:09 PM by sweh »

Re: ChastiKey API v0.2
« Reply #11 on: January 28, 2019, 07:42:27 AM »
You're right. It should be a string. I've fixed that now.

I like the Alexa skill! Are you working on one or was it just a scripted message to show what it might sound like if someone did create it. If you are, let me know if you want accese to more stuff in the api or seperate versions set up for it.
Developer of ChastiKey - The timed keyholder for your chastity device (Available on Google Play and App Store)

ChastiKey.com | Twitter | Facebook | Discord Chat

Want to sign up for beta testing?: Android | iOS

Re: ChastiKey API v0.2
« Reply #12 on: January 28, 2019, 07:49:23 AM »
I've been producing json data files for the developer of the Discord bot so that users can access their stats and other lock information amd have the bot show it in Discord. I'm more than happy to create more API scripts so that an Alexa Skill can access more informatiom than the current API shows. Pretty much anything in chastikey.com/stats can be accessed plus more. The Discord bot accesses the total locked time from all locks too so you could ask "Alexa, what's my total time locked with ChastiKey" to which she could reply "You have been locked for a total of 10.2 months across 43 locks"
Developer of ChastiKey - The timed keyholder for your chastity device (Available on Google Play and App Store)

ChastiKey.com | Twitter | Facebook | Discord Chat

Want to sign up for beta testing?: Android | iOS

Re: ChastiKey API v0.2
« Reply #13 on: January 28, 2019, 11:49:40 AM »
The Alexa response was a real call to the API to fetch the data :-)

So far it just calls listslocks.php and then parses the JSON.  It's written in GoLang and just converts the Lock array into a string

e.g.

func parse_api(json_str string) string {
        var chastikey Chastikey
        err := json.Unmarshal([]byte(json_str), &chastikey)
        if err != nil {
                return "Could not understand API results: "+err.Error()
        }

        // We want to look at the chastity session
        s := chastikey.Locks

        cnt := len(s)
        res := "You have " + strconv.Itoa(cnt) + " lock"
        if cnt != 1 {
                res += "s"
        }
        res += ".  "
        for x,y := range s {
                dur := time.Now().Unix()-y.StartTime
                res += "Lock " + strconv.Itoa(x+1) + " is held by " + y.LockedBy + ", and has been running for " + time_to_days(int(dur)) + ".  "
        }

        return res
}


It's not good code, but it works!

Unfortunately I don't think this sort of skill can be published on the Amazon store so it has to be run development mode, which requires users to have some knowledge on how to set up a TLS web server, but I'll publish the code and instructions on configuration.

Whatever you decide to expose, I can add a routine for ;-)

Re: ChastiKey API v0.2
« Reply #14 on: February 11, 2019, 02:01:13 AM »
Great to see an API.  I was playing with it to see if I could use it for some of my remote controlled stuff
   Documentation page http://www.chastikey.com/api/doku.php has a typo on the tense of the API.  it has checklocks.php (plural) and the actual API is singular.
 
   Also it would be nice to mention that userid must be in all caps (or perhaps update the API to uppercase before doing the lookup?

   Finally the API does not show when a lock can be opened but still locked. That is nice for remote control to automatically unlock a lock--say a magnetic lock holding keys or .....

Once again great job and great to see an actively developed application!