2026-04-06 15:48:37 +05:30
|
|
|
// Copyright IBM Corp. 2020, 2026
|
2022-05-18 20:20:45 -07:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-02-02 17:15:17 -08:00
|
|
|
|
2022-05-18 20:20:45 -07:00
|
|
|
package static
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
2026-10-12 10:33:41 -07:00
|
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/globals"
|
|
|
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/credential"
|
|
|
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/db"
|
|
|
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/errors"
|
|
|
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/types/resource"
|
2022-05-18 20:20:45 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func init() {
|
2023-11-15 19:55:46 -05:00
|
|
|
globals.RegisterPrefixToResourceInfo(globals.StaticCredentialStorePrefix, resource.CredentialStore, credential.Domain, Subtype)
|
|
|
|
|
globals.RegisterPrefixToResourceInfo(globals.StaticCredentialStorePreviousPrefix, resource.CredentialStore, credential.Domain, Subtype)
|
2022-05-18 20:20:45 -07:00
|
|
|
}
|
|
|
|
|
|
2023-11-02 16:03:47 -04:00
|
|
|
// PublicId prefixes for the resources in the static package.
|
|
|
|
|
const (
|
2023-11-15 19:55:46 -05:00
|
|
|
Subtype = globals.Subtype("static")
|
2023-11-02 16:03:47 -04:00
|
|
|
)
|
|
|
|
|
|
2022-05-18 20:20:45 -07:00
|
|
|
func newCredentialStoreId(ctx context.Context) (string, error) {
|
2023-06-06 17:09:08 -04:00
|
|
|
id, err := db.NewPublicId(ctx, globals.StaticCredentialStorePrefix)
|
2022-05-18 20:20:45 -07:00
|
|
|
if err != nil {
|
|
|
|
|
return "", errors.Wrap(ctx, err, "static.newCredentialStoreId")
|
|
|
|
|
}
|
|
|
|
|
return id, nil
|
|
|
|
|
}
|