createSdJwtCredential
function is an asynchronous method that generates a Signed Selective Disclosure JSON Web Token (SD-JWT) credential.
privateKey
(string): is an RSA PEM key in String format, or a secp256k1 key in hex string.issuer
(string): is a URL that contains the Issuer’s Public key for verifying the VC’s signature (e.g., https://static.terminal3.io/jwks.json
), or the Issuer’s DID (e.g., did:key:<issuer_public_key>
).claims
(object): is an object that contains any information related to the user (e.g., { first_name: "Joey" }
).vct
(string): is the Verifiable Credential Type, and it should be a single name (e.g., KycCredential
).disclosureFrame
(string[], optional): is used to specify which claim attributes the Issuers want to disclose. The list of attributes must be from claims. (e.g., ["first_name"]
).signAlg
(SdJwtSignerAlgorithm, optional): specify the algorithm for signing the VC, the current supported algorithms are RSA
or ES256K
.hashAlg
(SdJwtHashAlgorithm, optional): specify the algorithm for hashing Disclosures, the current supported algorithm is sha-256
.hasher
(Function, optional): to customize the hashing function, the default is using SHA-256
.saltGenerator
(Function, optional): to customize the salt generator function, default is using randomBytes(length = 16).toString(‘hex’) from the crypto
package.Promise<string>
: A promise that resolves to an string representing the signed credential. This string contains JWT tokens as follows: