Skip to content

Instantly share code, notes, and snippets.

View lukehinds's full-sized avatar
🏃‍♂️
Either running or coding.

Luke Hinds lukehinds

🏃‍♂️
Either running or coding.
View GitHub Profile
{
"action": "published",
"registry_package": {
"id": 2693542,
"name": "cosign-keyless-action",
"namespace": "lukehinds",
"description": "",
"ecosystem": "CONTAINER",
"package_type": "CONTAINER",
"html_url": "https://github.com/lukehinds/packages/2693542",
{
"action": "published",
"package": {
"id": 2693542,
"name": "cosign-keyless-action",
"namespace": "lukehinds",
"description": "",
"ecosystem": "CONTAINER",
"package_type": "CONTAINER",
"html_url": "https://github.com/lukehinds/packages/2693542",
func (s *Server) CreateGroup(ctx context.Context, req *pb.CreateGroupRequest) (*pb.CreateGroupResponse, error) {
_, err := s.store.GetGroupByName(ctx, req.Name)
// check if group already exists
if err != nil && err != sql.ErrNoRows {
return nil, fmt.Errorf("failed to get group by name: %w", err)
} else if err == nil {
return nil, fmt.Errorf("group already exists")
}

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

package main
import (
"bytes"
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"crypto/x509"
"encoding/base64"
secureme
#!/bin/bash
# Check if the script is run with correct number of arguments
# example ./crates.sh rand 0.2.0
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <crate-name> <crate-version> [--cleanup]"
exit 1
fi
# Assign the arguments to variables for easier use
<!DOCTYPE html>
<html>
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
<style>
.google-img {
# Configuration for Alacritty, the GPU enhanced terminal emulator.
# ~/.config/alacritty/alacritty.yml
# Import additional configuration files
#
# Imports are loaded in order, skipping all missing files, with the importing
# file being loaded last. If a field is already present in a previous import, it
# will be replaced.
#
# All imports must either be absolute paths starting with `/`, or paths relative
{"payloadType":"application/vnd.in-toto+json","payload":"eyJfdHlwZSI6Imh0dHBzOi8vaW4tdG90by5pby9TdGF0ZW1lbnQvdjAuMSIsInByZWRpY2F0ZVR5cGUiOiJodHRwczovL3Nsc2EuZGV2L3Byb3ZlbmFuY2UvdjAuMiIsInN1YmplY3QiOlt7Im5hbWUiOiJzbHNhLXRlc3QtYXJtNjQtbGludXgiLCJkaWdlc3QiOnsic2hhMjU2IjoiM2Y1MjJhODA4MjM4MGZiOWVjMmY0YWZlZGYzMWMzOGU5MWE3ZTg4MDMxNjJhYTIzN2FkMWY4OTVkYTI4NzAxYSJ9fV0sInByZWRpY2F0ZSI6eyJidWlsZGVyIjp7ImlkIjoiaHR0cHM6Ly9naXRodWIuY29tL3Nsc2EtZnJhbWV3b3JrL3Nsc2EtZ2l0aHViLWdlbmVyYXRvci8uZ2l0aHViL3dvcmtmbG93cy9idWlsZGVyX2dvX3Nsc2EzLnltbEByZWZzL3RhZ3MvdjEuNC4wIn0sImJ1aWxkVHlwZSI6Imh0dHBzOi8vZ2l0aHViLmNvbS9zbHNhLWZyYW1ld29yay9zbHNhLWdpdGh1Yi1nZW5lcmF0b3IvZ29AdjEiLCJpbnZvY2F0aW9uIjp7ImNvbmZpZ1NvdXJjZSI6eyJ1cmkiOiJnaXQraHR0cHM6Ly9naXRodWIuY29tL2x1a2VoaW5kcy9zbHNhLXRlc3RAcmVmcy9oZWFkcy9tYWluIiwiZGlnZXN0Ijp7InNoYTEiOiJhNWJmYjE3NGQ0MTVhOWQzMjMzYjUwNmZkY2VjODkwMWE1ZjkwYTFlIn0sImVudHJ5UG9pbnQiOiIuZ2l0aHViL3dvcmtmbG93cy9nby1vc3NmLXNsc2EzLXB1Ymxpc2gueW1sIn0sInBhcmFtZXRlcnMiOnt9LCJlbnZpcm9ubWVudCI6eyJhcmNoIjoiWDY0IiwiZ2l0aHViX2FjdG9yIjo