Skip to content

Commit 6bfc1d5

Browse files
committed
Fixes #15 :: Fixes #14 :: Add the json export documentation.
1 parent 21615aa commit 6bfc1d5

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Implements [RFC 4226][rfc4226] and [RFC 6238][rfc6238].
1111

1212
# Contents
1313
- [Supported Operations](#supported-operations)
14-
- [Planned Functionality](#planned-functionality)
1514
- [Reading Material](#reading-material)
1615
- [Usage](#usage)
1716
- [Generating Codes](#generating-codes)
@@ -28,8 +27,6 @@ Implements [RFC 4226][rfc4226] and [RFC 6238][rfc6238].
2827
- Verify HOTP an TOTP codes.
2928
- Export OTP config as a [Google Authenticator URI][googleURI].
3029
- Export OTP config as a QR code image (used to register secrets in authenticator apps).
31-
32-
## Planned Functionality
3330
- Export OTP config as a JSON.
3431

3532
## Reading Material
@@ -130,7 +127,23 @@ base64EncodedQRImage, _ := otp.
130127
```
131128

132129
#### Manual registration
133-
TODO
130+
Manual registration usually requires the user to type in the OTP config
131+
parameters by hand. The KeyUri type can be easily JSON encoded to then send the
132+
params to an external caller or any other place.
133+
```go
134+
otp := otpgo.TOTP{
135+
Key: "YOUR_KEY",
136+
Period: 30,
137+
Delay: 1,
138+
Algorithm: config.HmacSHA1,
139+
Length: 6
140+
}
141+
ku := otp.KeyUri("[email protected]", "A Company")
142+
jsonKeyUri, _ := json.Marshal(ku)
143+
144+
// Then use jsonKeyUri however you like
145+
// e.g.: send it to the client for further processing
146+
```
134147

135148
## Defaults
136149
If caller doesn't provide a custom configuration when generating OTPs. The

0 commit comments

Comments
 (0)