MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / sign

Method sign

internal/httpapi/attachments.go:67–73  ·  view source on GitHub ↗
(messageID string, index int, expUnix int64)

Source from the content-addressed store, hash-verified

65}
66
67func (n *nativeAttachmentStore) sign(messageID string, index int, expUnix int64) string {
68 payload := attachmentTokenPayload(messageID, index, expUnix)
69 mac := hmac.New(sha256.New, n.secret)
70 mac.Write([]byte(payload))
71 return base64.RawURLEncoding.EncodeToString([]byte(payload)) + "." +
72 base64.RawURLEncoding.EncodeToString(mac.Sum(nil))
73}
74
75func (n *nativeAttachmentStore) DownloadURL(agentEmail, messageID string, index int, ttl time.Duration) (string, time.Time, error) {
76 // Fail closed if wired with no secret — an empty HMAC key makes every token

Callers 2

DownloadURLMethod · 0.95

Calls 2

attachmentTokenPayloadFunction · 0.85
WriteMethod · 0.45

Tested by 1