Skip to content

Instantly share code, notes, and snippets.

@vikramacharya
Created September 10, 2022 15:34
Show Gist options
  • Save vikramacharya/7be253eac3b4b8a0730978213394137d to your computer and use it in GitHub Desktop.
Save vikramacharya/7be253eac3b4b8a0730978213394137d to your computer and use it in GitHub Desktop.
export const createAuthorizationHeader = async (message: any) => {
const { signing_string, expires, created } = await createSigningString(JSON.stringify(message));
const signature = await signMessage(signing_string, process.env.sign_private_key || "");
const subscriber_id = config.bap_id;
const header = `Signature keyId="${subscriber_id}|${config.unique_key_id}|ed25519",algorithm="ed25519",created="${created}",expires="${expires}",headers="(created) (expires) digest",signature="${signature}"`
return header;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment