http_signature_helper 1.0.1 copy "http_signature_helper: ^1.0.1" to clipboard
http_signature_helper: ^1.0.1 copied to clipboard

Signature helpers from the HTTP Signature spec.

http_signature_helper pub package #

Signature helpers from the HTTP Signature spec.

Usage #

import 'package:http_signature_helper/http_signature_helper.dart';

main() {
  final signatureString = SignatureString(
    body: "body",
    headers: {
      "Host": "example.org",
      "Date": "Tue, 07 Jun 2014 20:51:35 GMT",
      "X-Example": """Example header
    with some whitespace.""",
      "Cache-Control": "max-age=60, must-revalidate"
    },
    signatureHeaders: [
      "(request-target)",
      "host",
      "date",
      "cache-control",
      "x-example"
    ],
    target: SignatureTarget("GET", "/foo"),
  );

  print(signatureString);
  // (request-target): get /foo\nhost: example.org\ndate: Tue, 07 Jun 2014 20:51:35 GMT\ncache-control: max-age=60, must-revalidate\nx-example: Example header with some whitespace.\nbody

  final signatureHeader = SignatureHeader(
    keyId: "rsa-key-1",
    algorithm: "rsa-sha256",
    signatureHeaders: [
      "(request-target)",
      "host",
      "date",
      "digest",
      "content-length"
    ],
    signature: "rsa-signature-1",
  );

  print(signatureHeader);
  // Signature keyId="rsa-key-1",algorithm="rsa-sha256",headers="(request-target) host date digest content-length",signature="rsa-signature-1"

  final signatureHeader2 = SignatureHeader.parse(signatureHeader.toString());

  print(signatureHeader == signatureHeader2);
  // true
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Signature helpers from the HTTP Signature spec.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

auth_params, collection

More

Packages that depend on http_signature_helper