http_signature_helper 1.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 47

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.

1.0.1 (2018-08-14) #

  • Add defaults for headers

1.0.0 (2018-08-12) #

  • Initial version

example/http_signature_helper_example.dart

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
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  http_signature_helper: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:http_signature_helper/http_signature_helper.dart';
  
Version Uploaded Documentation Archive
1.0.1 Aug 14, 2018 Go to the documentation of http_signature_helper 1.0.1 Download http_signature_helper 1.0.1 archive
1.0.0+1 Aug 12, 2018 Go to the documentation of http_signature_helper 1.0.0+1 Download http_signature_helper 1.0.0+1 archive
1.0.0 Aug 12, 2018 Go to the documentation of http_signature_helper 1.0.0 Download http_signature_helper 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
87
Overall:
Weighted score of the above. [more]
47
Learn more about scoring.

We analyzed this package on Feb 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13+1

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:http_signature_helper/http_signature_helper.dart.

Health issues and suggestions

Document public APIs. (-1 points)

25 out of 25 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance suggestions

The package description is too short. (-13 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
auth_params ^1.0.0 1.0.0+1
collection ^1.14.0 1.14.11
Dev dependencies
test ^1.0.0