@uveysservetoglu/kobil-sign
v1.0.0
Published
KOBIL digital signature client for Node.js: initiate PDF signatures with automatic OAuth token management.
Maintainers
Readme
@uveysservetoglu/kobil-sign
KOBIL digital signature client for Node.js / TypeScript, with automatic OAuth token management.
npm install @uveysservetoglu/kobil-signimport { SignClient } from "@uveysservetoglu/kobil-sign";
const sign = new SignClient({
// credentials (or KOBIL_* env vars):
tokenEndpoint: process.env.KOBIL_TOKEN_ENDPOINT!,
clientId: process.env.KOBIL_CLIENT_ID!,
clientSecret: process.env.KOBIL_CLIENT_SECRET!,
// sign-specific:
signBaseUrl: "https://idp.cloud.kobil.com/auth/realms/{TENANT}/mpower/v1/users/{USER_ID}",
tenantName: "acme",
defaultCallbackUrl: "https://yourapi.com/signature-callback",
});
const res = await sign.initiatePdfSignature({
userId,
file: pdfBytes,
fileName: "Agreement.pdf",
messageText: "Please sign here",
position: { pageNumber: 1, bottomLeftX: 59, bottomLeftY: 89, topRightX: 85, topRightY: 96 },
});
// res.messageId, res.instanceId{TENANT} is filled from tenantName, {USER_ID} from the call; /signature is appended.
How it maps to the API
POST {signBaseUrl}/signature as multipart/form-data:
signatureFile— the PDF bytes (application/pdf)signatureData— JSON:version,pageNumber,bottomLeft*/topRight*Coordinate,serviceUuid,messageText,callbackUrl
The signed PDF is delivered to your callback as a signatureResponse; download it by its
mediaId using @uveysservetoglu/kobil-chat's getAttachmentFile.
JavaScript usage is identical (const { SignClient } = require("@uveysservetoglu/kobil-sign")).
Failures throw KobilSignError (extends KobilError).
License
MIT
