Package Exports
- wechaty-token
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wechaty-token) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
wechaty-token

Wechaty Token Based Authentication Manager
Install
npm install -g wechaty-tokenCLI Usage
$ wechaty-token --help
wechaty-token <subcommand>
> Wechaty utility for discovering and generating tokens
where <subcommand> can be one of:
- generate - Generate a new Wechaty Token
- discover - Wechaty TOKEN Service Discovery
For more help, try running `wechaty-token <subcommand> --help`Wechaty Token Discovery
$ wechaty-token discover --help
wechaty-token discover
> Wechaty TOKEN Service Discovery
ARGUMENTS:
<str> - Wechaty Puppet Service TOKEN
FLAGS:
--help, -h - show helpExample:
# Discover a valid token (in-service)
$ wechaty-token discover puppet_IN_SERVICE_TOKEN
{ host: '8.7.5.2', port: 58871 }
$ echo $?
0
# Discover a unvalid token (out-of-service)
$ wechaty-token discover puppet_OUT_OF_SERVICE_TOKEN
NotFound
$ echo $?
1Generate Wechaty Token
$ wechaty-token generate --help
wechaty-token generate
> Generate a new Wechaty Token
OPTIONS:
--type, -t <str> - The type of the Wechaty Puppet Service [optional]
FLAGS:
--help, -h - show helpExample:
# Generate a UUID token
$ wechaty-token generate
1fab726b-e3d3-40ce-8b7b-d3bd8c9fd280
# Generate token with type `foo`
$ wechaty-token generate --type foo
puppet_foo_1fab726b-e3d3-40ce-8b7b-d3bd8c9fd280gRPC Resolver Usage
We now can use wechaty:///__token__ as gRPC address for Wechaty Service Token Discovery.
The WechatyResolver is for resolve the above address and help gRPC to connect to the right host and port.
import { WechatyResolver } from 'wechaty-token'
WechatyResolver.setup()
// That's it! You can use `wechaty:///__token__` as gRPC address now!
// const routeguide = grpc.loadPackageDefinition(packageDefinition).routeguide;
// client = new routeguide.RouteGuide('wechaty:///__token__',
// grpc.credentials.createInsecure());
// See: https://grpc.io/docs/languages/node/basics/See:
History
master v0.4
- Use
cockatielto implementRetryPolicy - Use
nockto implement HTTP unit testing - Implemented #1
v0.2 master (Aug 2, 2021)
wechaty-tokenCLI released- gRPC Resolver for Wechaty: Enabled
xdslike schemawechaty:///puppet_TOKENfor gRPC client
v0.0.1 (Aug 1, 2021)
Inited
Author
Huan LI (李卓桓), Google Developer Expert (Machine Learning), zixia@zixia.net
Copyright & License
- Code & Docs © 2018-now Huan LI <zixia@zixia.net>
- Code released under the Apache-2.0 License
- Docs released under Creative Commons
