1.0.1 • Published 5 years ago

slk-js v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Statistical Linkage Key

Meteor Definition

Build Status

This small library handles both the generation and validation of an SLK. The library itself exposes two functions:

  • generate
  • is_valid

SLK.generate

The generate function takes 4 arguments:

  • First Name (Full)
  • Last Name (Full)
  • Date of Birth (Given in YYYY-MM-DD format)
  • Gender Identifier given as an integer from the following
GenderIdentifier
Male1
Female2
Intersex or Indeterminate3
Not stated/inadequately described9

SLK.is_valid

This function will validate a given string based off of three separate 'types'

  1. A 14 character SLK in the METeOR spec, with the date of birth validated as a true date.
  2. A 32 character Crockford encoded string, using a subset of characters to represent a 14 character SLK
  3. A 40 character hex encoded string

The return value of the is_valid function is an object with key value pairings of passed and failed validations.

Installation

To install, simply:

npm i --save slk-js

Usage

The library itself is exposed as a global variable SLK which will be accessible anywhere in your application.

var SLK = require('slk-js').default;
import SLK from 'slk-js';

// Use the SLK library

console.log(SLK.validate('myslk'));
// false