Struct: v4.StreamSigner

import "../ibm-cos-sdk-go/aws/signer/v4"

Overview

StreamSigner implements signing of event stream encoded payloads

Implemented Interfaces

s3crypto.Cipher, s3manager.ReadSeekerWriteTo, s3manager.WriterReadFrom

Constructor Functions collapse

Method Summary collapse

Function Details

func NewStreamSigner(region, service string, seedSignature []byte, credentials *credentials.Credentials) *StreamSigner

NewStreamSigner creates a SigV4 signer used to sign Event Stream encoded messages



25
26
27
28
29
30
31
32
// File 'aws/signer/v4/stream.go', line 25

func NewStreamSigner(region, service string, seedSignature []byte, credentials *credentials.Credentials) *StreamSigner { return &StreamSigner{ region: region, service: service, credentials: credentials, prevSig: seedSignature, } }

Method Details

func (s *StreamSigner) GetSignature(headers, payload []byte, date time.Time) ([]byte, error)

GetSignature takes an event stream encoded headers and payload and returns a signature



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// File 'aws/signer/v4/stream.go', line 35

func (s *StreamSigner) GetSignature(headers, payload []byte, date time.Time) ([]byte, error) { credValue, err := s.credentials.Get() if err != nil { return nil, err } sigKey := deriveSigningKey(s.region, s.service, credValue.SecretAccessKey, date) keyPath := buildSigningScope(s.region, s.service, date) stringToSign := buildEventStreamStringToSign(headers, payload, s.prevSig, keyPath, date) signature := hmacSHA256(sigKey, []byte(stringToSign)) s.prevSig = signature return signature, nil }