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. */