generated from nventive/Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adding missing documentation and example to increase score on …
…pub.dev
- Loading branch information
Kevin Takla
committed
Apr 25, 2024
1 parent
3cea562
commit 73ba2e0
Showing
4 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import 'package:requests_signature_dart/requests_signature_dart.dart'; | ||
import 'package:requests_signature_dart/src/client/requests_signature_options.dart'; | ||
import 'package:dio/dio.dart'; | ||
|
||
void main() { | ||
// Instantiate Dio client. | ||
final dio = Dio(); | ||
|
||
// Define signature options. | ||
final signatureOptions = RequestsSignatureOptions( | ||
clientId: 'your_client_id', // Your unique client ID | ||
clientSecret: 'your_client_secret', // Your client secret key | ||
headerName: | ||
'X-Request-Signature', // Name of the custom header for the signature | ||
signaturePattern: | ||
'{ClientId}:{Nonce}:{Timestamp}:{SignatureBody}', // Pattern for the signature header value | ||
clockSkew: Duration( | ||
seconds: 30), // Clock skew duration (30 seconds in this example) | ||
disableAutoRetryOnClockSkew: | ||
false, // Disable auto retry on clock skew if set to true | ||
); | ||
|
||
// Instantiate interceptor. | ||
final interceptor = RequestsSignatureInterceptor( | ||
signatureOptions, | ||
dio, | ||
); | ||
|
||
// Add interceptor to Dio client. | ||
dio.interceptors.add(interceptor); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters