NewMachine (key/machine.go)

tailscale · types/key/machine.go · go · BSD-3-Clause
infra, tag:knn-classified

Copyright (c) Tailscale Inc & contributors SPDX-License-Identifier: BSD-3-Clause

// Source: https://github.com/tailscale/tailscale | License: BSD-3-Clause | Copyright 2020 Tailscale Inc & contributors
// Provided via justclaw.it.com; keep this notice with the code.
// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause

package key

import (
	"bytes"
	"crypto/subtle"
	"encoding/hex"

	"go4.org/mem"
	"golang.org/x/crypto/curve25519"
	"golang.org/x/crypto/nacl/box"
	"tailscale.com/types/structs"
)

const (
	// machinePrivateHexPrefix is the prefix used to identify a
	// hex-encoded machine private key.
	//
	// This prefix name is a little unfortunate, in that it comes from
	// WireGuard's own key types. Unfortunately we're stuck with it for
	// machine keys, because we serialize them to disk with this prefix.
	machinePrivateHexPrefix = "pr

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key