How to Validate Invitation Codes

The invitation code that Prefinery automatically generates for a user is tied to their email address. We give you the formula to calculate what the user's invitation code should be, then you compare that to the code the user provides. 

The invitation code for each of your users is simply a SHA1 hex digest of your secret invitation decoder key followed by their e-mail address.

Given a secret invitation decoder key of d1696aeb245fa90380a192a41730f07464c906ea and a user email address of joe@gmail.com (must be all lowercase) their invitation code will be 6210ede5e41479c55aa7ff24a0360462e0442bb3.

Remember, if you have enabled the use of short invitation codes in Prefinery (which are enabled by default), you only need to validate the first 10 characters of the calculated invitation code. In this case, the user's invitation code would be 6210ede5e4

Note: The Beta Management features shown in the screenshot above are only available to "prelaunch" projects (i.e. projects for which you answered "yes this is a prelaunch campaign" during the project creation wizard).

Validating the Invitation Code

To validate the invitation code you will simply need to calculate what you expect the invitation code to be for a given email address and then compare the result to what the user has provided.

This means that validating an invitation code is nothing more than a bit of math and string comparison, so there's no need to use our API. It's all done locally on your end.

Your project's secret invitation decoder key, used for validating a user's invitation code, can be found within your account on the Beta Management Settings page.

How to Validate an Invitation Code in Ruby

require 'digest/sha1' 
invitation_code = Digest::SHA1.hexdigest("d1696aeb245fa90380a192a41730f07464c906eajoe@gmail.com")

How to Validate an Invitation Code in Python

import hashlib
invitation_code = hashlib.sha1("d1696aeb245fa90380a192a41730f07464c906eajoe@gmail.com").hexdigest()

How to Validate an Invitation Code in PHP

<?php $invitation_code = sha1("d1696aeb245fa90380a192a41730f07464c906eajoe@gmail.com"); ?>

How to Validate an Invitation Code in Node.js

var crypto = require('crypto')
var shasum = crypto.createHash('sha1')
shasum.update('d1696aeb245fa90380a192a41730f07464c906eajoe@gmail.com')
shasum.digest('hex')

Still need help? How can we help? How can we help?