Skip to content

08. sdjwt Instance & config

Lukas.J.Han edited this page Dec 15, 2023 · 1 revision

Create new Custom Instance

You can create a new instance of sdjwt with a custom config.

const sdjwtInstance: sdjwt.create({
  hasher: CustomHasher
});

Method of instance is same with default Instance.

Configurations

sdjwt.config({
  hasher: CustomHasher
});
  • The config type
type SDJWTConfig = {
  omitTyp?: boolean; // omit typ property in JWT header
  hasher?: Hasher; // custom hash function: (data: string) => Promise<string>;
  saltGenerator?: SaltGenerator; // custom salt generate function: (length: number) => string;
};
Clone this wiki locally