Wechaty Token Based Authentication Manager
npm install -g wechaty-token$ 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 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": "1.2.3.4",
  "port": 5678
}
$ echo $?
0
# Discover a unvalid token (out-of-service)
$ wechaty-token discover puppet_OUT-OF-SERVICE-TOKEN
NotFound
$ echo $?
1$ 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 (`uuid` will be the default type)
$ wechaty-token generate
uuid_1fab726b-e3d3-40ce-8b7b-d3bd8c9fd280
# Generate token with type `foo`
$ wechaty-token generate --type foo
foo_1fab726b-e3d3-40ce-8b7b-d3bd8c9fd280We 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:
- ES Module support
- TypeScript 4.5
- Wechaty Token Discovery output JSON.stringifyformat
- Wechaty Token format standard released: SNI_UUID- SNIwill be used as Server Indicator Name (SNI) when we are using TLS
- UUIDis a standard UUID format (v4)
 
- add wechatyToken.snisupport.
- Use cockatielto implementRetryPolicy
- Use nockto implement HTTP unit testing
- Implemented #1
- wechaty-tokenCLI released
- gRPC Resolver for Wechaty: Enabled xdslike schemawechaty:///uuid_TOKENfor gRPC client
Inited
Huan LI (李卓桓), Google Developer Expert (Machine Learning), zixia@zixia.net
- Code & Docs © 2018-now Huan LI <zixia@zixia.net>
- Code released under the Apache-2.0 License
- Docs released under Creative Commons

