Méthode | Description | |
---|---|---|
GenerateNonce ( ) : long |
Generates a nonce (a random number used once).
|
|
IsNonceKnown ( long nonce ) : bool | ||
RemoveNonce ( long nonce ) : void | ||
Verify ( IPublicKey publicKey, string signedData, string signature ) : bool |
Verifies that the signature from the server matches the computed signature on the data. Returns true if the data is correctly signed.
|
|
VerifyPurchase ( string signedData, string signature ) : List |
Verifies that the data was signed with the given signature, and returns the list of verified purchases. The data is in JSON format and contains a nonce (number used once) that we generated and that was signed (as part of the whole data string) with a private key. The data also contains the PurchaseState and product ID of the purchase. In the general case, there can be an array of purchase transactions because there may be delays in processing the purchase on the backend and then several purchases can be batched together.
|
Méthode | Description | |
---|---|---|
GeneratePublicKey ( string encodedPublicKey ) : IPublicKey |
Generates a PublicKey instance from a string containing the Base64-encoded public key.
|
public static IsNonceKnown ( long nonce ) : bool | ||
nonce | long | |
Résultat | bool |
public static RemoveNonce ( long nonce ) : void | ||
nonce | long | |
Résultat | void |
public static Verify ( IPublicKey publicKey, string signedData, string signature ) : bool | ||
publicKey | IPublicKey | public key associated with the developer account |
signedData | string | signed data from server |
signature | string | server signature |
Résultat | bool |
public static VerifyPurchase ( string signedData, string signature ) : List |
||
signedData | string | the signed JSON string (signed, not encrypted) |
signature | string | the signature for the data, signed with the private key |
Résultat | List |