correio/passwordless
Independent passwordless evidence. Applications own delivery and sessions.
Types
pub type ConfigError {
InvalidBinding
WeakKey
InvalidPolicy
InvalidCodeLength
}
Constructors
-
InvalidBinding -
WeakKey -
InvalidPolicy -
InvalidCodeLength
pub type IssueError(a) {
InvalidIssue(ConfigError)
IssueFailed(store.Fault)
IssueUnknown(IssueRecovery(a))
}
Constructors
-
InvalidIssue(ConfigError) -
IssueFailed(store.Fault) -
IssueUnknown(IssueRecovery(a))
pub opaque type IssueRecovery(a)
pub type Method {
MagicLink
EmailCode(digits: Int)
}
Constructors
-
MagicLink -
EmailCode(digits: Int)
pub type RevokeError(a) {
RevokeRefused(store.Refusal)
RevokeFailed(store.Fault)
RevokeUnknown(RevokeRecovery(a))
}
Constructors
-
RevokeRefused(store.Refusal) -
RevokeFailed(store.Fault) -
RevokeUnknown(RevokeRecovery(a))
pub opaque type RevokeRecovery(a)
pub type VerifyError(a) {
Refused(store.Refusal)
VerifyFailed(store.Fault)
VerifyUnknown(VerifyRecovery(a))
}
Constructors
-
Refused(store.Refusal) -
VerifyFailed(store.Fault) -
VerifyUnknown(VerifyRecovery(a))
pub opaque type VerifyRecovery(a)
Values
pub fn authenticated_at(evidence: Verified(a)) -> Int
pub fn challenge_answer(challenge: Challenge(a)) -> String
Secret projection for explicit delivery only. Do not log this value.
pub fn challenge_expires_at(challenge: Challenge(a)) -> Int
pub fn challenge_id(challenge: Challenge(a)) -> String
pub fn describe_issue_error(error: IssueError(a)) -> String
Use these descriptions for ordinary logs. Runtime inspection of opaque values can reveal keys, answers, subjects, and recovery commands.
pub fn describe_revoke_error(error: RevokeError(a)) -> String
pub fn describe_verify_error(error: VerifyError(a)) -> String
pub fn destination(evidence: Verified(a)) -> String
pub fn issue(
service: Service(a),
subject: a,
destination: String,
method: Method,
) -> Result(Challenge(a), IssueError(a))
pub fn new(
store: store.Store(a),
scope: String,
purpose: String,
key: BitArray,
) -> Result(Service(a), ConfigError)
The key must contain at least 32 cryptographically random bytes. Keep it stable across service instances that share a store and its retained rows.
pub fn recover_issue(
recovery: IssueRecovery(a),
) -> Result(Challenge(a), IssueError(a))
pub fn recover_revoke(
recovery: RevokeRecovery(a),
) -> Result(Nil, RevokeError(a))
pub fn recover_verify(
recovery: VerifyRecovery(a),
) -> Result(Verified(a), VerifyError(a))
pub fn revoke(
service: Service(a),
id: String,
) -> Result(Nil, RevokeError(a))
pub fn verification_id(evidence: Verified(a)) -> String
pub fn verify(
service: Service(a),
id: String,
destination: String,
answer: String,
) -> Result(Verified(a), VerifyError(a))
Destination must be the current trusted application-selected value. Exact comparison is intentional; this module does not normalize email addresses.
pub fn with_policy(
service: Service(a),
ttl_ms: Int,
max_attempts: Int,
retention_ms: Int,
) -> Result(Service(a), ConfigError)
Milliseconds. TTL is bounded at 24h, attempts at 100, retention at 30 days.