Skip to content
This repository was archived by the owner on Dec 13, 2024. It is now read-only.

Commit

Permalink
fix: export functions&types from tradetrust-tt/tradetrust
Browse files Browse the repository at this point in the history
  • Loading branch information
MinHtet-O committed May 17, 2024
1 parent 1b3aa0f commit 6e61cf0
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 2 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ tradetrust-core provides the following methods for document verification and val

It generates receives provider options and returns the ethereum JSON RPC provider to be used for [verify](#verify) method.

#### `wrapDocumentV2`

It takes in a Tradetrust v2 document and returns the wrapped document.

#### `wrapDocumentsV2`

It takes in array of Tradetrust v2 documents and returns the wrapped documents.

#### `signDocument`

It takes a wrapped document, a wallet (public and private key pair) or an Ethers.js Signer. The method will sign the merkle root from the wrapped document, append the signature to the document and return it. Currently, it supports `Secp256k1VerificationKey2018` sign algorithm.

#### `verify`

It allows you to verify wrapped/ issued document programmatically. Upon successful verification, it will return fragments which would collectively prove the validity of the document.
Expand Down
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
],
"verify": [
"./dist/types/verify/index.d.ts"
],
"tradetrust": [
"./dist/types/tradetrust/index.d.ts"
]
}
},
Expand Down Expand Up @@ -76,6 +79,10 @@
"./verify": {
"require": "./dist/cjs/verify/index.js",
"import": "./dist/esm/verify/index.js"
},
"./tradetrust": {
"require": "./dist/cjs/tradetrust/index.js",
"import": "./dist/esm/tradetrust/index.js"
}
},
"author": "tradetrust",
Expand Down Expand Up @@ -109,7 +116,7 @@
"url": "https://github.com/TradeTrust/tradetrust-core.git"
},
"dependencies": {
"@tradetrust-tt/tradetrust": "^6.9.0",
"@tradetrust-tt/tradetrust": "^6.9.4",
"@tradetrust-tt/tt-verify": "^8.9.2"
},
"publishConfig": {
Expand Down
43 changes: 43 additions & 0 deletions src/tradetrust/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Centralized import and export for tradetrust functionalities

// Import everything from @tradetrust-tt/tradetrust
import {
SchemaId,
utils,
v2,
v3,
OpenAttestationDocument,
obfuscateDocument,
verifySignature,
signDocument,
SUPPORTED_SIGNING_ALGORITHM,
getData,
isSchemaValidationError,
wrapDocument as wrapDocumentV2,
WrappedDocument,
wrapDocuments as wrapDocumentsV2,
__unsafe__use__it__at__your__own__risks__wrapDocument as wrapDocumentV3,
__unsafe__use__it__at__your__own__risks__wrapDocuments as wrapDocumentsV3,
SignedWrappedDocument,
} from '@tradetrust-tt/tradetrust'

// Re-export everything
export {
SchemaId,
utils,
v2,
v3,
OpenAttestationDocument,
obfuscateDocument,
verifySignature,
signDocument,
SUPPORTED_SIGNING_ALGORITHM,
getData,
isSchemaValidationError,
wrapDocumentV2,
wrapDocumentV3,
WrappedDocument,
wrapDocumentsV2,
wrapDocumentsV3,
SignedWrappedDocument,
}
3 changes: 2 additions & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as CONSTANTS from './constants/VerificationErrorMessages'
export * from './fragement'
export * from './analytics'
import * as CONSTANTS from './constants/VerificationErrorMessages'
export * from './constants/supportedChains'
export * from './provider/provider'
export * from './tradetrust'

export { CONSTANTS }
23 changes: 23 additions & 0 deletions src/utils/tradetrust/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { utils } from '@tradetrust-tt/tradetrust'

const {
isTransferableAsset,
getAssetId,
isWrappedV2Document,
isWrappedV3Document,
isRawV3Document,
isObfuscated,
getDocumentData,
getIssuerAddress,
} = utils

export {
isTransferableAsset,
getAssetId,
isWrappedV2Document,
isWrappedV3Document,
isRawV3Document,
isObfuscated,
getDocumentData,
getIssuerAddress,
}

0 comments on commit 6e61cf0

Please sign in to comment.