Skip to content

Commit

Permalink
Merge branch '1.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
Lomilar committed Nov 23, 2024
2 parents 227afee + 5dc5978 commit 6363be9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/com/eduworks/ec/promises/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ module.exports = {
p = p.catch(failure);
return p;
},
cassReturnNullAsPromise: function (success, failure, error) {
let p = new Promise((resolve, reject) => {
resolve(null);
});
if (success !== undefined && success != null && failure !== undefined && failure != null)
p = p.then(success, failure);
else if (success !== undefined && success != null)
p = p.then(success);
else if (failure !== undefined && failure != null)
p = p.catch(failure);
return p;
},
cassReturnAsPromise: function (o, success, failure, error) {
let p = new Promise((resolve, reject) => {
if (o === undefined || o == null) {
Expand Down
3 changes: 2 additions & 1 deletion src/org/cassproject/ebac/repository/EcRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ const EcIdentityManager = require("../identity/EcIdentityManager");
const EcRekeyRequest = require("../identity/EcRekeyRequest");
const EcArray = require("../../../../com/eduworks/ec/array/EcArray");
const EcRemote = require("../../../../com/eduworks/ec/remote/EcRemote");
const { cassPromisify, cassReturnAsPromise } = require("../../../../com/eduworks/ec/promises/helpers");
const { cassPromisify, cassReturnAsPromise, cassReturnNullAsPromise } = require("../../../../com/eduworks/ec/promises/helpers");
const EcRemoteLinkedData = require("../../schema/general/EcRemoteLinkedData");
const EcCrypto = require("../../../../com/eduworks/ec/crypto/EcCrypto");
const EcIdentity = require("../identity/EcIdentity");
const EcPpkFacade = require("../../../../com/eduworks/ec/crypto/EcPpkFacade");
const EcPk = require("../../../../com/eduworks/ec/crypto/EcPk");
const EcLinkedData = require("../../../json/ld/EcLinkedData.js");
require("../../general/AuditLogger.js")

/**
Expand Down
1 change: 1 addition & 0 deletions src/test/EcRepository.l2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const EcEncryptedValue = require('../org/cassproject/ebac/repository/EcEncrypted
const EcIdentityManager = require('../org/cassproject/ebac/identity/EcIdentityManager.js');
const EcIdentity = require('../org/cassproject/ebac/identity/EcIdentity.js');
const EcPpk = require('../com/eduworks/ec/crypto/EcPpk.js');
const EcLinkedData = require('../org/json/ld/EcLinkedData.js');

let hrtime = function () {
try {
Expand Down
9 changes: 6 additions & 3 deletions src/test/skyId.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ describe('SkyID Adapter', function() {
let newPassword = EcAes.newSecret(6);
let name = 'Test User';
let ident = null;
if ((typeof Cypress !== 'undefined') && Cypress != null && Cypress.env != null)
process.env.CASS_LOOPBACK = Cypress.env('CASS_LOOPBACK');
console.log(process.env.CASS_LOOPBACK);

it('create user', async () => {
let rld = new EcRemoteIdentityManager();
rld.server = 'http://localhost/api/';
rld.server = process.env.CASS_LOOPBACK || 'http://localhost/api/';
await rld.configureFromServer(null, null);
rld.startLogin(username, password);
let im = new EcIdentityManager();
Expand All @@ -32,7 +35,7 @@ describe('SkyID Adapter', function() {

it('change password', async () => {
let rld = new EcRemoteIdentityManager();
rld.server = 'http://localhost/api/';
rld.server = process.env.CASS_LOOPBACK || 'http://localhost/api/';
await rld.configureFromServer(null, null);
rld.startLogin(username, password);
let im = await rld.fetch();
Expand All @@ -43,7 +46,7 @@ describe('SkyID Adapter', function() {

it('load user', async () => {
let rld = new EcRemoteIdentityManager();
rld.server = 'http://localhost/api/';
rld.server = process.env.CASS_LOOPBACK || 'http://localhost/api/';
await rld.configureFromServer(null, null);
rld.startLogin(username, newPassword);
let im = await rld.fetch();
Expand Down

0 comments on commit 6363be9

Please sign in to comment.