MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / GenerateKey

Function GenerateKey

model/api_key.go:23–29  ·  view source on GitHub ↗

GenerateKey creates a new secure API key

()

Source from the content-addressed store, hash-verified

21
22// GenerateKey creates a new secure API key
23func GenerateKey() (string, error) {
24 b := make([]byte, 32)
25 if _, err := rand.Read(b); err != nil {
26 return "", err
27 }
28 return base64.URLEncoding.EncodeToString(b), nil
29}
30
31// NewAPIKey creates a new API key instance
32func NewAPIKey(name, ownerID string, scopes []string, expiresAt time.Time) (*APIKey, error) {

Callers 2

NewAPIKeyFunction · 0.85
TestGenerateKeyFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestGenerateKeyFunction · 0.68