http_signature_helper 1.0.1

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

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]
44
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

We analyzed this package on Oct 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: Flutter, web, other

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

Health suggestions

Fix lib/http_signature_helper.dart. (-1 points)

Analysis of lib/http_signature_helper.dart reported 2 hints:

line 20 col 17: Always override hashCode if overriding ==.

line 141 col 17: Always override hashCode if overriding ==.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

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