Skip to content

easily create, assess, and assure hashes within a pit-of-success

License

Notifications You must be signed in to change notification settings

ehmpathy/hash-fns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hash-fns

test publish

easily create, assess, and assure hashes within a pit-of-success

install

npm install hash-fns

use

for example

import { Hash, toHashSha256, isHashSha256 } from 'hash-fns';

// create a hash
const versionHash: Hash = await toHashSha256('some data');

// verify that a given value is a valid hash
const foundHash: Hash = isHashSha256.assure('__hash__');

// typeguard against random strings being passed as hashes
const expectHash: Hash = 'some string'; // 🛑 typescript will throw an error, since string is not assignable to Hash

// use a hash within functions that expect strings
const expectWords: string = await toHashSha256('some data'); // ✅ passes, as Hash is assignable to strings

About

easily create, assess, and assure hashes within a pit-of-success

Resources

License

Stars

Watchers

Forks

Packages

No packages published