Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ To configure the library:

```js
const mcl = new MIRACLTrust({
projectId: "<YOUR_PROJECT_ID>", // required
projectUrl: "<PROJECT_URL>", // required
projectId: "<PROJECT_ID>", // required
seed: "hexEncodedRandomNumberGeneratorSeed", // required
userStorage: localStorage, // required
deviceName: "Name of Device",
Expand Down
30 changes: 15 additions & 15 deletions cjs/client.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -23901,7 +23901,7 @@ HTTP.prototype.request = function (options, callback) {
/**
* @class
* @param {Object} options
* @param {string} options.server - Server address, defaults to https://api.mpin.io
* @param {string} options.projectUrl - MIRACL Trust Project URL that is used for communication with the MIRACL Trust API
* @param {string} options.projectId - MIRACL Trust Project ID
* @param {string} options.seed - Hex encoded random number generator seed
* @param {string} options.deviceName - Name of the current device
Expand Down Expand Up @@ -23931,11 +23931,11 @@ function Client(options) {
throw new Error("Invalid user storage");
}

if (!options.server) {
options.server = "https://api.mpin.io";
if (!options.projectUrl) {
options.projectUrl = "https://api.mpin.io";
} else {
// remove trailing slash from url, if there is one
options.server = options.server.replace(/\/$/, "");
options.projectUrl = options.projectUrl.replace(/\/$/, "");
}

// Ensure that default PIN lenght is between 4 and 6
Expand All @@ -23952,7 +23952,7 @@ function Client(options) {
}

// Set the client name using the current lib version and provided application info
options.clientName = "MIRACL Client.js/8.7.0" + (options.applicationInfo ? " " + options.applicationInfo : "");
options.clientName = "MIRACL Client.js/8.8.0" + (options.applicationInfo ? " " + options.applicationInfo : "");

self.options = options;

Expand Down Expand Up @@ -23987,7 +23987,7 @@ Client.prototype.fetchAccessId = function (userId, callback) {
reqData;

reqData = {
url: self.options.server + "/rps/v2/session",
url: self.options.projectUrl + "/rps/v2/session",
type: "POST",
data: {
projectId: self.options.projectId,
Expand Down Expand Up @@ -24016,7 +24016,7 @@ Client.prototype.fetchStatus = function (callback) {
reqData;

reqData = {
url: self.options.server + "/rps/v2/access",
url: self.options.projectUrl + "/rps/v2/access",
type: "POST",
data: {
webOTT: self.session.webOTT
Expand Down Expand Up @@ -24047,7 +24047,7 @@ Client.prototype.sendPushNotificationForAuth = function (userId, callback) {
}

reqData = {
url: self.options.server + "/pushauth?" + self._urlEncode(self.options.oidc),
url: self.options.projectUrl + "/pushauth?" + self._urlEncode(self.options.oidc),
type: "POST",
data: {
prerollId: userId
Expand Down Expand Up @@ -24083,7 +24083,7 @@ Client.prototype.sendVerificationEmail = function (userId, callback) {
return callback(new Error("Empty user ID"), null);
}

reqData.url = self.options.server + "/verification/email";
reqData.url = self.options.projectUrl + "/verification/email";
reqData.type = "POST";
reqData.data = {
userId: userId,
Expand Down Expand Up @@ -24132,7 +24132,7 @@ Client.prototype.getActivationToken = function (verificationURI, callback) {
return callback(new Error("Empty verification code"), null);
}

reqData.url = self.options.server + "/verification/confirmation";
reqData.url = self.options.projectUrl + "/verification/confirmation";
reqData.type = "POST";
reqData.data = {
userId: params["user_id"],
Expand Down Expand Up @@ -24222,7 +24222,7 @@ Client.prototype._createMPinID = function (userId, activationToken, keypair, cal
var self = this,
regData = {};

regData.url = self.options.server + "/registration";
regData.url = self.options.projectUrl + "/registration";
regData.type = "POST";
regData.data = {
userId: userId,
Expand Down Expand Up @@ -24371,7 +24371,7 @@ Client.prototype.generateQuickCode = function (userId, userPin, callback) {
}

self.http.request({
url: self.options.server + "/verification/quickcode",
url: self.options.projectUrl + "/verification/quickcode",
type: "POST",
data: {
projectId: self.options.projectId,
Expand Down Expand Up @@ -24485,7 +24485,7 @@ Client.prototype._getPass1 = function (identityData, userPin, scope, X, SEC, cal
U: res.U
};

self.http.request({ url: self.options.server + "/rps/v2/pass1", type: "POST", data: requestData }, callback);
self.http.request({ url: self.options.projectUrl + "/rps/v2/pass1", type: "POST", data: requestData }, callback);
};

/**
Expand Down Expand Up @@ -24520,7 +24520,7 @@ Client.prototype._getPass2 = function (identityData, scope, yHex, X, SEC, callba
V: vHex
};

self.http.request({ url: self.options.server + "/rps/v2/pass2", type: "POST", data: requestData}, callback);
self.http.request({ url: self.options.projectUrl + "/rps/v2/pass2", type: "POST", data: requestData}, callback);
};

Client.prototype._finishAuthentication = function (userId, userPin, scope, authOTT, callback) {
Expand All @@ -24532,7 +24532,7 @@ Client.prototype._finishAuthentication = function (userId, userPin, scope, authO
"wam": "dvs"
};

self.http.request({ url: self.options.server + "/rps/v2/authenticate", type: "POST", data: requestData }, function (err, result) {
self.http.request({ url: self.options.projectUrl + "/rps/v2/authenticate", type: "POST", data: requestData }, function (err, result) {
if (err) {
return callback(err, result);
}
Expand Down
30 changes: 15 additions & 15 deletions cjs/promise.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -23901,7 +23901,7 @@ HTTP.prototype.request = function (options, callback) {
/**
* @class
* @param {Object} options
* @param {string} options.server - Server address, defaults to https://api.mpin.io
* @param {string} options.projectUrl - MIRACL Trust Project URL that is used for communication with the MIRACL Trust API
* @param {string} options.projectId - MIRACL Trust Project ID
* @param {string} options.seed - Hex encoded random number generator seed
* @param {string} options.deviceName - Name of the current device
Expand Down Expand Up @@ -23931,11 +23931,11 @@ function Client(options) {
throw new Error("Invalid user storage");
}

if (!options.server) {
options.server = "https://api.mpin.io";
if (!options.projectUrl) {
options.projectUrl = "https://api.mpin.io";
} else {
// remove trailing slash from url, if there is one
options.server = options.server.replace(/\/$/, "");
options.projectUrl = options.projectUrl.replace(/\/$/, "");
}

// Ensure that default PIN lenght is between 4 and 6
Expand All @@ -23952,7 +23952,7 @@ function Client(options) {
}

// Set the client name using the current lib version and provided application info
options.clientName = "MIRACL Client.js/8.7.0" + (options.applicationInfo ? " " + options.applicationInfo : "");
options.clientName = "MIRACL Client.js/8.8.0" + (options.applicationInfo ? " " + options.applicationInfo : "");

self.options = options;

Expand Down Expand Up @@ -23987,7 +23987,7 @@ Client.prototype.fetchAccessId = function (userId, callback) {
reqData;

reqData = {
url: self.options.server + "/rps/v2/session",
url: self.options.projectUrl + "/rps/v2/session",
type: "POST",
data: {
projectId: self.options.projectId,
Expand Down Expand Up @@ -24016,7 +24016,7 @@ Client.prototype.fetchStatus = function (callback) {
reqData;

reqData = {
url: self.options.server + "/rps/v2/access",
url: self.options.projectUrl + "/rps/v2/access",
type: "POST",
data: {
webOTT: self.session.webOTT
Expand Down Expand Up @@ -24047,7 +24047,7 @@ Client.prototype.sendPushNotificationForAuth = function (userId, callback) {
}

reqData = {
url: self.options.server + "/pushauth?" + self._urlEncode(self.options.oidc),
url: self.options.projectUrl + "/pushauth?" + self._urlEncode(self.options.oidc),
type: "POST",
data: {
prerollId: userId
Expand Down Expand Up @@ -24083,7 +24083,7 @@ Client.prototype.sendVerificationEmail = function (userId, callback) {
return callback(new Error("Empty user ID"), null);
}

reqData.url = self.options.server + "/verification/email";
reqData.url = self.options.projectUrl + "/verification/email";
reqData.type = "POST";
reqData.data = {
userId: userId,
Expand Down Expand Up @@ -24132,7 +24132,7 @@ Client.prototype.getActivationToken = function (verificationURI, callback) {
return callback(new Error("Empty verification code"), null);
}

reqData.url = self.options.server + "/verification/confirmation";
reqData.url = self.options.projectUrl + "/verification/confirmation";
reqData.type = "POST";
reqData.data = {
userId: params["user_id"],
Expand Down Expand Up @@ -24222,7 +24222,7 @@ Client.prototype._createMPinID = function (userId, activationToken, keypair, cal
var self = this,
regData = {};

regData.url = self.options.server + "/registration";
regData.url = self.options.projectUrl + "/registration";
regData.type = "POST";
regData.data = {
userId: userId,
Expand Down Expand Up @@ -24371,7 +24371,7 @@ Client.prototype.generateQuickCode = function (userId, userPin, callback) {
}

self.http.request({
url: self.options.server + "/verification/quickcode",
url: self.options.projectUrl + "/verification/quickcode",
type: "POST",
data: {
projectId: self.options.projectId,
Expand Down Expand Up @@ -24485,7 +24485,7 @@ Client.prototype._getPass1 = function (identityData, userPin, scope, X, SEC, cal
U: res.U
};

self.http.request({ url: self.options.server + "/rps/v2/pass1", type: "POST", data: requestData }, callback);
self.http.request({ url: self.options.projectUrl + "/rps/v2/pass1", type: "POST", data: requestData }, callback);
};

/**
Expand Down Expand Up @@ -24520,7 +24520,7 @@ Client.prototype._getPass2 = function (identityData, scope, yHex, X, SEC, callba
V: vHex
};

self.http.request({ url: self.options.server + "/rps/v2/pass2", type: "POST", data: requestData}, callback);
self.http.request({ url: self.options.projectUrl + "/rps/v2/pass2", type: "POST", data: requestData}, callback);
};

Client.prototype._finishAuthentication = function (userId, userPin, scope, authOTT, callback) {
Expand All @@ -24532,7 +24532,7 @@ Client.prototype._finishAuthentication = function (userId, userPin, scope, authO
"wam": "dvs"
};

self.http.request({ url: self.options.server + "/rps/v2/authenticate", type: "POST", data: requestData }, function (err, result) {
self.http.request({ url: self.options.projectUrl + "/rps/v2/authenticate", type: "POST", data: requestData }, function (err, result) {
if (err) {
return callback(err, result);
}
Expand Down
30 changes: 15 additions & 15 deletions dist/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -23902,7 +23902,7 @@ HTTP.prototype.request = function (options, callback) {
/**
* @class
* @param {Object} options
* @param {string} options.server - Server address, defaults to https://api.mpin.io
* @param {string} options.projectUrl - MIRACL Trust Project URL that is used for communication with the MIRACL Trust API
* @param {string} options.projectId - MIRACL Trust Project ID
* @param {string} options.seed - Hex encoded random number generator seed
* @param {string} options.deviceName - Name of the current device
Expand Down Expand Up @@ -23932,11 +23932,11 @@ function Client(options) {
throw new Error("Invalid user storage");
}

if (!options.server) {
options.server = "https://api.mpin.io";
if (!options.projectUrl) {
options.projectUrl = "https://api.mpin.io";
} else {
// remove trailing slash from url, if there is one
options.server = options.server.replace(/\/$/, "");
options.projectUrl = options.projectUrl.replace(/\/$/, "");
}

// Ensure that default PIN lenght is between 4 and 6
Expand All @@ -23953,7 +23953,7 @@ function Client(options) {
}

// Set the client name using the current lib version and provided application info
options.clientName = "MIRACL Client.js/8.7.0" + (options.applicationInfo ? " " + options.applicationInfo : "");
options.clientName = "MIRACL Client.js/8.8.0" + (options.applicationInfo ? " " + options.applicationInfo : "");

self.options = options;

Expand Down Expand Up @@ -23988,7 +23988,7 @@ Client.prototype.fetchAccessId = function (userId, callback) {
reqData;

reqData = {
url: self.options.server + "/rps/v2/session",
url: self.options.projectUrl + "/rps/v2/session",
type: "POST",
data: {
projectId: self.options.projectId,
Expand Down Expand Up @@ -24017,7 +24017,7 @@ Client.prototype.fetchStatus = function (callback) {
reqData;

reqData = {
url: self.options.server + "/rps/v2/access",
url: self.options.projectUrl + "/rps/v2/access",
type: "POST",
data: {
webOTT: self.session.webOTT
Expand Down Expand Up @@ -24048,7 +24048,7 @@ Client.prototype.sendPushNotificationForAuth = function (userId, callback) {
}

reqData = {
url: self.options.server + "/pushauth?" + self._urlEncode(self.options.oidc),
url: self.options.projectUrl + "/pushauth?" + self._urlEncode(self.options.oidc),
type: "POST",
data: {
prerollId: userId
Expand Down Expand Up @@ -24084,7 +24084,7 @@ Client.prototype.sendVerificationEmail = function (userId, callback) {
return callback(new Error("Empty user ID"), null);
}

reqData.url = self.options.server + "/verification/email";
reqData.url = self.options.projectUrl + "/verification/email";
reqData.type = "POST";
reqData.data = {
userId: userId,
Expand Down Expand Up @@ -24133,7 +24133,7 @@ Client.prototype.getActivationToken = function (verificationURI, callback) {
return callback(new Error("Empty verification code"), null);
}

reqData.url = self.options.server + "/verification/confirmation";
reqData.url = self.options.projectUrl + "/verification/confirmation";
reqData.type = "POST";
reqData.data = {
userId: params["user_id"],
Expand Down Expand Up @@ -24223,7 +24223,7 @@ Client.prototype._createMPinID = function (userId, activationToken, keypair, cal
var self = this,
regData = {};

regData.url = self.options.server + "/registration";
regData.url = self.options.projectUrl + "/registration";
regData.type = "POST";
regData.data = {
userId: userId,
Expand Down Expand Up @@ -24372,7 +24372,7 @@ Client.prototype.generateQuickCode = function (userId, userPin, callback) {
}

self.http.request({
url: self.options.server + "/verification/quickcode",
url: self.options.projectUrl + "/verification/quickcode",
type: "POST",
data: {
projectId: self.options.projectId,
Expand Down Expand Up @@ -24486,7 +24486,7 @@ Client.prototype._getPass1 = function (identityData, userPin, scope, X, SEC, cal
U: res.U
};

self.http.request({ url: self.options.server + "/rps/v2/pass1", type: "POST", data: requestData }, callback);
self.http.request({ url: self.options.projectUrl + "/rps/v2/pass1", type: "POST", data: requestData }, callback);
};

/**
Expand Down Expand Up @@ -24521,7 +24521,7 @@ Client.prototype._getPass2 = function (identityData, scope, yHex, X, SEC, callba
V: vHex
};

self.http.request({ url: self.options.server + "/rps/v2/pass2", type: "POST", data: requestData}, callback);
self.http.request({ url: self.options.projectUrl + "/rps/v2/pass2", type: "POST", data: requestData}, callback);
};

Client.prototype._finishAuthentication = function (userId, userPin, scope, authOTT, callback) {
Expand All @@ -24533,7 +24533,7 @@ Client.prototype._finishAuthentication = function (userId, userPin, scope, authO
"wam": "dvs"
};

self.http.request({ url: self.options.server + "/rps/v2/authenticate", type: "POST", data: requestData }, function (err, result) {
self.http.request({ url: self.options.projectUrl + "/rps/v2/authenticate", type: "POST", data: requestData }, function (err, result) {
if (err) {
return callback(err, result);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/client.min.js

Large diffs are not rendered by default.

Loading