Skip to content

Latest commit

 

History

History
64 lines (45 loc) · 2.39 KB

README.md

File metadata and controls

64 lines (45 loc) · 2.39 KB

SAIDify - (sēdəˌfī)

trunk codecov npm version

Generate self-addressing identifiers on arbitrary data.

Usage

Typescript

Install the package via NPM/PNPM:

npm install saidify

Import 'saidify' and SAIDify your data:

import { saidify, verify } from 'saidify'

// create data to become self-addressing
const myData = {
  a: 1,
  b: 2,
  d: '',
}
const label = 'd'
const [said, sad] = saidify(myData, label)
// said is self-addressing identifier
// sad is self-addressing data
console.log(said)
// ...Vitest test assertion
expect(said).toEqual('ELLbizIr2FJLHexNkiLZpsTWfhwUmZUicuhmoZ9049Hz')

// verify self addressing identifier
const computedSAID = 'ELLbizIr2FJLHexNkiLZpsTWfhwUmZUicuhmoZ9049Hz'
const doesVerify = verify(sad, computedSAID, label) // can verify with original myData or sad
// ...Vitest test assertion
expect(doesVerify).toEqual(true)

You may find a full example Typescript project at saidify-example.

Description

A self-addressing identifier (SAID) is a kind of content-addressable identifier that uses a two-pass approach to enable embedding of the identifier in the content itself, thus the name self-addressing rather than content addressing.

A number of different specifications describe SAIDs.

Sources and References

  • signify-ts
    • Most of the code in this repository is lifted from the SignifyTS project.
  • keripy
    • Some of the code in this repository is inspired by KERIpy, the Python implementation of KERI.

Development Statistics

Alt