Interface QRGenerator
- All Known Implementing Classes:
AbstractQRGenerator
,ZxingQRGenerator
public interface QRGenerator
Interface for generating a QR code.
Section 4.1 of the BankID Relying Party Guidelines describes how to generate a static QR code based on an auto start token and how to present it for the user, and section 4.2 describes how to generate an "animated" code.
- Author:
- Martin Lindström
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Enum representing an image format. -
Method Summary
Modifier and TypeMethodDescriptiongenerateAnimatedQRCodeBase64Image
(String qrStartToken, String qrStartSecret, Instant orderTime) Generates an "animated" QR code image as a Base64 encoded image using default settings for size and the image format.generateAnimatedQRCodeBase64Image
(String qrStartToken, String qrStartSecret, Instant orderTime, int size, QRGenerator.ImageFormat format) Generates an "animated" QR code image as a Base64 encoded image.byte[]
generateAnimatedQRCodeImage
(String qrStartToken, String qrStartSecret, Instant orderTime) Generates an "animated" QR code image using default settings for size and the image format.byte[]
generateAnimatedQRCodeImage
(String qrStartToken, String qrStartSecret, Instant orderTime, int size, QRGenerator.ImageFormat format) Generates an "animated" QR code image.generateQRCodeBase64Image
(String autoStartToken) Generates a (static) QR code image as a Base64 encoded image using default settings for size and the image format.generateQRCodeBase64Image
(String autoStartToken, int size, QRGenerator.ImageFormat format) Generates a (static) QR code image as a Base64 encoded image.byte[]
generateQRCodeImage
(String autoStartToken) Generates a (static) QR code image using default settings for size and the image format.byte[]
generateQRCodeImage
(String autoStartToken, int size, QRGenerator.ImageFormat format) Generates a (static) QR code image.
-
Method Details
-
generateQRCodeImage
byte[] generateQRCodeImage(String autoStartToken, int size, QRGenerator.ImageFormat format) throws IOException Generates a (static) QR code image.The auto start token will be used to build an URI according to section 4.1 of the BankID Relying Party Guidelines.
- Parameters:
autoStartToken
- the BankID autostart tokensize
- the width and height of the generated QR code (in pixels)format
- the format for the generated QR code- Returns:
- an byte array representing the generated QR code
- Throws:
IOException
- for errors during generation- See Also:
-
generateQRCodeImage
Generates a (static) QR code image using default settings for size and the image format.- Parameters:
autoStartToken
- the BankID autostart token- Returns:
- an byte array representing the generated QR code
- Throws:
IOException
- for errors during generation- See Also:
-
generateAnimatedQRCodeImage
byte[] generateAnimatedQRCodeImage(String qrStartToken, String qrStartSecret, Instant orderTime, int size, QRGenerator.ImageFormat format) throws IOException Generates an "animated" QR code image.The QR-code will be build according to section 4.2 of the BankID Relying Party Guidelines.
- Parameters:
qrStartToken
- the QR start token (seeOrderResponse.getQrStartToken()
)qrStartSecret
- the QR start secret (seeOrderResponse.getQrStartSecret()
)orderTime
- the instant when the result from anBankIDClient.authenticate(AuthenticateRequest)
orBankIDClient.sign(SignatureRequest)
call was receivedsize
- the width and height of the generated QR code (in pixels)format
- the format for the generated QR code- Returns:
- an byte array representing the generated QR code
- Throws:
IOException
- for errors during generation- See Also:
-
generateAnimatedQRCodeImage
byte[] generateAnimatedQRCodeImage(String qrStartToken, String qrStartSecret, Instant orderTime) throws IOException Generates an "animated" QR code image using default settings for size and the image format.- Parameters:
qrStartToken
- the QR start token (seeOrderResponse.getQrStartToken()
)qrStartSecret
- the QR start secret (seeOrderResponse.getQrStartSecret()
)orderTime
- the instant when the result from anBankIDClient.authenticate(AuthenticateRequest)
or aBankIDClient.sign(SignatureRequest)
call was received- Returns:
- an byte array representing the generated QR code
- Throws:
IOException
- for errors during generation- See Also:
-
generateQRCodeBase64Image
String generateQRCodeBase64Image(String autoStartToken, int size, QRGenerator.ImageFormat format) throws IOException Generates a (static) QR code image as a Base64 encoded image.For example:
data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==
The image may then be directly inserted in HTML code as:
<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==" scale="0">
- Parameters:
autoStartToken
- the BankID autostart tokensize
- the width and height of the generated QR code (in pixels)format
- the format for the generated QR code- Returns:
- the base64 encoded image
- Throws:
IOException
- for errors during generation- See Also:
-
generateQRCodeBase64Image
Generates a (static) QR code image as a Base64 encoded image using default settings for size and the image format.- Parameters:
autoStartToken
- the BankID autostart token- Returns:
- the base64 encoded image
- Throws:
IOException
- for errors during generation- See Also:
-
generateAnimatedQRCodeBase64Image
String generateAnimatedQRCodeBase64Image(String qrStartToken, String qrStartSecret, Instant orderTime, int size, QRGenerator.ImageFormat format) throws IOException Generates an "animated" QR code image as a Base64 encoded image.For example:
data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==
The image may then be directly inserted in HTML code as:
<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==" scale="0">
- Parameters:
qrStartToken
- the QR start token (seeOrderResponse.getQrStartToken()
)qrStartSecret
- the QR start secret (seeOrderResponse.getQrStartSecret()
)orderTime
- the instant when the result from anBankIDClient.authenticate(AuthenticateRequest)
or aBankIDClient.sign(SignatureRequest)
call was receivedsize
- the width and height of the generated QR code (in pixels)format
- the format for the generated QR code- Returns:
- the base64 encoded image
- Throws:
IOException
- for errors during generation- See Also:
-
generateAnimatedQRCodeBase64Image
String generateAnimatedQRCodeBase64Image(String qrStartToken, String qrStartSecret, Instant orderTime) Generates an "animated" QR code image as a Base64 encoded image using default settings for size and the image format.- Parameters:
qrStartToken
- the QR start token (seeOrderResponse.getQrStartToken()
)qrStartSecret
- the QR start secret (seeOrderResponse.getQrStartSecret()
)orderTime
- the instant when the order was received- Returns:
- the base64 encoded image
- See Also:
-