Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EncToken ¶
type EncToken struct {
// contains filtered or unexported fields
}
func NewArgon2idTokenCrypt ¶
NewArgon2idTokenCrypt returns a new 3ncr.org encrypter / decrypter whose AES-256 key is derived from secret and salt using Argon2id with the parameters recommended by the 3ncr.org v1 spec for low-entropy secrets (m=19456 KiB, t=2, p=1). salt must be at least 16 bytes.
func NewRawTokenCrypt ¶
NewRawTokenCrypt returns a new 3ncr.org encrypter / decrypter from a raw 32-byte AES-256 key. Derive the key however you prefer — Argon2id for passwords, a single SHA3-256 hash for high-entropy inputs (random keys, API tokens). See the 3ncr.org spec for recommended parameters.
func NewTokenCrypt
deprecated
NewTokenCrypt returns a new 3ncr.org encrypter / decrypter. It derives AES-256 key using PBKDF2 with SHA3-256.
Deprecated: PBKDF2-SHA3 is the legacy KDF, retained for decrypting existing 3ncr.org data. New callers should use NewArgon2idTokenCrypt for low-entropy secrets (passwords) or NewRawTokenCrypt for high-entropy keys (random 32-byte keys, SHA3-256 of an API token, etc.). See the 3ncr.org spec Key Derivation section.
func (*EncToken) DecryptIf3ncr ¶
DecryptIf3ncr decrypts a 3ncr.org string If the string does not starts with 3ncr.org header, it returns the argument unmodified and no error