Some checks failed
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
ci/woodpecker/push/bump_version Pipeline failed
39 lines
1.4 KiB
Go
39 lines
1.4 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/tech/sendico/pkg/db/storable"
|
|
"github.com/tech/sendico/pkg/mservice"
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
)
|
|
|
|
type ConfirmationTarget string
|
|
|
|
const (
|
|
ConfirmationTargetLogin ConfirmationTarget = "login"
|
|
ConfirmationTargetPayout ConfirmationTarget = "payout"
|
|
)
|
|
|
|
// ConfirmationCode stores verification codes for operations like login or payouts.
|
|
type ConfirmationCode struct {
|
|
storable.Base `bson:",inline" json:",inline"`
|
|
|
|
AccountRef primitive.ObjectID `bson:"accountRef" json:"accountRef"`
|
|
Destination string `bson:"destination" json:"destination"`
|
|
Target ConfirmationTarget `bson:"target" json:"target"`
|
|
CodeHash []byte `bson:"codeHash" json:"-"`
|
|
Salt []byte `bson:"salt" json:"-"`
|
|
ExpiresAt time.Time `bson:"expiresAt" json:"expiresAt"`
|
|
Attempts int `bson:"attempts" json:"attempts"`
|
|
MaxAttempts int `bson:"maxAttempts" json:"maxAttempts"`
|
|
ResendCount int `bson:"resendCount" json:"resendCount"`
|
|
ResendLimit int `bson:"resendLimit" json:"resendLimit"`
|
|
CooldownUntil time.Time `bson:"cooldownUntil" json:"cooldownUntil"`
|
|
Used bool `bson:"used" json:"used"`
|
|
}
|
|
|
|
func (c *ConfirmationCode) Collection() string {
|
|
return mservice.Confirmations
|
|
}
|