-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cactus-connector-fabric): add get tx receipt by tx id
Authored-by: Eduardo Vasques <eduardovasques10@tecnico.ulisboa.pt> Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>
- Loading branch information
1 parent
8ee9c62
commit 3bee9e8
Showing
7 changed files
with
215 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const fs = require("fs"); | ||
const { SignJWT } = require("jose"); | ||
const crypto = require("crypto"); | ||
|
||
// Path to the config file | ||
const configFilePath = "./.config.json"; | ||
|
||
// Load and parse the config file | ||
const config = JSON.parse(fs.readFileSync(configFilePath, "utf8")); | ||
|
||
// Extract audience and issuer from the config | ||
const audience = config.authorizationConfigJson.expressJwtOptions.audience; | ||
const issuer = config.authorizationConfigJson.expressJwtOptions.issuer; | ||
const secret = config.authorizationConfigJson.expressJwtOptions.secret; | ||
|
||
// Log audience and issuer | ||
console.log(`Audience: ${audience}`); | ||
console.log(`Issuer: ${issuer}`); | ||
|
||
// Generate a symmetric key for signing (HS256 uses a shared secret, not a public/private key pair) | ||
const jwtKeyPair = { | ||
privateKey: crypto.createSecretKey(secret), | ||
}; | ||
|
||
// Example of how to generate a JWT using `audience`, `issuer`, and `HS256` | ||
async function generateJWT() { | ||
const jwt = await new SignJWT({ scope: "read:health" }) | ||
.setProtectedHeader({ alg: "HS256" }) | ||
.setIssuer(issuer) | ||
.setAudience(audience) | ||
.sign(jwtKeyPair.privateKey); | ||
|
||
console.log(`Generated JWT: ${jwt}`); | ||
} | ||
|
||
generateJWT(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const fs = require("fs"); | ||
import { SignJWT, exportSPKI, generateKeyPair } from "jose"; | ||
const crypto = require("crypto"); | ||
|
||
// Path to the config file | ||
const configFilePath = "./.config.json"; | ||
|
||
// Load and parse the config file | ||
const config = JSON.parse(fs.readFileSync(configFilePath, "utf8")); | ||
|
||
// Extract audience and issuer from the config | ||
const audience = config.authorizationConfigJson.expressJwtOptions.audience; | ||
const issuer = config.authorizationConfigJson.expressJwtOptions.issuer; | ||
const secret = config.authorizationConfigJson.expressJwtOptions.secret; | ||
|
||
// Log audience and issuer | ||
console.log(`Audience: ${audience}`); | ||
console.log(`Issuer: ${issuer}`); | ||
|
||
// Generate a symmetric key for signing (HS256 uses a shared secret, not a public/private key pair) | ||
const jwtKeyPair = { | ||
privateKey: crypto.createSecretKey(secret), | ||
}; | ||
|
||
// Example of how to generate a JWT using `audience`, `issuer`, and `HS256` | ||
async function generateJWT() { | ||
const jwt = await new SignJWT({ scope: "read:health" }) | ||
.setProtectedHeader({ alg: "HS256" }) | ||
.setIssuer(issuer) | ||
.setAudience(audience) | ||
.sign(jwtKeyPair.privateKey); | ||
|
||
console.log(`Generated JWT: ${jwt}`); | ||
} | ||
|
||
generateJWT(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.