Skip to content

Commit

Permalink
Merge branch 'main' into bush/encrypt-web
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar authored Dec 18, 2024
2 parents df710d9 + 9ce8d7f commit 818f2f8
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 74 deletions.
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Contributing to the MDIP Keychain open source project

1. [Create an issue](https://github.com/KeychainMDIP/kc/issues) first
- Requirements and acceptance criteria should be discussed in the issue
2. Create a development branch from the issue
- Branch name should start with issue number
- Github provides a link in the issue to [create the branch](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/creating-a-branch-for-an-issue)
3. Create a PR from the development branch
- All PRs must be linked to an issue
4. If the PR contains code changes then do a smoke test before merge
- Use `./start-node` to build and run the containers
- Make sure the node syncs OK
- Check the service logs for any errors
- An easy check is to run `./kc perf-test` (to create 100 local ephemeral credentials) followed by `./admin verify-db` (to garbage-collect the test credentials)
5. Merge the PR with squashed commits
6. Use [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) prefixes for the merge commit message
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ services:
environment:
- KC_GATEKEEPER_URL=http://gatekeeper:4224
- KC_NODE_NAME=${KC_NODE_NAME}
- KC_MDIP_PROTOCOL=${KC_MDIP_PROTOCOL}
volumes:
- ./data:/app/hyperswarm/data
user: "${KC_UID}:${KC_GID}"
Expand Down
11 changes: 5 additions & 6 deletions packages/gatekeeper/src/gatekeeper-sdk.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';

let URL = '';
let API = '/api/v1';
const VERSION = '/api/v1';
let API = VERSION;

function throwError(error) {
if (error.response) {
Expand All @@ -13,8 +13,7 @@ function throwError(error) {

export async function start(options = {}) {
if (options.url) {
URL = options.url;
API = `${URL}${API}`;
API = `${options.url}${VERSION}`;
}

if (options.waitUntilReady) {
Expand All @@ -28,7 +27,7 @@ async function waitUntilReady(options = {}) {
let retries = 0;

if (chatty) {
console.log(`Connecting to gatekeeper at ${URL}`);
console.log(`Connecting to gatekeeper at ${API}`);
}

while (!ready) {
Expand All @@ -45,7 +44,7 @@ async function waitUntilReady(options = {}) {
retries += 1;

if (!chatty && becomeChattyAfter > 0 && retries > becomeChattyAfter) {
console.log(`Connecting to gatekeeper at ${URL}`);
console.log(`Connecting to gatekeeper at ${API}`);
chatty = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/keymaster/src/keymaster-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@ export async function unpublishCredential(did) {

export async function createChallenge(challenge = {}, options = {}) {

if (typeof challenge !== 'object' || Array.isArray(challenge)) {
if (!challenge || typeof challenge !== 'object' || Array.isArray(challenge)) {
throw new InvalidParameterError('challenge');
}

Expand Down
1 change: 1 addition & 0 deletions sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ KC_UID=1000
KC_GID=1000
KC_NODE_NAME=mynodeName
KC_NODE_ID=mynodeID
KC_MDIP_PROTOCOL=

# Gatekeeper
KC_DEBUG=false
Expand Down
Loading

0 comments on commit 818f2f8

Please sign in to comment.