mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 14:39:28 -07:00
Add examples
This commit is contained in:
parent
0643902332
commit
dfcb29b0d1
4 changed files with 72 additions and 0 deletions
|
@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- Examples
|
||||||
|
|
||||||
## [0.14.0] - 2021-11-06
|
## [0.14.0] - 2021-11-06
|
||||||
### Added
|
### Added
|
||||||
- Support for ariadne.id notation proofs
|
- Support for ariadne.id notation proofs
|
||||||
|
|
14
examples/fetch-key-hkp.js
Normal file
14
examples/fetch-key-hkp.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
const doip = require('../src')
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
// Fetch the key using WKD
|
||||||
|
const key = await doip.keys.fetchWKD("test@doip.rocks")
|
||||||
|
|
||||||
|
// Process it to extract the UIDs and their claims
|
||||||
|
const obj = await doip.keys.process(key)
|
||||||
|
|
||||||
|
// Log the claims of the first UID
|
||||||
|
console.log(obj.users[0].claims)
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
41
examples/fetch-key-plaintext.js
Normal file
41
examples/fetch-key-plaintext.js
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
const doip = require('../src')
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
// Obtain the plaintext public key
|
||||||
|
const pubKeyPlaintext = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
||||||
|
mQGNBF+036UBDACoxWRdp7rBAFB2l/+dxX0XA50NJC92EEacB5L0TnC0lP/MsNHv
|
||||||
|
fAv/A9vgTwrPudvcHdE/urAjQswfIU3LpFxbBOWNYWOv6ssrzBH4vVGMyxfu2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nQdhgkXppTlso+JvOr2sjff4suSXY3gC
|
||||||
|
GcTGwRX15q3YDTv36KtlBlus2f4oGk1mjqZAESklrTHCfifZW102mkKBzZ+Y0EwN
|
||||||
|
B9ODBwJNrsbqBqXMs1wQkP81O3ihONwhz5XuykJF3G0VeoOy1zSL4ghZQ4/XkWyp
|
||||||
|
fCRSXrr7SZxIu7I8jfQrxc0k9XhpPI/gdlgRqoEG2lMyqFaWzyoI9dyoVwji78rg
|
||||||
|
8t7V+BjcvC8fJHgXUZxljqi2ZfcismJE6Hyn6qsdlNF9SKWOIIg=
|
||||||
|
=Csr+
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----`
|
||||||
|
|
||||||
|
// Fetch the key using WKD
|
||||||
|
const key = await doip.keys.fetchPlaintext(pubKeyPlaintext)
|
||||||
|
|
||||||
|
// Process it to extract the UIDs and their claims
|
||||||
|
const obj = await doip.keys.process(key)
|
||||||
|
|
||||||
|
// Log the claims of the first UID
|
||||||
|
console.log(obj.users[0].claims)
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
14
examples/fetch-key-wkd.js
Normal file
14
examples/fetch-key-wkd.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
const doip = require('../src')
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
// Fetch the key using WKD
|
||||||
|
const key = await doip.keys.fetchWKD("test@doip.rocks")
|
||||||
|
|
||||||
|
// Process it to extract the UIDs and their claims
|
||||||
|
const obj = await doip.keys.process(key)
|
||||||
|
|
||||||
|
// Log the claims of the first UID
|
||||||
|
console.log(obj.users[0].claims)
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
Loading…
Reference in a new issue