@atproto/identity
TypeScript icon, indicating that this package has built-in type declarations

0.4.8 • Public • Published

@atproto/identity

TypeScript library for decentralized identities in atproto using DIDs and handles

NPM Github CI Status

Example

Resolving a Handle and verifying against DID document:

const didres = new DidResolver({})
const hdlres = new HandleResolver({})

const handle = 'atproto.com'
const did = await hdlres.resolve(handle)

if (did == undefined) {
  throw new Error('expected handle to resolve')
}
console.log(did) // did:plc:ewvi7nxzyoun6zhxrhs64oiz

const doc = await didres.resolve(did)
console.log(doc)

// additional resolutions of same DID will be cached for some time, unless forceRefresh flag is used
const doc2 = await didres.resolve(did, true)

// helper methods use the same cache
const data = await didres.resolveAtprotoData(did)

if (data.handle != handle) {
  throw new Error('invalid handle (did not match DID document)')
}

License

This project is dual-licensed under MIT and Apache 2.0 terms:

Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.3.3-next.00next
0.4.82,651latest

Version History

VersionDownloads (Last 7 Days)Published
0.4.82,651
0.4.741
0.4.6152
0.4.510
0.4.40
0.4.3590
0.4.217
0.4.110
0.4.013
0.3.3111
0.3.3-next.00
0.3.21
0.3.10
0.3.00
0.2.1102
0.2.00
0.1.01
0.0.1487

Package Sidebar

Install

npm i @atproto/identity

Homepage

atproto.com

Weekly Downloads

4,186

Version

0.4.8

License

MIT

Unpacked Size

96.3 kB

Total Files

82

Last publish

Collaborators

  • dholms
  • pfrazee
  • devinivy
  • estrattonbailey