mirror of
https://github.com/wneessen/apg-go.git
synced 2024-11-22 22:00:49 +01:00
Winni Neessen
2c7db946be
This commit introduces a new "Examples" section in the README.md to illustrate usage, ranging from website login password, PIN generation, to phone verification. In addition, it includes a new file under the example-code directory for a PIN generator using apg-go.
23 lines
445 B
Go
23 lines
445 B
Go
// SPDX-FileCopyrightText: 2021-2024 Winni Neessen <wn@neessen.dev>
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/wneessen/apg-go"
|
|
)
|
|
|
|
func main() {
|
|
config := apg.NewConfig(apg.WithAlgorithm(apg.AlgoRandom),
|
|
apg.WithModeMask(apg.ModeNumeric),
|
|
apg.WithFixedLength(6))
|
|
generator := apg.New(config)
|
|
password, err := generator.Generate()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Println("Your PIN:", password)
|
|
}
|