Generate self-addressing identifiers on arbitrary data.
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.
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.
- ToIP CESR spec section: Self-addressing identifier (SAID) - current
- ToIP spec (archived) Self-Addressing IDentifier (SAID) - old
- 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.