From 7f7910f0a90908fdb8e9a239f70fd1021a606c99 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Sat, 27 Apr 2019 15:54:43 -0400 Subject: [PATCH] Abbreviated type names. --- platform-independent/c/core/src/mpw-types.c | 32 +++++++++++++++++++++ platform-independent/c/core/src/mpw-types.h | 4 +++ 2 files changed, 36 insertions(+) diff --git a/platform-independent/c/core/src/mpw-types.c b/platform-independent/c/core/src/mpw-types.c index feea3798..1a28b468 100644 --- a/platform-independent/c/core/src/mpw-types.c +++ b/platform-independent/c/core/src/mpw-types.c @@ -81,6 +81,38 @@ const MPResultType mpw_typeWithName(const char *typeName) { return (MPResultType)ERR; } +const char *mpw_abbreviationForType(MPResultType resultType) { + + switch (resultType) { + case MPResultTypeTemplateMaximum: + return "max"; + case MPResultTypeTemplateLong: + return "long"; + case MPResultTypeTemplateMedium: + return "med"; + case MPResultTypeTemplateBasic: + return "basic"; + case MPResultTypeTemplateShort: + return "short"; + case MPResultTypeTemplatePIN: + return "pin"; + case MPResultTypeTemplateName: + return "name"; + case MPResultTypeTemplatePhrase: + return "phrase"; + case MPResultTypeStatefulPersonal: + return "own"; + case MPResultTypeStatefulDevice: + return "dev"; + case MPResultTypeDeriveKey: + return "key"; + default: { + dbg( "Unknown password type: %d", resultType ); + return NULL; + } + } +} + const char *mpw_shortNameForType(MPResultType resultType) { switch (resultType) { diff --git a/platform-independent/c/core/src/mpw-types.h b/platform-independent/c/core/src/mpw-types.h index f8610ae8..a6b2a32b 100644 --- a/platform-independent/c/core/src/mpw-types.h +++ b/platform-independent/c/core/src/mpw-types.h @@ -146,6 +146,10 @@ const char *mpw_scopeForPurpose(MPKeyPurpose purpose); * @return The password type represented by the given name. */ const MPResultType mpw_typeWithName(const char *typeName); +/** + * @return The standard identifying name for the given password type. + */ +const char *mpw_abbreviationForType(MPResultType resultType); /** * @return The standard identifying name for the given password type. */