-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from atsign-foundation/jeremy-repl
feat: repl
- Loading branch information
Showing
11 changed files
with
501 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,59 @@ | ||
#pragma once | ||
|
||
#define TOKEN_AES_PKAM_PUBLIC_KEY "aesPkamPublicKey" | ||
#define TOKEN_AES_PKAM_PUBLIC_KEY_LEN 16 | ||
|
||
#define TOKEN_AES_PKAM_PRIVATE_KEY "aesPkamPrivateKey" | ||
#define TOKEN_AES_PKAM_PRIVATE_KEY_LEN 17 | ||
|
||
#define TOKEN_AES_ENCRYPT_PUBLIC_KEY "aesEncryptPublicKey" | ||
#define TOKEN_AES_ENCRYPT_PUBLIC_KEY_LEN 19 | ||
|
||
#define TOKEN_AES_ENCRYPT_PRIVATE_KEY "aesEncryptPrivateKey" | ||
#define TOKEN_AES_ENCRYPT_PRIVATE_KEY_LEN 20 | ||
|
||
#define TOKEN_SELF_ENCRYPTION_KEY "selfEncryptionKey" | ||
#define TOKEN_SELF_ENCRYPTION_KEY_LEN 17 | ||
|
||
typedef struct atclient_atkeysfile_entry{ | ||
size_t len; | ||
char* key; | ||
char *key; | ||
} atclient_atkeysfile_entry; | ||
|
||
typedef struct atclient_atkeysfile{ | ||
atclient_atkeysfile_entry* aesPkamPublicKey; | ||
atclient_atkeysfile_entry* aesPkamPrivateKey; | ||
atclient_atkeysfile_entry* aesEncryptPublicKey; | ||
atclient_atkeysfile_entry* aesEncryptPrivateKey; | ||
atclient_atkeysfile_entry* selfEncryptionKey; | ||
atclient_atkeysfile_entry* atSign; | ||
typedef struct atclient_atkeysfile { | ||
atclient_atkeysfile_entry *aes_pkam_public_key; | ||
atclient_atkeysfile_entry *aes_pkam_private_key; | ||
atclient_atkeysfile_entry *aes_encrypt_public_key; | ||
atclient_atkeysfile_entry *aes_encrypt_private_key; | ||
atclient_atkeysfile_entry *self_encryption_key; | ||
} atclient_atkeysfile; | ||
|
||
void atclient_atkeysfile_init(atclient_atkeysfile** atkeysfile); | ||
char* save(char* token, atclient_atkeysfile_entry* attribute); | ||
void updateFileLine(char** line, char* type, atclient_atkeysfile_entry *attribute, int comma); | ||
int atclient_atkeysfile_read(const char* path, const size_t pathlen, atclient_atkeysfile* atsign); | ||
int atclient_atkeysfile_write(const char *path, const size_t len, atclient_atkeysfile *atsign); | ||
void atclient_atkeysfile_init(atclient_atkeysfile *atkeysfile); | ||
int atclient_atkeysfile_read(const char *path, atclient_atkeysfile *atkeysfile); | ||
int atclient_atkeysfile_write(const char *path, const char *atsign, atclient_atkeysfile *atkeysfile); | ||
void atclient_atkeysfile_free(atclient_atkeysfile *atkeysfile); | ||
|
||
/** | ||
* Usage example | ||
* atclient_atkeysfile atkeysfile; | ||
* atclient_atkeysfile_init(&atkeysfile); | ||
* printf("done init...\n") | ||
* | ||
ret = atclient_atkeysfile_read(path, &atkeysfile); | ||
if (ret != 0) | ||
{ | ||
goto exit; | ||
} | ||
printf("done read...\n"); | ||
printf("aes_pkam_public_key: %s\n", atkeysfile.aes_pkam_public_key->key); | ||
printf("aes_pkam_private_key: %s\n", atkeysfile.aes_pkam_private_key->key); | ||
printf("aes_encrypt_public_key: %s\n", atkeysfile.aes_encrypt_public_key->key); | ||
printf("aes_encrypt_private_key: %s\n", atkeysfile.aes_encrypt_private_key->key); | ||
printf("self_encryption_key: %s\n", atkeysfile.self_encryption_key->key); | ||
printf("writing...\n"); | ||
ret = atclient_atkeysfile_write("/Users/jeremytubongbanua/.atsign/temp/@smoothalligator_key.atKeys", ATSIGN, &atkeysfile); | ||
* | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.