syntax = "proto3";

package com.wixpress.iptf.webhooks.api.v1;

import "google/api/annotations.proto";
import "wix/api/validations.proto";
import "google/protobuf/wrappers.proto";

service WebhooksSyncService {
    rpc signHash(SignHashRequest) returns (SignResponse) {
        option (wix.api.required) = "SignHashRequest.hashedPayload";
        option (wix.api.required) = "SignHashRequest.appdef_id";
        option (google.api.http) = {
            get: "v1/sign/hash"
        };
    }
}

message SignHashRequest {
    string hashedPayload = 1;
    HashFunction algorithm = 2;
    string appdef_id = 3 [(wix.api.format)=GUID]; // appdef id of the external app
    int64 expiration_in_millis = 4;
    google.protobuf.StringValue artifact_id = 5 [(wix.api.maxLength) = 200]; // caller
}

message SignResponse {
    string token = 1;
}

enum HashFunction {
    SHA256 = 0;
}