| 1 | // Copyright The Notary Project Authors. |
| 2 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | // you may not use this file except in compliance with the License. |
| 4 | // You may obtain a copy of the License at |
| 5 | // |
| 6 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | // |
| 8 | // Unless required by applicable law or agreed to in writing, software |
| 9 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | // See the License for the specific language governing permissions and |
| 12 | // limitations under the License. |
| 13 | |
| 14 | // Package plugin provides the tooling to use the notation plugin. |
| 15 | // |
| 16 | // includes a CLIManager and a CLIPlugin implementation. |
| 17 | package plugin |
| 18 | |
| 19 | import ( |
| 20 | "context" |
| 21 | ) |
| 22 | |
| 23 | // GenericPlugin is the base requirement to be a plugin. |
| 24 | type GenericPlugin interface { |
| 25 | // GetMetadata returns the metadata information of the plugin. |
| 26 | GetMetadata(ctx context.Context, req *GetMetadataRequest) (*GetMetadataResponse, error) |
| 27 | } |
| 28 | |
| 29 | // SignPlugin defines the required methods to be a SignPlugin. |
| 30 | type SignPlugin interface { |
| 31 | GenericPlugin |
| 32 | |
| 33 | // DescribeKey returns the KeySpec of a key. |
| 34 | DescribeKey(ctx context.Context, req *DescribeKeyRequest) (*DescribeKeyResponse, error) |
| 35 | |
| 36 | // GenerateSignature generates the raw signature based on the request. |
| 37 | GenerateSignature(ctx context.Context, req *GenerateSignatureRequest) (*GenerateSignatureResponse, error) |
| 38 | |
| 39 | // GenerateEnvelope generates the Envelope with signature based on the |
| 40 | // request. |
| 41 | GenerateEnvelope(ctx context.Context, req *GenerateEnvelopeRequest) (*GenerateEnvelopeResponse, error) |
| 42 | } |
| 43 | |
| 44 | // VerifyPlugin defines the required method to be a VerifyPlugin. |
| 45 | type VerifyPlugin interface { |
| 46 | GenericPlugin |
| 47 | |
| 48 | // VerifySignature validates the signature based on the request. |
| 49 | VerifySignature(ctx context.Context, req *VerifySignatureRequest) (*VerifySignatureResponse, error) |
| 50 | } |
| 51 | |
| 52 | // Plugin defines required methods to be a Plugin. |
| 53 | type Plugin interface { |
| 54 | SignPlugin |
| 55 | VerifyPlugin |
| 56 | } |