@criipto/signatures 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Criipto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # criipto-signatures-nodejs
2
+
3
+ A Node.js SDK for Criipto Signatures
4
+
5
+ [Examples](https://docs.criipto.com/signatures/graphql/examples/)
6
+
7
+ ## Getting started
8
+
9
+ ### Requirements
10
+
11
+ This library supports Node 16 and later.
12
+
13
+ ### Installation
14
+
15
+ The SDK is available on [NPM](https://npmjs.com/package/@criipto/signaturess):
16
+
17
+ ```
18
+ npm install --save @criipto/signatures
19
+ yarn add @criipto/signatures
20
+ ```
21
+
22
+ ### Configure the SDK
23
+
24
+ ```javascript
25
+ import CriiptoSignatures from '@criipto/signatures';
26
+ const client = new CriiptoSignatures("{YOUR_CRIIPTO_CLIENT_ID}", "{YOUR_CRIIPTO_CLIENT_SECRET}");
27
+ ```
28
+
29
+ ## Basic example
30
+
31
+ ```javascript
32
+ import CriiptoSignatures from '@criipto/signatures';
33
+ const client = new CriiptoSignatures("{YOUR_CRIIPTO_CLIENT_ID}", "{YOUR_CRIIPTO_CLIENT_SECRET}");
34
+
35
+ // Create signature order
36
+ const signatureOrder = await client.createSignatureOrder({
37
+ title: "Node.js sample",
38
+ documents: [
39
+ {
40
+ pdf: {
41
+ title: "Node.js Sample",
42
+ blob: pdf.toString('base64'),
43
+ storageMode: 'Temporary'
44
+ }
45
+ }
46
+ ]
47
+ });
48
+
49
+ // Add signatory to signature order
50
+ const signatory = await client.addSignatory(signatureOrder.id);
51
+ console.log(signatory.href);
52
+
53
+ const closed = await client.closeSignatureOrder(signatureOrder.id);
54
+ ```
package/codegen.ts ADDED
@@ -0,0 +1,29 @@
1
+ import type { CodegenConfig } from '@graphql-codegen/cli';
2
+
3
+ const config: CodegenConfig = {
4
+ schema: 'https://signatures-api.criipto.com/v1/graphql',
5
+ generates: {
6
+ 'src/graphql-sdk.ts': {
7
+ documents: './src/*.graphql',
8
+ plugins: [
9
+ 'typescript',
10
+ 'typescript-operations',
11
+ 'typescript-graphql-request'
12
+ ],
13
+ config: {
14
+ strictScalars: true,
15
+ namingConvention: {
16
+ enumValues: 'keep'
17
+ },
18
+ enumsAsTypes: true,
19
+ scalars: {
20
+ Blob: 'string',
21
+ Date: 'string',
22
+ DateTime: 'string',
23
+ URI: 'string'
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }
29
+ export default config;