Struct CreateUserRequest

Source
pub struct CreateUserRequest {
Show 18 fields pub external_id: Option<Option<String>>, pub first_name: Option<Option<String>>, pub last_name: Option<Option<String>>, pub email_address: Option<Vec<String>>, pub phone_number: Option<Vec<String>>, pub web3_wallet: Option<Vec<String>>, pub username: Option<Option<String>>, pub password: Option<Option<String>>, pub password_digest: Option<String>, pub password_hasher: Option<PasswordHasher>, pub skip_password_checks: Option<bool>, pub skip_password_requirement: Option<bool>, pub totp_secret: Option<String>, pub backup_codes: Option<Vec<String>>, pub public_metadata: Option<Value>, pub private_metadata: Option<Value>, pub unsafe_metadata: Option<Value>, pub created_at: Option<String>,
}

Fields§

§external_id: Option<Option<String>>

The ID of the user as used in your external systems or your previous authentication solution. Must be unique across your instance.

§first_name: Option<Option<String>>

The first name to assign to the user

§last_name: Option<Option<String>>

The last name to assign to the user

§email_address: Option<Vec<String>>

Email addresses to add to the user. Must be unique across your instance. The first email address will be set as the user’s primary email address.

§phone_number: Option<Vec<String>>

Phone numbers to add to the user. Must be unique across your instance. The first phone number will be set as the user’s primary phone number.

§web3_wallet: Option<Vec<String>>

Web3 wallets to add to the user. Must be unique across your instance. The first wallet will be set as the user’s primary wallet.

§username: Option<Option<String>>

The username to give to the user. It must be unique across your instance.

§password: Option<Option<String>>

The plaintext password to give the user. Must be at least 8 characters long, and can not be in any list of hacked passwords.

§password_digest: Option<String>

In case you already have the password digests and not the passwords, you can use them for the newly created user via this property. The digests should be generated with one of the supported algorithms. The hashing algorithm can be specified using the password_hasher property.

§password_hasher: Option<PasswordHasher>

The hashing algorithm that was used to generate the password digest. The algorithms we support at the moment are bcrypt, bcrypt_sha256_django, md5, pbkdf2_sha256, pbkdf2_sha256_django, phpass, scrypt_firebase, sha256 and the argon2 variants argon2i and argon2id. If you need support for any particular hashing algorithm, please let us know. Note: for password hashers considered insecure (at this moment MD5 and SHA256), the corresponding user password hashes will be transparently migrated to Bcrypt (a secure hasher) upon the user’s first successful password sign in. Insecure schemes are marked with (insecure) in the list below. Each of the supported hashers expects the incoming digest to be in a particular format. Specifically: bcrypt: The digest should be of the following form: $<algorithm version>$<cost>$<salt & hash> bcrypt_sha256_django: This is the Django-specific variant of Bcrypt, using SHA256 hashing function. The format should be as follows (as exported from Django): bcrypt_sha256$$<algorithm version>$<cost>$<salt & hash> md5 (insecure): The digest should follow the regular form e.g.: 5f4dcc3b5aa765d61d8327deb882cf99 pbkdf2_sha256: This is the PBKDF2 algorithm using the SHA256 hashing function. The format should be as follows: pbkdf2_sha256$<iterations>$<salt>$<hash> Note: Both the salt and the hash are expected to be base64-encoded. pbkdf2_sha256_django: This is the Django-specific variant of PBKDF2 and the digest should have the following format (as exported from Django): pbkdf2_sha256$<iterations>$<salt>$<hash> Note: The salt is expected to be un-encoded, the hash is expected base64-encoded. pbkdf2_sha1: This is similar to pkbdf2_sha256_django, but with two differences: 1. uses sha1 instead of sha256 2. accepts the hash as a hex-encoded string The format is the following: pbkdf2_sha1$<iterations>$<salt>$<hash-as-hex-string> phpass: Portable public domain password hashing framework for use in PHP applications. Digests hashed with phpass have the following sections: The format is the following: $P$<rounds><salt><encoded-checksum> - $P$ is the prefix used to identify phpass hashes. - rounds is a single character encoding a 6-bit integer representing the number of rounds used. - salt is eight characters drawn from [./0-9A-Za-z], providing a 48-bit salt. - checksum is 22 characters drawn from the same set, encoding the 128-bit checksum with MD5. scrypt_firebase: The Firebase-specific variant of scrypt. The value is expected to have 6 segments separated by the $ character and include the following information: hash: The actual Base64 hash. This can be retrieved when exporting the user from Firebase. salt: The salt used to generate the above hash. Again, this is given when exporting the user. signer key: The base64 encoded signer key. salt separator: The base64 encoded salt separator. rounds: The number of rounds the algorithm needs to run. memory cost: The cost of the algorithm run The first 2 (hash and salt) are per user and can be retrieved when exporting the user from Firebase. The other 4 values (signer key, salt separator, rounds and memory cost) are project-wide settings and can be retrieved from the project’s password hash parameters. Once you have all these, you can combine it in the following format and send this as the digest in order for Clerk to accept it: <hash>$<salt>$<signer key>$<salt separator>$<rounds>$<memory cost> argon2i: Algorithms in the argon2 family generate digests that encode the following information: version (v): The argon version, version 19 is assumed memory (m): The memory used by the algorithm (in kibibytes) iterations (t): The number of iterations to perform parallelism (p): The number of threads to use Parts are demarcated by the $ character, with the first part identifying the algorithm variant. The middle part is a comma-separated list of the encoding options (memory, iterations, parallelism). The final part is the actual digest. $argon2i$v=19$m=4096,t=3,p=1$4t6CL3P7YiHBtwESXawI8Hm20zJj4cs7/4/G3c187e0$m7RQFczcKr5bIR0IIxbpO2P0tyrLjf3eUW3M3QSwnLc argon2id: See the previous algorithm for an explanation of the formatting. For the argon2id case, the value of the algorithm in the first part of the digest is argon2id: $argon2id$v=19$m=64,t=4,p=8$Z2liZXJyaXNo$iGXEpMBTDYQ8G/71tF0qGjxRHEmR3gpGULcE93zUJVU sha256 (insecure): The digest should be a 64-length hex string, e.g.: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08

§skip_password_checks: Option<bool>

When set to true all password checks are skipped. It is recommended to use this method only when migrating plaintext passwords to Clerk. Upon migration the user base should be prompted to pick stronger password.

§skip_password_requirement: Option<bool>

When set to true, password is not required anymore when creating the user and can be omitted. This is useful when you are trying to create a user that doesn’t have a password, in an instance that is using passwords. Please note that you cannot use this flag if password is the only way for a user to sign into your instance.

§totp_secret: Option<String>

In case TOTP is configured on the instance, you can provide the secret to enable it on the newly created user without the need to reset it. Please note that currently the supported options are: * Period: 30 seconds * Code length: 6 digits * Algorithm: SHA1

§backup_codes: Option<Vec<String>>

If Backup Codes are configured on the instance, you can provide them to enable it on the newly created user without the need to reset them. You must provide the backup codes in plain format or the corresponding bcrypt digest.

§public_metadata: Option<Value>

Metadata saved on the user, that is visible to both your Frontend and Backend APIs

§private_metadata: Option<Value>

Metadata saved on the user, that is only visible to your Backend API

§unsafe_metadata: Option<Value>

Metadata saved on the user, that can be updated from both the Frontend and Backend APIs. Note: Since this data can be modified from the frontend, it is not guaranteed to be safe.

§created_at: Option<String>

A custom date/time denoting when the user signed up to the application, specified in RFC3339 format (e.g. 2012-10-20T07:15:20.902Z).

Implementations§

Trait Implementations§

Source§

impl Clone for CreateUserRequest

Source§

fn clone(&self) -> CreateUserRequest

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CreateUserRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CreateUserRequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for CreateUserRequest

Source§

fn eq(&self, other: &CreateUserRequest) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CreateUserRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CreateUserRequest

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,