diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-10-15 17:43:29 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-10-15 17:43:29 +0200 |
commit | ffd4382a73e2fa1d99812df14ed1025fadeb4017 (patch) | |
tree | 25dd9de304d385a172569baba5be482bb84b6371 /src/include | |
parent | e57ffbb53604b5a9606301589c0644a2b1383467 (diff) | |
download | gnunet-ffd4382a73e2fa1d99812df14ed1025fadeb4017.tar.gz gnunet-ffd4382a73e2fa1d99812df14ed1025fadeb4017.zip |
-documentation on new api
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_gnsrecord_lib.h | 20 | ||||
-rw-r--r-- | src/include/gnunet_identity_service.h | 53 |
2 files changed, 71 insertions, 2 deletions
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index 559208689..22e7c0e25 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h | |||
@@ -659,19 +659,35 @@ size_t | |||
659 | GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block); | 659 | GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block); |
660 | 660 | ||
661 | /** | 661 | /** |
662 | * Returns the expiration of a block | 662 | * Returns the expiration of a block. |
663 | * | ||
664 | * @param block the block. | ||
665 | * @return the block expiration. | ||
663 | */ | 666 | */ |
664 | struct GNUNET_TIME_Absolute | 667 | struct GNUNET_TIME_Absolute |
665 | GNUNET_GNSRECORD_block_get_expiration (const struct GNUNET_GNSRECORD_Block *block); | 668 | GNUNET_GNSRECORD_block_get_expiration (const struct GNUNET_GNSRECORD_Block *block); |
666 | 669 | ||
667 | 670 | ||
668 | /** | 671 | /** |
669 | * Builds the query from a block | 672 | * Builds the query hash from a block. |
673 | * | ||
674 | * @param block the block. | ||
675 | * @param query where to write the query hash. | ||
676 | * @return GNUNET_SYSERR on error. | ||
670 | */ | 677 | */ |
671 | enum GNUNET_GenericReturnValue | 678 | enum GNUNET_GenericReturnValue |
672 | GNUNET_GNSRECORD_query_from_block (const struct GNUNET_GNSRECORD_Block *block, | 679 | GNUNET_GNSRECORD_query_from_block (const struct GNUNET_GNSRECORD_Block *block, |
673 | struct GNUNET_HashCode *query); | 680 | struct GNUNET_HashCode *query); |
674 | 681 | ||
682 | |||
683 | /** | ||
684 | * Build a #GNUNET_GNSRECORD_PublicKey from a | ||
685 | * zone delegation resource record set. | ||
686 | * | ||
687 | * @param the resource record set. MUST be a delegation record. | ||
688 | * @param key where to write the identtiy key. | ||
689 | * @return GNUNET_SYSERR on error or if the zone is not a delegation zone. | ||
690 | */ | ||
675 | enum GNUNET_GenericReturnValue | 691 | enum GNUNET_GenericReturnValue |
676 | GNUNET_GNSRECORD_record_to_identity_key (const struct GNUNET_GNSRECORD_Data *rd, | 692 | GNUNET_GNSRECORD_record_to_identity_key (const struct GNUNET_GNSRECORD_Data *rd, |
677 | struct GNUNET_IDENTITY_PublicKey *key); | 693 | struct GNUNET_IDENTITY_PublicKey *key); |
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h index c72e6d146..3352d9bc0 100644 --- a/src/include/gnunet_identity_service.h +++ b/src/include/gnunet_identity_service.h | |||
@@ -363,27 +363,80 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id, | |||
363 | void | 363 | void |
364 | GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op); | 364 | GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op); |
365 | 365 | ||
366 | |||
367 | /** | ||
368 | * Get the compacted length of a #GNUNET_IDENTITY_PublicKey. | ||
369 | * Compacted means that it returns the minimum number of bytes this | ||
370 | * key is long, as opposed to the union structure inside | ||
371 | * #GNUNET_IDENTITY_PublicKey. | ||
372 | * Useful for compact serializations. | ||
373 | * | ||
374 | * @param key the key. | ||
375 | * @return -1 on error, else the compacted length of the key. | ||
376 | */ | ||
366 | ssize_t | 377 | ssize_t |
367 | GNUNET_IDENTITY_key_get_length (const struct GNUNET_IDENTITY_PublicKey *key); | 378 | GNUNET_IDENTITY_key_get_length (const struct GNUNET_IDENTITY_PublicKey *key); |
368 | 379 | ||
380 | |||
381 | /** | ||
382 | * Creates a (Base32) string representation of the public key. | ||
383 | * The resulting string encodes a compacted representation of the key. | ||
384 | * See also #GNUNET_IDENTITY_key_get_length. | ||
385 | * | ||
386 | * @param key the key. | ||
387 | * @return the string representation of the key, or NULL on error. | ||
388 | */ | ||
369 | char * | 389 | char * |
370 | GNUNET_IDENTITY_public_key_to_string (const struct | 390 | GNUNET_IDENTITY_public_key_to_string (const struct |
371 | GNUNET_IDENTITY_PublicKey *key); | 391 | GNUNET_IDENTITY_PublicKey *key); |
372 | 392 | ||
373 | 393 | ||
394 | /** | ||
395 | * Creates a (Base32) string representation of the private key. | ||
396 | * The resulting string encodes a compacted representation of the key. | ||
397 | * See also #GNUNET_IDENTITY_key_get_length. | ||
398 | * | ||
399 | * @param key the key. | ||
400 | * @return the string representation of the key, or NULL on error. | ||
401 | */ | ||
374 | char * | 402 | char * |
375 | GNUNET_IDENTITY_private_key_to_string (const struct | 403 | GNUNET_IDENTITY_private_key_to_string (const struct |
376 | GNUNET_IDENTITY_PrivateKey *key); | 404 | GNUNET_IDENTITY_PrivateKey *key); |
377 | 405 | ||
378 | 406 | ||
407 | /** | ||
408 | * Parses a (Base32) string representation of the public key. | ||
409 | * See also #GNUNET_IDENTITY_public_key_to_string. | ||
410 | * | ||
411 | * @param str the encoded key. | ||
412 | * @param key where to write the key. | ||
413 | * @return GNUNET_SYSERR on error. | ||
414 | */ | ||
379 | enum GNUNET_GenericReturnValue | 415 | enum GNUNET_GenericReturnValue |
380 | GNUNET_IDENTITY_public_key_from_string (const char*str, | 416 | GNUNET_IDENTITY_public_key_from_string (const char*str, |
381 | struct GNUNET_IDENTITY_PublicKey *key); | 417 | struct GNUNET_IDENTITY_PublicKey *key); |
382 | 418 | ||
419 | |||
420 | /** | ||
421 | * Parses a (Base32) string representation of the private key. | ||
422 | * See also #GNUNET_IDENTITY_private_key_to_string. | ||
423 | * | ||
424 | * @param str the encoded key. | ||
425 | * @param key where to write the key. | ||
426 | * @return GNUNET_SYSERR on error. | ||
427 | */ | ||
383 | enum GNUNET_GenericReturnValue | 428 | enum GNUNET_GenericReturnValue |
384 | GNUNET_IDENTITY_private_key_from_string (const char*str, | 429 | GNUNET_IDENTITY_private_key_from_string (const char*str, |
385 | struct GNUNET_IDENTITY_PrivateKey *key); | 430 | struct GNUNET_IDENTITY_PrivateKey *key); |
386 | 431 | ||
432 | |||
433 | /** | ||
434 | * Retrieves the public key representation of a private key. | ||
435 | * | ||
436 | * @param privkey the private key. | ||
437 | * @param key the public key result. | ||
438 | * @return GNUNET_SYSERR on error. | ||
439 | */ | ||
387 | enum GNUNET_GenericReturnValue | 440 | enum GNUNET_GenericReturnValue |
388 | GNUNET_IDENTITY_key_get_public (const struct GNUNET_IDENTITY_PrivateKey *privkey, | 441 | GNUNET_IDENTITY_key_get_public (const struct GNUNET_IDENTITY_PrivateKey *privkey, |
389 | struct GNUNET_IDENTITY_PublicKey *key); | 442 | struct GNUNET_IDENTITY_PublicKey *key); |