Skip to content

gobengo/authorization-signature

Repository files navigation

authorization-signature

Create HTTP Authorization header values for HTTP Message Signatures.

Usage

byexample

These snippets should pass byexample

byexample -l javascript README.md

> const { Ed25519Signer } = await import("@did.coop/did-key-ed25519")
> const { createRequestWithHttpSignature } = await import("authorization-signature");
> const signer = await Ed25519Signer.generate()
> const url = new URL('http://example.com')
> const request = await createRequestWithHttpSignature( // byexample: +timeout=100
.   url,
.   {
.      includeHeaders: [
.        '(key-id)',
.        '(request-target)',
.        'host',
.      ],
.      signer,
.    }
.  )
> request.headers.get('authorization')?.startsWith('Signature ')
true

About

JavaScript library for HTTP Message Signatures <https://www.rfc-editor.org/rfc/rfc9421.html>

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published