Unique cryptographic avatars for go and friends!
For simplicity this repository ships with a simple server application which exposes various endpoints for generating identicons without requiring you to embed the go library into your application! Simply download a suitable executable from the releases section or use one of the docker images:
# Native Installation
$ identicons serve -bind=127.0.0.1:8080
# Docker Installation
$ docker run -p 8080:8080 dotstart/identicons:0.1.0
The following endpoints are made available by the command:
- /random - Displays a random image for each request
- /ip - Displays an image for the client ip address
- /{input} - Displays an image for an arbitrary input value
All endpoints are also made available for each of the supported generators. For instance, you may
retrieve a random image generated by the block
generator via /block/random
.
The following generator identifiers are currently allocated:
block
circle
circle-matrix
classic
modern
The following tags are currently maintained in addition to the respective version number tags:
- latest - Always points to the latest release (mirrors
master
) - dev - Bleeding edge release (mirrors
develop
)
A mirror of the Docker image is available via the GitHub package registry under the tag name
ghcr.io/dotstart/identicons
.
If you are developing a go application, you may alternatively embed the library and directly invoke it where necessary. We currently provide two modes of operation:
import (
"github.com/dotstart/identicons/library/identicons/icon/block"
)
// choose a generator and customize its options
gen := block.New()
// Option #1 - Write directly to a file or stream
gen.Write([]byte("some awesome input value"), writer)
// Option #2 - Write to another SVG
gen.Write([]byte("some awesome input value"), canvas)
import (
identicons "github.com/dotstart/identicons/library/identicons/http"
"github.com/dotstart/identicons/library/identicons/icon/modern"
)
gen := modern.New()
http.HandleFunc("/avatars", identicons.NewInputHandlerFunc(gen))
http.ListenAndServe(":8080", nil)
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.