Skip to content

Commit

Permalink
feat: impl to create new enollments using APKAM-OTP (#453)
Browse files Browse the repository at this point in the history
* feat: introduce new params into the arg_parser

* feat: add param "err_msg" to atclient_pkam_authenticate

* feat: new method to parse enroll_namespace_list_t from string

* feat: introduce auth_cli

* chore: revert changes reg recursive write in atclient/connection.c

* feat: migrate constants to atauth_constants.h + minor refactoring

* feat: support for unauthenticated public key lookup

* feat: support to parse enroll namespaces from string

* feat: add new request param 'should_auth' in get_public_key_request_options

* feat: completed auth_cli implementation

* feat: impl multiple exits for auth_cli + minor refactoring

* fix: linux specific header issue + unit test

* chore: fix examples

* fix: introduce init method and use for enroll namespace list

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: xavierchanth <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored and JeremyTubongbanua committed Dec 23, 2024
1 parent fb8fb71 commit 7e73d9f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 42 deletions.
33 changes: 1 addition & 32 deletions tests/functional_tests/lib/src/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,7 @@ int functional_tests_pkam_auth(atclient *atclient, atclient_atkeys *atkeys, cons

atlogger_log(TAG, ATLOGGER_LOGGING_LEVEL_INFO, "functional_tests_pkam_auth Begin\n");

if(atclient == NULL) {
ret = 1;
atlogger_log(TAG, ATLOGGER_LOGGING_LEVEL_ERROR, "atclient is NULL\n");
return ret;
}

if(atkeys == NULL) {
ret = 1;
atlogger_log(TAG, ATLOGGER_LOGGING_LEVEL_ERROR, "atkeys is NULL\n");
return ret;
}

if(atsign == NULL) {
ret = 1;
atlogger_log(TAG, ATLOGGER_LOGGING_LEVEL_ERROR, "atsign is NULL\n");
return ret;
}

atclient_authenticate_options authenticate_options;
atclient_authenticate_options_init(&authenticate_options);

if((ret = atclient_authenticate_options_set_atdirectory_host(&authenticate_options, ATDIRECTORY_HOST)) != 0) {
atlogger_log(TAG, ATLOGGER_LOGGING_LEVEL_ERROR, "atclient_authenticate_options_set_atdirectory_host: %d\n", ret);
goto exit;
}

if((ret = atclient_authenticate_options_set_atdirectory_port(&authenticate_options, ATDIRECTORY_PORT)) != 0) {
atlogger_log(TAG, ATLOGGER_LOGGING_LEVEL_ERROR, "atclient_authenticate_options_set_atdirectory_port: %d\n", ret);
goto exit;
}

if ((ret = atclient_pkam_authenticate(atclient, atsign, atkeys, &authenticate_options)) != 0) {
if ((ret = atclient_pkam_authenticate(atclient, atsign, atkeys, NULL, NULL)) != 0) {
atlogger_log(TAG, ATLOGGER_LOGGING_LEVEL_ERROR, "atclient_pkam_authenticate: %d\n", ret);
goto exit;
}
Expand Down
12 changes: 2 additions & 10 deletions tests/functional_tests/tests/test_atclient_pkam_authenticate.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static int test1_pkam_no_options() {
}
atlogger_log(tag, ATLOGGER_LOGGING_LEVEL_INFO, "atclient_atkeys_populate_from_atkeys_file: %d\n", ret);

if ((ret = atclient_pkam_authenticate(&atclient, atsign, &atkeys, &authenticate_options)) != 0) {
if ((ret = atclient_pkam_authenticate(&atclient, atsign, &atkeys, NULL, NULL)) != 0) {
atlogger_log(tag, ATLOGGER_LOGGING_LEVEL_ERROR, "Failed to authenticate\n");
return ret;
} else {
Expand Down Expand Up @@ -123,15 +123,7 @@ static int test2_pkam_with_options() {
return ret;
}

if ((ret = atclient_authenticate_options_set_atserver_host(&options, atserver_host)) != 0) {
return ret;
}

if ((ret = atclient_authenticate_options_set_atserver_port(&options, atserver_port)) != 0) {
return ret;
}

if ((ret = atclient_pkam_authenticate(&atclient, atsign, &atkeys, &options)) != 0) {
if ((ret = atclient_pkam_authenticate(&atclient, atsign, &atkeys, NULL, NULL)) != 0) {
atlogger_log(tag, ATLOGGER_LOGGING_LEVEL_ERROR, "Failed to authenticate\n");
return ret;
} else {
Expand Down

0 comments on commit 7e73d9f

Please sign in to comment.