Anchoring (RFC069)
A period when the community can review the RFC (comment Docs)
Document Maintainers: Andi Gabriel Tan 2024. List of other contributors in Annex. 1.
Copyright: MIT license
Copyright © 2018-2024 Axiologic Research and Contributors.
This document is licensed under MIT license.
- Abstract
- 1. Anchoring functions
- Function createAnchor(dsuKeySSI, callback)
- Function createNFT(nftKeySSI, callback)
- Function appendToAnchor(dsuKeySSI, newShlSSI, previousShlSSI, zkpValue, callback)
- Function getAllVersions(keySSI, authToken, callback)
- Function getLastVersion(keySSI, authToken, callback)
- Function getAnchoringBehaviour(persistenceStrategy)
- 2. AnchoringX Functions, exposed by RemotePersistence
- Annex 1. Contributors
Abstract
This API space offers a set of portable functions for DSU anchoring. The agent should handle these operations, so it will probably not have to use these functions. More information about OpenDSU Anchoring can be found in Anchoring (RFC-005).
1. Anchoring functions
//Load openDSU environment
require("../privatesky/psknode/bundles/openDSU");
//Load openDSU SDK
const opendsu = require("opendsu");
//Load keyssi library
const keyssispace = opendsu.loadApi("keyssi");
//Load anchoring library
const anchoring = opendsu.loadApi("anchoring");
//Build a newKeySSI
const seedSSI = keyssispace.createSeedSSI('default');
const newHLSSI = keyssispace.createHashLinkSSI('default','newBrickHash');
const lastHLSSI = keyssispace.createHashLinkSSI('default','lastBrickHash');
anchoring.addVersion(seedSSI, newHLSSI, lastHLSSI, 'zkpValue', (err, status) => {
anchoring.versions(seedSSI, 'authToken', (err, versions) => {
console.log("versions: ", versions);
});
});
How to use
Function createAnchor(dsuKeySSI, callback)
Description: Creates a new anchor with a certain version of the DSU identified by the dsuKeySSI parameter.
Name | Type | Value | Description |
---|---|---|---|
dueKeySSI | KeySSI object | *required | An identifier for the DSU for which we want to create an anchor. |
callback | function | *required |
Callback parameters
Name | Type | Response example |
---|---|---|
err | ErrorWrapper object |
Description: Contains a message and the error.
Function createNFT(nftKeySSI, callback)
Description: Creates a new anchor with a certain NFT identified by the nftKeySSI parameter.
Name | Type | Value | Description |
---|---|---|---|
nftKeySSI | KeySSI object | *required | An identifier for the NFT for which we want to create an anchor. |
callback | function | *required |
Callback parameters
Name | Type | Response example |
---|---|---|
Description
Function appendToAnchor(dsuKeySSI, newShlSSI, previousShlSSI, zkpValue, callback)
Description: Appends a new version of the DSU to an existing anchor.
Name | Type | Value | Description |
---|---|---|---|
dsuKeySSI | KeySSI object | *required | An identifier for the DSU for which we want to append a new version. |
newShlSSI | hashLinkSSI object | *required | |
previousShlSSI | hashLinkSSI object | *required | |
zkpValue | sting | ||
callback | function | *required |
Callback parameters
Name | Type | Response example |
---|---|---|
err | ErrorWrapper object |
Description: Contains a message and the error
Function getAllVersions(keySSI, authToken, callback)
Description: Get a list of versions of the DSU identified by the provided KeySSI. Those versions are represented as signed HashLinkSSIs.
Name | Type | Value | Description |
---|---|---|---|
KeySSI | KeySSI object | The KeySSI associated with the DSU from which you want to get the information about its versions. | |
authToken (optional) | JWT Token (Json format) | A JWT authentication token. | |
callback | function | *required |
Callback parameters
Name | Type | Response example |
---|---|---|
err | ErrorWrapper object | |
versions | Array of HashLinkSSIs |
Description: Contains a message and the error./ List of versions associated with the DSU with the provided KeySSI and represented by HashLinkSSIs.
Function getLastVersion(keySSI, authToken, callback)
Description:
Name | Type | Value | Description |
---|---|---|---|
KeySSI | KeySSI object | ||
authToken | string | ||
callback | function | *required |
Callback parameters
Name | Type | Response example |
---|---|---|
err | ErrorWrapper object | |
versions or latest HashLink | HashLinkSSI |
Description: Contains a message and the error or it contains the last version of the DSU which corresponds to the provided KeySSI.
Function getAnchoringBehaviour(persistenceStrategy)
Description: Creates a new AnchoringAbstractBehaviour object.
Name | Type | Value | Description |
---|---|---|---|
persistenceStrategy | object |
2. AnchoringX Functions, exposed by RemotePersistence
Function createAnchor(capableOfSigningKeySSI, anchorValue, callback)
Description:
Name | Type | Value | Description |
---|---|---|---|
capableOfSigningKeySSI | keySSI object | *required | the anchor SSI |
anchorValue | string | *required | the anchor value |
callback | function | *required |
Callback parameters
Name | Type | Response example |
---|---|---|
err | ErrorWrapper object |
Description: Contains a message and the error.
Function appendAnchor(capableOfSigningKeySSI, anchorValue, callback)
Description:
Name | Type | Value | Description |
---|---|---|---|
capableOfSigningKeySSI | keySSI object | *required | the anchor SSI |
anchorValue | string | *required | the anchor value |
callback | function | *required |
Callback parameters
Name | Type | Response example |
---|---|---|
err | ErrorWrapper object |
Description: Contains a message and the error.
Function getAllVersions(keySSI, callback)
Description: Get a list of versions of the DSU identified by the provided KeySSI. Those versions are represented as signed HashLinkSSIs.
Description:
Name | Type | Value | Description |
---|---|---|---|
KeySSI | keySSI object | *required | the anchor SSI |
callback | function | *required |
Callback parameters
Name | Type | Response example |
---|---|---|
err | ErrorWrapper object | |
data | Array of hashLinkSSIs |
Description: Contains a message and the error./ List of versions associated with the DSU with the provided keySSI and represented by HashLinkSSIs.
Function getLastVersion(keySSI, callback)
Description:
Name | Type | Value | Description |
---|---|---|---|
KeySSI | keySSI object | *required | |
callback | function | *required |
Callback parameters
Name | Type | Response example |
---|---|---|
err | ErrorWrapper object | |
version or latestHashLink | HashLinkSSI |
Description: Contains a message and the error or it contains the last version of the DSU which corresponds to the provided KeySSI.
Function createOrUpdateMultipleAnchors(anchors, callback)
Description:
Name | Type | Value | Description |
---|---|---|---|
anchors | array | *required | |
callback | function |
Callback parameters
Name | Type | Response example |
---|---|---|
err | ErrorWrapper object |
Contributors
-
Axiologic Research: New content and improvements. Original texts under PharmaLedger Association and Novartis funding. MIT licensed content accordingly with the contracts. Publish and maintain the www.opendsu.org site.
-
PharmaLedger Project: Review, feedback, observations, new content, and corrections MIT licensed accordingly with the consortium agreements.
- PrivateSky Research Project: MIT licensed content accordingly with the contracts. https://profs.info.uaic.ro/~ads/PrivateSky/
Annex 1. Contributors
Current Editors | |
---|---|
Sînică Alboaie | sinica.alboaie@axiologic.net |
Cosmin Ursache | cosmin@axiologic.net |
Teodor Lupu | teodor@axiologic.net |
Andi-Gabriel Țan | andi@axiologic.net |
Contributors Axiologic Research | |
Adrian Ganga | adrian@axiologic.net |
Andi-Gabriel Țan | andi@axiologic.net |
Cosmin Ursache | cosmin@axiologic.net |
Daniel Sava | daniel@axiologic.net |
Nicoleta Mihalache | nicoleta@axiologic.net |
Valentin Gérard | valentin@axiologic.net |
PrivateSky Contributors | |
Alex Sofronie | alsofronie@gmail.com (DPO) |
Cosmin Ursache | cos.ursache@gmail.com (UAIC) |
Daniel Sava | sava.dumitru.daniel@gmail.com (HVS, AQS) |
Daniel Visoiu | visoiu.daniel.g@gmail.com (SGiant) |
Lenuța Alboaie | lalboaie@gmail.com (UAIC) |
Rafael Mastaleru | rafael@rms.ro (RMS) |
Sînică Alboaie | salboaie@gmail.com (UAIC) |
Vlad Balmos | vlad.balmos@gmail.com (Code932) |
PharmaLedger Contributors | |
Ana Balan | bam@rms.ro (RMS) |
Bogdan Mastahac | mab@rms.ro (RMS) |
Cosmin Ursache | cos@rms.ro (RMS) |
Rafael Mastaleru | raf@rms.ro (RMS) |