1
0
mirror of https://github.com/XFox111/SimpleOTP.git synced 2026-04-22 08:00:45 +03:00
1
simpleotp.fluent.otpconfigfluentextensions
Eugene Fox edited this page 2024-09-18 16:16:09 +03:00

OtpConfigFluentExtensions

Namespace: SimpleOTP.Fluent

Provides fluent API for configuring OtpConfig objects.

public static class OtpConfigFluentExtensions

Inheritance ObjectOtpConfigFluentExtensions
Attributes NullableContextAttribute, NullableAttribute, ExtensionAttribute

Methods

WithLabel(OtpConfig, String)

Sets the OtpConfig.Label property.

public static OtpConfig WithLabel(OtpConfig config, string label)

Parameters

config OtpConfig
The OtpConfig object to configure.

label String
The label of the OTP config.

Returns

OtpConfig
The configured OtpConfig object.

WithIssuer(OtpConfig, String)

Sets the OtpConfig.Issuer property.

public static OtpConfig WithIssuer(OtpConfig config, string issuer)

Parameters

config OtpConfig
The OtpConfig object to configure.

issuer String
The issuer of the OTP config.

Returns

OtpConfig
The configured OtpConfig object.

WithAppleIssuer(OtpConfig, String, String)

Sets the issuer info, according to Apple specification.

public static OtpConfig WithAppleIssuer(OtpConfig config, string displayName, string domain)

Parameters

config OtpConfig
The OtpConfig object to configure.

displayName String
The display name of the issuer.

domain String
The domain name of the issuer.

Returns

OtpConfig

WithNewSecret(OtpConfig, Int32)

Sets the OtpConfig.Secret property with a new secret.

public static OtpConfig WithNewSecret(OtpConfig config, int bytesLength)

Parameters

config OtpConfig
The OtpConfig object to configure.

bytesLength Int32
The length of the secret in bytes.

Returns

OtpConfig
The configured OtpConfig object.

WithSecret(OtpConfig, OtpSecret)

Sets the OtpConfig.Secret property with specified secret.

public static OtpConfig WithSecret(OtpConfig config, OtpSecret secret)

Parameters

config OtpConfig
The OtpConfig object to configure.

secret OtpSecret
The secret to use.

Returns

OtpConfig
The configured OtpConfig object.

WithAlgorithm(OtpConfig, OtpAlgorithm)

Sets the OtpConfig.Algorithm property.

public static OtpConfig WithAlgorithm(OtpConfig config, OtpAlgorithm algorithm)

Parameters

config OtpConfig
The OtpConfig object to configure.

algorithm OtpAlgorithm
The algorithm to use.

Returns

OtpConfig
The configured OtpConfig object.

Remarks:

Not recommended for use, since most implementations do not support custom values.

WithDigits(OtpConfig, Int32)

Sets the OtpConfig.Digits property.

public static OtpConfig WithDigits(OtpConfig config, int digits)

Parameters

config OtpConfig
The OtpConfig object to configure.

digits Int32
The number of digits to use.

Returns

OtpConfig
The configured OtpConfig object.

Remarks:

Not recommended for use, since most implementations do not support custom values.

AddCustomProperty(OtpConfig, String, String)

Adds a custom vendor-specific property to the OtpConfig.

public static OtpConfig AddCustomProperty(OtpConfig config, string key, string value)

Parameters

config OtpConfig
The OtpConfig object to configure.

key String
The key of the property.

value String
The value of the property.

Returns

OtpConfig
The configured OtpConfig object.

Remarks:

If set, reserved keys issuer, digits, counter, secret, period and algorithm will be removed from the OtpConfig.CustomProperties upon it's serialization to URI.

CreateGenerator(OtpConfig)

Creates a new Otp object from the provided OtpConfig

public static Otp CreateGenerator(OtpConfig config)

Parameters

config OtpConfig
The OtpConfig object to use.

Returns

Otp
A new Otp object.