ocisign

package
v1.5.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ocisign signs HTTP requests for the OCI API with the draft-cavage "Signature" scheme, using only the standard library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Headers

func Headers(method string) []string

Headers returns the signed header list for a method. Body methods add the three body headers, in the order OCI documents.

func KeyID

func KeyID(tenancyOCID, userOCID, fingerprint string) string

KeyID builds the keyId field: tenancy/user/fingerprint.

func SessionKeyID

func SessionKeyID(token string) string

SessionKeyID builds the keyId for a session token login: ST$ plus the JWT. The request is then signed with the session private key, not an API key.

func SigningString

func SigningString(req *http.Request) string

SigningString builds the text the signature covers for req. The body headers must already be set on req for POST, PUT and PATCH.

Types

type Signer

type Signer struct {
	KeyID         string
	Key           *rsa.PrivateKey
	Now           func() time.Time
	AllowInsecure bool
}

Signer holds one API key. AllowInsecure exists so tests can use a plain httptest server.

func (Signer) Sign

func (s Signer) Sign(req *http.Request, body []byte) error

Sign sets Date and Authorization, and for POST, PUT and PATCH also the body headers. body must be the exact bytes to send: a stream would make the hash and length unknown. Call it again on every retry so the Date is fresh.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL