Signer Object Members for SuiteScript in NetSuite
The Signer object in SuiteScript allows for string signing and signature management. This guide covers its methods and usage.
The Signer object is vital for secure communications in SuiteScript, allowing developers to sign strings securely. This feature supports server scripts and is particularly useful in situations requiring digital signatures.
What is the Signer Object?
The Signer object encapsulates a created signature for plain strings and is returned by the certificate.createSigner(options) method. It is a key component of the N/crypto/certificate module.
Signer Object Members
The Signer object includes two main methods that are used for signing operations:
| Member Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
Signer.sign(options) | void | Server scripts | Signs the string and returns the generated signature. |
Signer.update(options) | void | Server scripts | Updates the input string that is to be signed, allowing encoded strings. |
Using the Signer Object
Here's how you can utilize the Signer object in your SuiteScript:
1// Example usage of the Signer object2var mySigner = certificate.createSigner({3 certId: 'custcertificate1',4 algorithm: certificate.HashAlg.SHA5125});6 7mySigner.update("test"); // Update the string to be signed8var result = mySigner.sign({9 outputEncoding: encode.Encoding.BASE_64_URL_SAFE,10 useRawFormatForECDSA: true11});Method Details
- Signer.sign(options): This method is crucial for signing a string and can format the result in various ways, including Base64 encoding.
- Signer.update(options): Use this method to modify the input string that will be signed. This method supports plain and encoded strings.
Who This Affects
This article is beneficial for developers who work with:
- Server Scripts
- Security Implementations
- Digital Signature Management
Key Takeaways
- The Signer object is integral for string signing in SuiteScript.
- Two primary methods exist for signing and updating strings.
- It supports server scripts and various encoding options.
Frequently Asked Questions (4)
What modules do I need to include to use the Signer object in SuiteScript?
Can the Signer object be used in client-side scripts?
What encoding options are available when signing a string using the Signer object?
Is it possible to modify the input string after initially setting it in the Signer object?
Was this article helpful?
More in Platform
- Style Object Members for Workbook API in NetSuite
The Style object provides customizable properties for workbook formatting in NetSuite, enhancing report and visualization functionality.
- Asynchronous HTTP Requests with SuiteScript Promises
Use SuiteScript to send asynchronous HTTP requests with promises for efficient error handling and response processing.
- Setting Sublist Field Values in SuiteScript
Set values for sublist fields in SuiteScript using the setSublistValue method. Understand required parameters and error handling.
- In This Help Topic
Explore N/log module guidelines, log levels, and script execution logs for efficient logging in SuiteScript.
Advertising
Reach Platform Professionals
Put your product in front of NetSuite experts who work with Platform every day.
Sponsor This Category