Package qrcode implements a QR Code encoder. A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded. A QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: qrcode.{Low, Medium, High, Highest}. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger. Three functions cover most use cases: - Create a PNG image: - Create a PNG image and write to a file: - Create a PNG image with custom colors and write to file: All examples use the qrcode.Medium error Recovery Level and create a fixed 256x256px size QR Code. The last function creates a white on black instead of black on white QR Code. To generate a variable sized image instead, specify a negative size (in place of the 256 above), such as -4 or -5. Larger negative numbers create larger images: A size of -5 sets each module (QR Code "pixel") to be 5px wide/high. - Create a PNG image (variable size, with minimum white padding) and write to a file: The maximum capacity of a QR Code varies according to the content encoded and the error recovery level. The maximum capacity is 2,953 bytes, 4,296 alphanumeric characters, 7,089 numeric digits, or a combination of these. This package implements a subset of QR Code 2005, as defined in ISO/IEC 18004:2006.
Package otp implements both HOTP and TOTP based one time passcodes in a Google Authenticator compatible manner. When adding a TOTP for a user, you must store the "secret" value persistently. It is recommended to store the secret in an encrypted field in your datastore. Due to how TOTP works, it is not possible to store a hash for the secret value like you would a password. To enroll a user, you must first generate an OTP for them. Google Authenticator supports using a QR code as an enrollment method: Validating a TOTP passcode is very easy, just prompt the user for a passcode and retrieve the associated user's previously stored secret.
The package twofactor implements the RFC 6238 TOTP: Time-Based One-Time Password Algorithm The library provides a simple and secure way to generate and verify the OTP tokens and provides the possibility to display QR codes out of the box The library supports HMAC-SHA1, HMAC-SHA256, HMAC-SHA512
Package hotp implements the RFC 4226 OATH-HOTP algorithm; these passwords derived from the HMAC-SHA1 of an internal counter. They are presented as (typically) 6 or 8-digit numeric passphrases. The package provides facilities for interacting with YubiKeys programmed in OATH-HOTP mode, as well as with the Google Authenticator application. The package also provides QR-code generation for new OTPs.
Package qrcode implements a QR Code encoder. A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded. A QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: qrcode.{Low, Medium, High, Highest}. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger. Three functions cover most use cases: - Create a PNG image: - Create a PNG image and write to a file: - Create a PNG image with custom colors and write to file: All examples use the qrcode.Medium error Recovery Level and create a fixed 256x256px size QR Code. The last function creates a white on black instead of black on white QR Code. To generate a variable sized image instead, specify a negative size (in place of the 256 above), such as -4 or -5. Larger negative numbers create larger images: A size of -5 sets each module (QR Code "pixel") to be 5px wide/high. - Create a PNG image (variable size, with minimum white padding) and write to a file: The maximum capacity of a QR Code varies according to the content encoded and the error recovery level. The maximum capacity is 2,953 bytes, 4,296 alphanumeric characters, 7,089 numeric digits, or a combination of these. This package implements a subset of QR Code 2005, as defined in ISO/IEC 18004:2006.
Package qrcode implements a QR Code encoder. A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded. A QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: qrcode.{Low, Medium, High, Highest}. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger. Three functions cover most use cases: - Create a PNG image: - Create a PNG image and write to a file: - Create a PNG image with custom colors and write to file: All examples use the qrcode.Medium error Recovery Level and create a fixed 256x256px size QR Code. The last function creates a white on black instead of black on white QR Code. To generate a variable sized image instead, specify a negative size (in place of the 256 above), such as -4 or -5. Larger negative numbers create larger images: A size of -5 sets each module (QR Code "pixel") to be 5px wide/high. - Create a PNG image (variable size, with minimum white padding) and write to a file: The maximum capacity of a QR Code varies according to the content encoded and the error recovery level. The maximum capacity is 2,953 bytes, 4,296 alphanumeric characters, 7,089 numeric digits, or a combination of these. This package implements a subset of QR Code 2005, as defined in ISO/IEC 18004:2006.
Package for creating QR codes for payments. Short Payment Descriptor format and EPC QR Code (SEPA) format is supported. - Generating QR code image for Short Payment Descriptor format - Generating QR code image for EPC QR Code QR code image encoding uses https://github.com/skip2/go-qrcode - Getting QR code content for Short Payment Descriptor format
Package otp implements both HOTP and TOTP based one time passcodes in a Google Authenticator compatible manner. When adding a TOTP for a user, you must store the "secret" value persistently. It is recommended to store the secret in an encrypted field in your datastore. Due to how TOTP works, it is not possible to store a hash for the secret value like you would a password. To enroll a user, you must first generate an OTP for them. Google Authenticator supports using a QR code as an enrollment method: Validating a TOTP passcode is very easy, just prompt the user for a passcode and retrieve the associated user's previously stored secret.
Package twofa provides a middleware for implementing two-factor authentication (2FA) in a Fiber application. It supports time-based one-time password (TOTP) authentication using the HMAC-based One-Time Password (HOTP) algorithm. To use this middleware in a Fiber project, Go must be installed and set up. 1. Install the package using Go modules: 2. Import the package in the Fiber application: To use the 2FA middleware in a Fiber application, create a new instance of the middleware with the desired configuration and register it with the application. Note: This 2FA middleware requires c.Locals to be set before using it. Use the fiber.Ctx.Locals middleware to set c.Locals. In the example above, the fiber.Locals middleware is used to set c.Locals with the "email" key and the corresponding value. This value can be accessed in the 2FA middleware using the ContextKey specified in the configuration. The 2FA middleware is then created with a configuration that specifies the issuer name, context key, and storage provider. The 2FA middleware accepts a twofa.Config struct for configuration. The available options are: The 2FA middleware requires a storage provider to store the 2FA information for each user. The storage provider should implement the fiber.Storage interface. You can use any storage provider that implements the fiber.Storage interface, such as: The 2FA information is stored in the storage using the ContextKey as the unique identifier. The ContextKey is bound to the raw value (2FA information) in the storage. The 2FA middleware provides a route for generating QR codes that can be scanned by authenticator apps to set up 2FA for a user. By default, the QR code generation route is accessible at "/2fa/register?account=<account_name>". You can customize the path template by modifying the PathTemplate field in the twofa.QRCodeConfig struct. The QR code image can be customized by providing a custom image in the Image field of the twofa.QRCodeConfig struct. If a custom image is provided, it will be used as the background image for the QR code. The content of the QR code can be customized by modifying the Content field in the twofa.QRCodeConfig struct. The default content format is "otpauth://totp/%s:%s?secret=%s&issuer=%s". The 2FA middleware allows generating custom QR code images for use with custom mobile apps or physical devices. This feature provides flexibility in integrating 2FA with custom cryptography and scanning mechanisms. To generate a custom QR code image, provide a custom image in the Image field of the twofa.QRCodeConfig struct. The custom image should be of type image.Image. When a custom image is provided, the middleware will generate a QR code and overlay it on top of the custom image. The resulting QR code image can be scanned by a custom mobile app or physical device that supports QR code scanning. By using a custom QR code image, it's possible to incorporate custom branding, design, or additional information into the QR code. This allows creating a seamless and integrated 2FA experience for users. Additionally, custom cryptography techniques can be leveraged to secure the QR code data. Instead of using the default TOTP algorithm, custom encryption and decryption mechanisms can be implemented to protect the shared secret and other sensitive information embedded in the QR code. Furthermore, the custom QR code image generation feature enables extending 2FA beyond mobile apps. The QR code can be bound to physical devices or objects that have scanning capabilities, such as smart cards, badges, or dedicated hardware tokens. This provides an additional layer of security and convenience for users who prefer physical authentication methods. To implement custom QR code image generation, follow these steps: By leveraging custom QR code image generation, it's possible to create a unique and secure 2FA experience tailored to specific requirements and user preferences. The 2FA middleware handles errors internally and returns appropriate HTTP status codes and error messages. If an error occurs during the 2FA process, the middleware will return a response with a status code of 401 (Unauthorized) or 500 (Internal Server Error), depending on the nature of the error. The error messages are sent in the specified response format (MIME type) configured in the ResponseMIME field of the twofa.Config struct. The default response format is plain text (fiber.MIMETextPlainCharsetUTF8). You can customize the error handling by providing custom handlers for unauthorized and internal server errors using the UnauthorizedHandler and InternalErrorHandler fields in the twofa.Config struct. The 2FA middleware defines several error variables that represent different types of errors that can occur during the 2FA process. These error variables are: These error variables are used by the middleware to provide meaningful error messages when errors occur during the 2FA process. You can skip the 2FA middleware for certain routes by specifying the paths in the SkipCookies field of the twofa.Config struct. Additionally, you can provide a custom function in the Next field of the twofa.Config struct to determine whether to skip the 2FA middleware for a given request. If the function returns true, the middleware will be skipped. The 2FA middleware uses the twofa.Info struct to manage the 2FA information for each user. The twofa.Info struct implements the twofa.InfoManager interface, which defines methods for accessing and modifying the 2FA information. The twofa.Info struct contains the following fields: The twofa.InfoManager interface provides methods for accessing and modifying these fields. The 2FA middleware uses cookies to store the 2FA validation status for each user. The cookie-related configurations can be customized using the following fields in the twofa.Config struct: The middleware generates a signed cookie value using HMAC to ensure the integrity of the cookie. The cookie value contains the expiration time of the cookie. The 2FA middleware verifies the TOTP token provided by the user during the 2FA process. The token can be extracted from various sources such as query parameters, form data, cookies, headers, or URL parameters. The token lookup configuration is specified using the TokenLookup field in the twofa.Config struct. It follows the format "<source>:<name>", where <source> can be "query", "form", "cookie", "header", or "param", and <name> is the name of the parameter or key. If a valid token is provided, the middleware sets a 2FA cookie to indicate that the user has successfully completed the 2FA process. The cookie value is generated using the twofa.Middleware.GenerateCookieValue function, which signs the cookie value using HMAC. The 2FA middleware generates a unique identifier for each 2FA registration. The identifier is used to associate the 2FA information with a specific user or account. By default, the middleware uses the github.com/gofiber/utils.UUIDv4 function to generate a random UUID as the identifier. The identifier generation can be customized by providing a custom function in the IdentifierGenerator field of the twofa.Config struct. The custom function should take a *fiber.Ctx as a parameter and return a string identifier. The generated identifier is stored in the twofa.Info struct and can be accessed using the twofa.Info.GetIdentifier method. In the example above, the customIdentifierGenerator function is provided as the value for the IdentifierGenerator field in the twofa.Config struct. This function will be called by the middleware to generate the identifier for each 2FA registration. The custom identifier generator function can access the request context through the *fiber.Ctx parameter and generate the identifier based on any relevant information available in the context, such as user ID, email, or any other unique attribute. Providing a custom identifier generator allows for the flexibility to generate identifiers that are specific to the application's requirements and ensures uniqueness and compatibility with the existing user or account management system. Note: If the IdentifierGenerator field is not provided or set to nil, the middleware will use the default identifier generator, which generates a random UUID using github.com/gofiber/utils.UUIDv4.
Package for creating QR codes for payments. Short Payment Descriptor format and EPC QR Code (SEPA) format is supported. - Generating QR code image for Short Payment Descriptor format - Generating QR code image for EPC QR Code QR code image encoding uses https://github.com/skip2/go-qrcode - Getting QR code content for Short Payment Descriptor format
The package twofactor implements the RFC 6238 TOTP: Time-Based One-Time Password Algorithm The library provides a simple and secure way to generate and verify the OTP tokens and provides the possibility to display QR codes out of the box The library supports HMAC-SHA1, HMAC-SHA256, HMAC-SHA512
The package twofactor implements the RFC 6238 TOTP: Time-Based One-Time Password Algorithm The library provides a simple and secure way to generate and verify the OTP tokens and provides the possibility to display QR codes out of the box The library supports HMAC-SHA1, HMAC-SHA256, HMAC-SHA512
Package otp implements both HOTP and TOTP based one time passcodes in a Google Authenticator compatible manner. When adding a TOTP for a user, you must store the "secret" value persistently. It is recommend to store the secret in an encrypted field in your datastore. Due to how TOTP works, it is not possible to store a hash for the secret value like you would a password. To enroll a user, you must first generate an OTP for them. Google Authenticator supports using a QR code as an enrollment method: Validating a TOTP passcode is very easy, just prompt the user for a passcode and retrieve the associated user's previously stored secret.
The package twofactor implements the RFC 6238 TOTP: Time-Based One-Time Password Algorithm The library provides a simple and secure way to generate and verify the OTP tokens and provides the possibility to display QR codes out of the box The library supports HMAC-SHA1, HMAC-SHA256, HMAC-SHA512
The package twofactor implements the RFC 6238 TOTP: Time-Based One-Time Password Algorithm The library provides a simple and secure way to generate and verify the OTP tokens and provides the possibility to display QR codes out of the box The library supports HMAC-SHA1, HMAC-SHA256, HMAC-SHA512
Package twofactor implements the RFC 6238 TOTP: Time-Based One-Time Password Algorithm The library provides a simple and secure way to generate and verify the OTP tokens and provides the possibility to display QR codes out of the box The library supports HMAC-SHA1, HMAC-SHA256, HMAC-SHA512
Package qrcode implements a QR Code encoder. A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded. A QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: qrcode.{Low, Medium, High, Highest}. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger. Three functions cover most use cases: - Create a PNG image: - Create a PNG image and write to a file: - Create a PNG image with custom colors and write to file: All examples use the qrcode.Medium error Recovery Level and create a fixed 256x256px size QR Code. The last function creates a white on black instead of black on white QR Code. To generate a variable sized image instead, specify a negative size (in place of the 256 above), such as -4 or -5. Larger negative numbers create larger images: A size of -5 sets each module (QR Code "pixel") to be 5px wide/high. - Create a PNG image (variable size, with minimum white padding) and write to a file: The maximum capacity of a QR Code varies according to the content encoded and the error recovery level. The maximum capacity is 2,953 bytes, 4,296 alphanumeric characters, 7,089 numeric digits, or a combination of these. This package implements a subset of QR Code 2005, as defined in ISO/IEC 18004:2006.
The package twofactor implements the RFC 6238 TOTP: Time-Based One-Time Password Algorithm The library provides a simple and secure way to generate and verify the OTP tokens and provides the possibility to display QR codes out of the box The library supports HMAC-SHA1, HMAC-SHA256, HMAC-SHA512
Package qrcode implements a QR Code encoder. A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded. A QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: qrcode.{Low, Medium, High, Highest}. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger. Three functions cover most use cases: - Create a PNG image: - Create a PNG image and write to a file: - Create a PNG image with custom colors and write to file: All examples use the qrcode.Medium error Recovery Level and create a fixed 256x256px size QR Code. The last function creates a white on black instead of black on white QR Code. To generate a variable sized image instead, specify a negative size (in place of the 256 above), such as -4 or -5. Larger negative numbers create larger images: A size of -5 sets each module (QR Code "pixel") to be 5px wide/high. - Create a PNG image (variable size, with minimum white padding) and write to a file: The maximum capacity of a QR Code varies according to the content encoded and the error recovery level. The maximum capacity is 2,953 bytes, 4,296 alphanumeric characters, 7,089 numeric digits, or a combination of these. This package implements a subset of QR Code 2005, as defined in ISO/IEC 18004:2006.
Package qrcode implements a QR Code encoder. A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded. A QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: qrcode.{Low, Medium, High, Highest}. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger. - Create a PNG image: The example above uses the qrcode.Medium error Recovery Level and create a fixed 256x256px size QR Code. The last function creates a white on black instead of black on white QR Code. To generate a variable sized image instead, specify a negative size (in place of the 256 above), such as -4 or -5. Larger negative numbers create larger images: A size of -5 sets each module (QR Code "pixel") to be 5px wide/high. The maximum capacity of a QR Code varies according to the content encoded and the error recovery level. The maximum capacity is 2,953 bytes, 4,296 alphanumeric characters, 7,089 numeric digits, or a combination of these. This package implements a subset of QR Code 2005, as defined in ISO/IEC 18004:2006.
Package otp implements both HOTP and TOTP based one time passcodes in a Google Authenticator compatible manner. When adding a TOTP for a user, you must store the "secret" value persistently. It is recommend to store the secret in an encrypted field in your datastore. Due to how TOTP works, it is not possible to store a hash for the secret value like you would a password. To enroll a user, you must first generate an OTP for them. Google Authenticator supports using a QR code as an enrollment method: Validating a TOTP passcode is very easy, just prompt the user for a passcode and retrieve the associated user's previously stored secret.
Package otp implements both HOTP and TOTP based one time passcodes in a Google Authenticator compatible manner. When adding a TOTP for a user, you must store the "secret" value persistently. It is recommend to store the secret in an encrypted field in your datastore. Due to how TOTP works, it is not possible to store a hash for the secret value like you would a password. To enroll a user, you must first generate an OTP for them. Google Authenticator supports using a QR code as an enrollment method: Validating a TOTP passcode is very easy, just prompt the user for a passcode and retrieve the associated user's previously stored secret.
Package otp implements both HOTP and TOTP based one time passcodes in a Google Authenticator compatible manner. When adding a TOTP for a user, you must store the "secret" value persistently. It is recommend to store the secret in an encrypted field in your datastore. Due to how TOTP works, it is not possible to store a hash for the secret value like you would a password. To enroll a user, you must first generate an OTP for them. Google Authenticator supports using a QR code as an enrollment method: Validating a TOTP passcode is very easy, just prompt the user for a passcode and retrieve the associated user's previously stored secret.
Package otp implements both HOTP and TOTP based one time passcodes in a Google Authenticator compatible manner. When adding a TOTP for a user, you must store the "secret" value persistently. It is recommend to store the secret in an encrypted field in your datastore. Due to how TOTP works, it is not possible to store a hash for the secret value like you would a password. To enroll a user, you must first generate an OTP for them. Google Authenticator supports using a QR code as an enrollment method: Validating a TOTP passcode is very easy, just prompt the user for a passcode and retrieve the associated user's previously stored secret.
Package gs1qr encodes GS1 QR codes. The GS1 specification is at https://www.gs1.org/docs/barcodes/GS1_General_Specifications.pdf. See also https://2016archive.gs1us.org/gs1-us-library/command/core_download/entryid/768/method/attachment QR code generation is based on Russ Cox' qr package: https://github.com/rsc/qr
The package twofactor implements the RFC 6238 TOTP: Time-Based One-Time Password Algorithm The library provides a simple and secure way to generate and verify the OTP tokens and provides the possibility to display QR codes out of the box The library supports HMAC-SHA1, HMAC-SHA256, HMAC-SHA512
Package otp implements both HOTP and TOTP based one time passcodes in a Google Authenticator compatible manner. When adding a TOTP for a user, you must store the "secret" value persistently. It is recommend to store the secret in an encrypted field in your datastore. Due to how TOTP works, it is not possible to store a hash for the secret value like you would a password. To enroll a user, you must first generate an OTP for them. Google Authenticator supports using a QR code as an enrollment method: Validating a TOTP passcode is very easy, just prompt the user for a passcode and retrieve the associated user's previously stored secret.
Package qrcode implements a QR Code encoder. A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded. A QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: qrcode.{Low, Medium, High, Highest}. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger. Three functions cover most use cases: - Create a PNG image: - Create a PNG image and write to a file: - Create a PNG image with custom colors and write to file: All examples use the qrcode.Medium error Recovery Level and create a fixed 256x256px size QR Code. The last function creates a white on black instead of black on white QR Code. To generate a variable sized image instead, specify a negative size (in place of the 256 above), such as -4 or -5. Larger negative numbers create larger images: A size of -5 sets each module (QR Code "pixel") to be 5px wide/high. - Create a PNG image (variable size, with minimum white padding) and write to a file: The maximum capacity of a QR Code varies according to the content encoded and the error recovery level. The maximum capacity is 2,953 bytes, 4,296 alphanumeric characters, 7,089 numeric digits, or a combination of these. This package implements a subset of QR Code 2005, as defined in ISO/IEC 18004:2006.
Package qrcode implements a QR Code encoder. A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded. A QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: qrcode.{Low, Medium, High, Highest}. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger. Three functions cover most use cases: - Create a PNG image: - Create a PNG image and write to a file: - Create a PNG image with custom colors and write to file: All examples use the qrcode.Medium error Recovery Level and create a fixed 256x256px size QR Code. The last function creates a white on black instead of black on white QR Code. To generate a variable sized image instead, specify a negative size (in place of the 256 above), such as -4 or -5. Larger negative numbers create larger images: A size of -5 sets each module (QR Code "pixel") to be 5px wide/high. - Create a PNG image (variable size, with minimum white padding) and write to a file: The maximum capacity of a QR Code varies according to the content encoded and the error recovery level. The maximum capacity is 2,953 bytes, 4,296 alphanumeric characters, 7,089 numeric digits, or a combination of these. This package implements a subset of QR Code 2005, as defined in ISO/IEC 18004:2006.
The package twofactor implements the RFC 6238 TOTP: Time-Based One-Time Password Algorithm The library provides a simple and secure way to generate and verify the OTP tokens and provides the possibility to display QR codes out of the box The library supports HMAC-SHA1, HMAC-SHA256, HMAC-SHA512
Package qrcode implements a QR Code encoder. A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded. A QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: qrcode.{Low, Medium, High, Highest}. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger. Three functions cover most use cases: - Create a PNG image: - Create a PNG image and write to a file: - Create a PNG image with custom colors and write to file: All examples use the qrcode.Medium error Recovery Level and create a fixed 256x256px size QR Code. The last function creates a white on black instead of black on white QR Code. To generate a variable sized image instead, specify a negative size (in place of the 256 above), such as -4 or -5. Larger negative numbers create larger images: A size of -5 sets each module (QR Code "pixel") to be 5px wide/high. - Create a PNG image (variable size, with minimum white padding) and write to a file: The maximum capacity of a QR Code varies according to the content encoded and the error recovery level. The maximum capacity is 2,953 bytes, 4,296 alphanumeric characters, 7,089 numeric digits, or a combination of these. This package implements a subset of QR Code 2005, as defined in ISO/IEC 18004:2006.
Package otp implements both HOTP and TOTP based one time passcodes in a Google Authenticator compatible manner. When adding a TOTP for a user, you must store the "secret" value persistently. It is recommend to store the secret in an encrypted field in your datastore. Due to how TOTP works, it is not possible to store a hash for the secret value like you would a password. To enroll a user, you must first generate an OTP for them. Google Authenticator supports using a QR code as an enrollment method: Validating a TOTP passcode is very easy, just prompt the user for a passcode and retrieve the associated user's previously stored secret.
Package qrcode implements a QR Code encoder. A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded. A QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: qrcode.{Low, Medium, High, Highest}. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger. Three functions cover most use cases: - Create a PNG image: - Create a PNG image and write to a file: - Create a PNG image with custom colors and write to file: All examples use the qrcode.Medium error Recovery Level and create a fixed 256x256px size QR Code. The last function creates a white on black instead of black on white QR Code. To generate a variable sized image instead, specify a negative size (in place of the 256 above), such as -4 or -5. Larger negative numbers create larger images: A size of -5 sets each module (QR Code "pixel") to be 5px wide/high. - Create a PNG image (variable size, with minimum white padding) and write to a file: The maximum capacity of a QR Code varies according to the content encoded and the error recovery level. The maximum capacity is 2,953 bytes, 4,296 alphanumeric characters, 7,089 numeric digits, or a combination of these. This package implements a subset of QR Code 2005, as defined in ISO/IEC 18004:2006.
Package qrcode implements a QR Code encoder. A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded. A QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: qrcode.{Low, Medium, High, Highest}. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger. Three functions cover most use cases: - Create a PNG image: - Create a PNG image and write to a file: - Create a PNG image with custom colors and write to file: All examples use the qrcode.Medium error Recovery Level and create a fixed 256x256px size QR Code. The last function creates a white on black instead of black on white QR Code. To generate a variable sized image instead, specify a negative size (in place of the 256 above), such as -4 or -5. Larger negative numbers create larger images: A size of -5 sets each module (QR Code "pixel") to be 5px wide/high. - Create a PNG image (variable size, with minimum white padding) and write to a file: The maximum capacity of a QR Code varies according to the content encoded and the error recovery level. The maximum capacity is 2,953 bytes, 4,296 alphanumeric characters, 7,089 numeric digits, or a combination of these. This package implements a subset of QR Code 2005, as defined in ISO/IEC 18004:2006.