Skip to content

Commit

Permalink
Complete documentation of the functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rober12 committed Nov 11, 2024
1 parent a8e6928 commit e43c9b4
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 53 deletions.
21 changes: 11 additions & 10 deletions src/txFactory/credentialRegistryTransactionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { AIdUtils } from '../utils/AIdUtils'
* Dev: get delegated invoke addSubjectCredential transaction object
* @param web3 ethereum connection
* @param subjectCredentialHash should have 32 bytes, credential identification
* @param URI url for store the credentials for backup
*/
export function addSubjectCredential(web3, subjectCredentialHash, URI) {
const transaction = Object.assign({}, config.basicTransaction)
Expand Down Expand Up @@ -103,9 +104,9 @@ export function getSubjectCredentialStatus(
/**
* THIS METHOD WILL BE DEPREATED, USE INSTEAD updateIssuerCredential
* function updateCredentialStatus(web3, issuerCredentialHash, status)
* @param web3
* @param issuerCredentialHash
* @param status
* @param web3 ethereum connection
* @param issuerCredentialHash should have 32 bytes
* @param status uint that indicates the status of the credential
*/
export function updateCredentialStatus(web3, issuerCredentialHash, status) {
const transaction = Object.assign({}, config.basicTransaction)
Expand All @@ -121,9 +122,9 @@ export function updateCredentialStatus(web3, issuerCredentialHash, status) {

/**
* function updateIssuerCredentialStatus(web3, issuerCredentialHash, status)
* @param web3
* @param issuerCredentialHash
* @param status
* @param web3 ethereum connection
* @param issuerCredentialHash should have 32 bytes
* @param status uint that indicates the status of the credential
*/
export function updateIssuerCredential(web3, issuerCredentialHash, status) {
const transaction = Object.assign({}, config.basicTransaction)
Expand All @@ -141,8 +142,8 @@ export function updateIssuerCredential(web3, issuerCredentialHash, status) {
* Dev: get the invoke updateCredentialStatus transaction object
* function getIssuerCredentialStatus(address issuer, bytes32 issuerCredentialHash) view public validAddress(issuer) returns (bool exists, Status status)
* @param web3 ethereum connection
* @param didIssuer
* @param issuerCredentialHash
* @param didIssuer alastria Id
* @param issuerCredentialHash should have 32 bytes
*/
export function getIssuerCredentialStatus(
web3,
Expand All @@ -164,8 +165,8 @@ export function getIssuerCredentialStatus(
* THIS METHOD WILL BE DEPREATED
* Dev: Defining three status functions avoid linking the subject to the issuer or the corresponding hashes
* @param web3 ethereum connection
* @param subjectStatus
* @param issuerStatus
* @param subjectStatus uint that indicates the status of the credential for subject
* @param issuerStatus uint that indicates the status of the credential for issuer
*/
export function getCredentialStatus(web3, subjectStatus, issuerStatus) {
const transaction = Object.assign({}, config.basicTransaction)
Expand Down
34 changes: 17 additions & 17 deletions src/txFactory/presentationRegistryTransactionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { AIdUtils } from '../utils/AIdUtils'
* THIS METHOD WILL BE DEPREATED, USE INSTEAD updateSubjectPresentation
* Subject functions
* function addSubjectPresentation(web3, subjectPresentationHash, URI)
* @param web3
* @param subjectPresentationHash
* @param URI
* @param web3 ethereum connection
* @param subjectPresentationHash should have 32 bytes
* @param URI url for store the presentations for backup
*/
export function addSubjectPresentation(web3, subjectPresentationHash, URI) {
const transaction = Object.assign({}, config.basicTransaction)
Expand All @@ -24,8 +24,8 @@ export function addSubjectPresentation(web3, subjectPresentationHash, URI) {
/**
* Subject functions
* function updateSubjectPresentation(bytes32 subjectPresentationHash, Status status) public validStatus(status)
* @param web3
* @param subjectPresentationHash
* @param web3 ethereum connection
* @param subjectPresentationHash should have 32 bytes
*/
export function updateSubjectPresentation(
web3,
Expand All @@ -47,9 +47,9 @@ export function updateSubjectPresentation(
* If the Presentation does not exists the return is a void Presentation
* If we want a log, should we add an event?
* function getSubjectPresentationStatus(address subject, bytes32 subjectPresentationHash) view public validAddress(subject) returns(bool exists, Status status)
* @param web3
* @param didSubject
* @param subsubjectPresentationHashject
* @param web3 ethereum connection
* @param didSubject alastria Id
* @param subsubjectPresentationHashject should have 32 bytes
*/
export function getSubjectPresentationStatus(
web3,
Expand All @@ -71,9 +71,9 @@ export function getSubjectPresentationStatus(
/**
* Receiver functions
* function updateReceiverPresentation(bytes32 receiverPresentationHash, Status status) public validStatus(status)
* @param web3
* @param receiverPresentationHash
* @param status
* @param web3 ethereum connection
* @param receiverPresentationHash should have 32 bytes
* @param status uint that indicates the status of the presentation
*/
export function updateReceiverPresentation(
web3,
Expand All @@ -95,9 +95,9 @@ export function updateReceiverPresentation(
* If the Presentation does not exists the return is a void Presentation
* If we want a log, should we add an event?
* function getReceiverPresentationStatus(address receiver, bytes32 receiverPresentationHash) view public validAddress(receiver) returns(bool exists, Status status) {
* @param web3
* @param didReceiver
* @param receiverPresentationHash
* @param web3 ethereum connection
* @param didReceiver alastria Id
* @param receiverPresentationHash should have 32 bytes
*/
export function getReceiverPresentationStatus(
web3,
Expand All @@ -121,9 +121,9 @@ export function getReceiverPresentationStatus(
* Utility function
* Defining three status functions avoids linking the Subject to the Receiver or the corresponding hashes
* function getPresentationStatus(Status subjectStatus, Status receiverStatus) pure public validStatus(subjectStatus) validStatus(receiverStatus) returns(Status){
* @param web3
* @param subjectStatus
* @param receiverStatus
* @param web3 ethereum connection
* @param subjectStatus uint that indicates the status of the presentation for subject
* @param receiverStatus uint that indicates the status of the presentation for receiver
*/
export function getPresentationStatus(web3, subjectStatus, receiverStatus) {
const transaction = Object.assign({}, config.basicTransaction)
Expand Down
60 changes: 34 additions & 26 deletions src/txFactory/publicKeyRegistryTransactionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { AIdUtils } from '../utils/AIdUtils'
import { AddressUtils } from '../utils/AddressUtils'

/**
* THIS METHOD WILL BE DEPREATED
* function addKey(string memory publicKey, address subject) public
* @param web3
* @param publicKey
* THIS METHOD WILL BE DEPREATED, USE INSTEAD addPublicKey
* function addKey(string memory publicKey) public
* @param web3 ethereum connection
* @param publicKey the public key.
*/
export function addKey(web3, publicKey) {
const transaction = Object.assign({}, config.basicTransaction)
Expand All @@ -21,8 +21,9 @@ export function addKey(web3, publicKey) {
}

/**
* @param web3
* @param publicKeyHash
* function addPublicKey(bytes32 publicKeyHash) public
* @param web3 ethereum connection
* @param publicKeyHash the hash of the publickey. should have 32 bytes
*/
export function addPublicKey(web3, publicKeyHash) {
const transaction = Object.assign({}, config.basicTransaction)
Expand All @@ -37,9 +38,10 @@ export function addPublicKey(web3, publicKeyHash) {
}

/**
* THIS METHOD WILL BE DEPREATED
* @param web3
* @param publicKey
* THIS METHOD WILL BE DEPREATED, USE INSTEAD revokePublicKeyHash
* function revokePublicKey(string memory publicKey) public
* @param web3 ethereum connection
* @param publicKey the public key.
*/
export function revokePublicKey(web3, publicKey) {
const transaction = Object.assign({}, config.basicTransaction)
Expand All @@ -54,8 +56,9 @@ export function revokePublicKey(web3, publicKey) {
}

/**
* @param web3
* @param publicKeyHash
* function revokePublicKey(bytes32 publicKeyHash) public
* @param web3 ethereum connection
* @param publicKeyHash the hash of the publickey. should have 32 bytes
*/
export function revokePublicKeyHash(web3, publicKeyHash) {
const transaction = Object.assign({}, config.basicTransaction)
Expand All @@ -70,9 +73,10 @@ export function revokePublicKeyHash(web3, publicKeyHash) {
}

/**
* THIS METHOD WILL BE DEPREATED
* @param web3
* @param publicKey
* THIS METHOD WILL BE DEPREATED, USE INSTEAD deletePublicKeyHash
* function deletePublicKey(string memory publicKey) public
* @param web3 ethereum connection
* @param publicKey the public key.
*/
export function deletePublicKey(web3, publicKey) {
const transaction = Object.assign({}, config.basicTransaction)
Expand All @@ -87,8 +91,9 @@ export function deletePublicKey(web3, publicKey) {
}

/**
* @param web3
* @param publicKeyHash
* function deletePublicKey(bytes32 publicKeyHash) public
* @param web3 ethereum connection
* @param publicKeyHash the hash of the publickey. should have 32 bytes
*/
export function deletePublicKeyHash(web3, publicKeyHash) {
const transaction = Object.assign({}, config.basicTransaction)
Expand All @@ -103,9 +108,10 @@ export function deletePublicKeyHash(web3, publicKeyHash) {
}

/**
* THIS METHOD WILL BE DEPREATED
* @param web3
* @param did
* THIS METHOD WILL BE DEPREATED, USE INSTEAD getPublicKeyStatusHash
* function getCurrentPublicKey(address subject) view public
* @param web3 ethereum connection
* @param did alastri Id
*/
export function getCurrentPublicKey(web3, did) {
const subjectAddr = AIdUtils.getProxyAddress(did)
Expand All @@ -120,10 +126,11 @@ export function getCurrentPublicKey(web3, did) {
}

/**
* THIS METHOD WILL BE DEPREATED
* @param web3
* @param did
* @param publicKey
* TODO: ELIMINAR???
* THIS METHOD WILL BE DEPREATED, USE INSTEAD getPublicKeyStatusHash
* function getPublicKeyStatus(address subject, bytes32 publicKeyHash) view public
* @param did ethereum connection
* @param publicKey the public key.
*/
export function getPublicKeyStatus(web3, did, publicKey) {
const subjectAddr = AIdUtils.getProxyAddress(did)
Expand All @@ -138,9 +145,10 @@ export function getPublicKeyStatus(web3, did, publicKey) {
}

/**
* @param web3
* @param did
* @param publicKeyHash
* function getPublicKeyStatus(address subject, bytes32 publicKeyHash) view public
* @param web3 ethereum connection
* @param did alastri Id
* @param publicKeyHash the hash of the publickey. should have 32 bytes
*/
export function getPublicKeyStatusHash(web3, did, publicKeyHash) {
const subjectAddr = AIdUtils.getProxyAddress(did)
Expand Down

0 comments on commit e43c9b4

Please sign in to comment.