/// <summary> /// Creates an ApiKeyV3 from an APIKey V1/V2 format (GUID). /// </summary> public static ApiKeyV3 CreateFromV1V2ApiKey(string plaintextApiKey) { // Since V1/V2/V3 have the same format (Guid), we can use the same parse method if (!TryParse(plaintextApiKey, out ApiKeyV3 apiKeyV3)) { throw new ArgumentException("Invalid format for ApiKey V1/V2"); } apiKeyV3.HashedApiKey = apiKeyV3.IdPart + V3Hasher.GenerateHash(apiKeyV3.PasswordPart); return(apiKeyV3); }
public Credential CreatePasswordCredential(string plaintextPassword) { return(new Credential( LatestPasswordType, V3Hasher.GenerateHash(plaintextPassword))); }