Skip to content

Commit

Permalink
Merge pull request #270 from VerusCoin/dev
Browse files Browse the repository at this point in the history
v1.2.7
  • Loading branch information
Asherda authored Dec 30, 2024
2 parents ffb0954 + c8607d4 commit 7a8b26d
Show file tree
Hide file tree
Showing 11 changed files with 185 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ stages:
variables:
DOCKER_DRIVER: overlay2
DEFAULT_VERUSCOIN_BRANCH: release
VERUS_VERSION: 1.2.6
VERUSCOIN_VERSION: 1.2.6
VERUS_VERSION: 1.2.7
VERUSCOIN_VERSION: 1.2.7
KOMODO_VERSION: 0.9.0
KOMODO_DOWNLOAD_URL: https://github.com/KomodoPlatform/komodo/releases/download
PIRATE_VERSION: 5.9.0
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "verus-desktop",
"productName": "Verus-Desktop",
"version": "1.2.6",
"version": "1.2.7",
"description": "Verus Desktop Wallet App",
"main": "main.js",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ api = require('./api/native/addresses')(api);
api = require('./api/native/balances')(api);
api = require('./api/native/definedchains')(api);
api = require('./api/native/getBlock.js')(api);
api = require('./api/native/getVdxfId.js')(api);
api = require('./api/native/info')(api);
api = require('./api/native/mininginfo')(api);
api = require('./api/native/getTransaction.js')(api);
Expand Down Expand Up @@ -162,6 +163,8 @@ api = require('./api/native/shieldcoinbase.js')(api);
api = require('./api/native/verusid/verusid.js')(api);
api = require('./api/native/verusid/login/verifyRequest.js')(api);
api = require('./api/native/verusid/login/signResponse.js')(api);
api = require('./api/native/verusid/provision/signIdProvisioningRequest.js')(api);
api = require('./api/native/verusid/provision/verifyIdProvisioningResponse.js')(api);
api = require('./api/native/makeoffer')(api);
api = require('./api/native/getoffers')(api);
api = require('./api/native/closeoffers')(api);
Expand Down
2 changes: 1 addition & 1 deletion routes/api/native/getBlock.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = (api) => {
/**
* Gets the version, hashtype and height from a signature.
* Gets a block given a height.
*
* @param {String} coin The chainTicker of the coin to make the call on
* @param {String} hashorheight The block hash or height
Expand Down
65 changes: 65 additions & 0 deletions routes/api/native/getVdxfId.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
module.exports = (api) => {
/**
* Returns the VDXF key of the URI string.
*
* @param {String} coin The chainTicker of the coin to make the call on
* @param {String} vdxfuri This message is converted from hex, the data is hashed, then returned
* @param {Object} initialvdxfdata The optional data of (vdxfkey, uint256, indexnum) that is combined.
*/
api.native.get_vdxf_id = (
coin,
vdxfuri,
initialvdxfdata = {},
) => {
return new Promise((resolve, reject) => {
api.native
.callDaemon(
coin,
"getvdxfid",
[
vdxfuri,
initialvdxfdata
]
)
.then(resultObj => {
resolve(resultObj)
})
.catch(err => {
reject(err);
});
});
};

api.setPost('/native/get_vdxf_id', (req, res, next) => {
const {
chainTicker,
vdxfuri,
initialvdxfdata
} = req.body;

api.native
.get_vdxf_id(
chainTicker,
vdxfuri,
initialvdxfdata
)
.then(resultObj => {
const retObj = {
msg: "success",
result: resultObj
};

res.send(JSON.stringify(retObj));
})
.catch(error => {
const retObj = {
msg: "error",
result: error.message
};

res.send(JSON.stringify(retObj));
});
});

return api;
}
5 changes: 4 additions & 1 deletion routes/api/native/idInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ module.exports = (api) => {
identity.identity.parent !==
"i5w5MuNik5NtLcYmNzcvaoixooEebB6MGV" &&
identity.identity.parent !==
"iJhCezBExJHvtyH3fGhNnt2NhU4Ztkf2yq"
"iJhCezBExJHvtyH3fGhNnt2NhU4Ztkf2yq" &&
// Avoid trying to get the null parent of VRSC or VRSCTEST.
identity.identity.parent !==
"i3UXS5QPRQGNRDDqVnyWTnmFCTHDbzmsYk"
) {
identity.identity.name = `${identity.identity.name}.${
(
Expand Down
56 changes: 56 additions & 0 deletions routes/api/native/verusid/provision/signIdProvisioningRequest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const { VerusIDSignature, IDENTITY_AUTH_SIG_VDXF_KEY } = require("verus-typescript-primitives");
const { ProvisioningRequest } = require("verus-typescript-primitives/dist/vdxf/classes/provisioning/ProvisioningRequest");

module.exports = (api) => {
/**
* Signs a provisioning request using an r-address.
*
* @param {String} coin The chainTicker of the coin to make the call on
* @param {String} request The provisioning request to sign
* @param {String} raddress The raddress to sign the provioning requset with
*/
api.native.verusid.provision.sign_id_provisioning_request = async (coin, request, raddress) => {

const provisioningRequest = new ProvisioningRequest(request);

const signdataResult = await api.native.sign_data(coin,
{
"address": raddress,
"datahash": provisioningRequest.challenge.toSha256().toString("hex")
}
)

provisioningRequest.signature = new VerusIDSignature(
{ signature: signdataResult.signature },
IDENTITY_AUTH_SIG_VDXF_KEY
);

return provisioningRequest;
}

api.setPost('/native/verusid/provision/sign_id_provisioning_request', async (req, res, next) => {
const {
chainTicker,
request,
raddress
} = req.body;

try {
res.send(
JSON.stringify({
msg: "success",
result: await api.native.verusid.provision.sign_id_provisioning_request(chainTicker, request, raddress),
})
);
} catch (e) {
res.send(
JSON.stringify({
msg: "error",
result: e.message,
})
);
}
});

return api;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const { LoginConsentProvisioningResponse } = require("verus-typescript-primitives");
const { ROOT_SYSTEM_NAME } = require("../../../utils/constants/dev_options");

module.exports = (api) => {
/**
* Verifies a provisioning response
* @param {LoginConsentProvisioningResponse} Response
*/
api.native.verusid.provision.verify_id_provisioning_response = async (response) => {
const provisioningResponse = new LoginConsentProvisioningResponse(response);

// Convert the system id to the chain name.
const currencyObject = await api.native.get_currency(
ROOT_SYSTEM_NAME,
response.system_id
);
const chainTicker = currencyObject.name.toUpperCase();

const verified = await api.native.verify_hash(
chainTicker,
provisioningResponse.signing_id,
provisioningResponse.decision.toSha256().toString('hex'),
provisioningResponse.signature.signature
);

return verified ? { verified } : { verified, message: "Failed to verify signature" };
};

api.setPost("/native/verusid/provision/verify_id_provisioning_response", async (req, res, next) => {
const { response } = req.body;

try {
res.send(
JSON.stringify({
msg: "success",
result: await api.native.verusid.provision.verify_id_provisioning_response(response),
})
);
} catch (e) {
res.send(
JSON.stringify({
msg: "error",
result: e.message,
})
);
}
});

return api;
};
1 change: 1 addition & 0 deletions routes/api/native/verusid/verusid.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = (api) => {
api.native.verusid = {}
api.native.verusid.login = {}
api.native.verusid.provision = {}

return api;
};
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.2.6",
"version": "1.2.7",
"minVersion": "1.2.5-3",
"versionUrl": "https://raw.githubusercontent.com/VerusCoin/Verus-Desktop/master/version.json",
"repository": "https://github.com/VerusCoin/Verus-Desktop/"
Expand Down
2 changes: 1 addition & 1 deletion version_build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.6
1.2.7

0 comments on commit 7a8b26d

Please sign in to comment.