drm v0.1.0 Drm View Source

Documentation for Drm. license functions for creating, storing and exporting aes encrypted keys.

Link to this section Summary

Functions

Create a new license

Decode a license

Delete a license

Encode a license

Export the license file

Validate a license

Link to this section Functions

Create a new license

Parameters

  • meta: a map of meta data to enclude in the license
  • policy: a map of the main policy for the license

    Parameters

    • name : the name of the policy
    • type: the type of policy "free | commercial"
    • expiration: the license experation date this is a Datetime.t -> int ie. DateTime.utc_now() |> to_unix
    • validation_type: the validation type "strict | floating | concurrent"
    • checkin: when to checkin "true | false"
    • checkin_interval: when to checkin "nil | daily | weekly | monthly"
    • max_fingerprints: the number of max fingerprints for this license
    • fingerprint: the fingerprint for this license

    Validation Types

    • strict: a license that implements the policy will be considered invalid if its machine limit is surpassed
    • floating: a license that implements the policy will be valid across multiple machines
    • concurrent: a licensing model, where you allow a set number of machines to be activated at one time, and exceeding that limit may invalidate all current sessions.

    Types

    • free: a free license
    • commercial: a free license

Examples

iex> license =  %{meta: %{email: "demo@example.com", name: "licensee name"}, policy: %{name: "policy name", type: "free", expiration: nil, validation_type: "strict", checkin: false, checkin_interval: nil, max_fingerprints: nil, fingerprint: "main-app-name-umbrella-app-hash-id"}}
iex> License.create(license)
"B75FE9CCF260E7E7BAC9606174E525D28EE52E07907F53D8B7E4E30C32FEC6C67CBA0C7F7FEC36AE4152F296FC08E4EEE892A70A71E549F5A2296BC96C6365CD9666B9C4712C8BB3BCAEE8A6B5DA3CC716D91970F8C9EE14712660B2D004A7FB5BE77C0BDDF1827E2EF73345E0F223986FBF8D0DBFBDF7A43FC836C82229D3FC6E7E8316C2E8B9AA0A2A9F73C1D52ACB479DAD6433A9137FC7D3409C5E81ED04A6F3C0289B9E44DA46DB63B633BBF0BAC73529E181AE2F93D3E78208801D8EB1D54C00E3E5C50BD9B84CFA2E51784F20E36761FE95381FD5AC667F2F39A46CDE78F404403748905665A088A17B7D2FBE348767313A24EA3E954A76CA68F98C5D2817E9DE1C7D6ED78E7577E03EB31562295ACA1CB26983B51758D35246E72A316E844A71531852E380D8"

Decode a license

Examples

 iex> license_string = "DDF63C83E7A274EC1D02F4DB896D07A57A4B7B1F096CD1E545A99C5E702FA37B9372D12A3866312462E93C96C645B033A93A0FF28DFDC4F1F2A609A833EABAED3C98242AD139BA41C477E3FBB7A186584BE9B4D48A88F3E6EB80E0A5B1A075C290FCB29EADD7FA81EF9D91AC0DECB79AA23F71ADA1E18D397B8A7D70749D014EC8D4E12E6A738508CA6F3852573EDDFEA78E601E6B99DAD6ECC55700DDDACFAF051C06BA0DADE97E9CB4CA0B6E6048C2C00354C5FBC2BC9FB82EFC32D26B829405C1452F2132D8185B58CD3567B908A7A99664757E9FC66F03E8EF1C3A2459042C2B658BD37AFD985114FF9804F431FE4436418511B6E19DB83030C083AAB5624C5ED8F482824BFB650388083DD2867668288247B1687F8F5494719DA9D2016860ACF92F0EADEC32EFC"
 iex> License.decode(license_string)
 %{
 "meta" => %{"email" => "demo@example.com", "name" => "licensee name"},
"policy" => %{
 "checkin" => false,
 "checkin_interval" => nil,
  "expiration" => nil,
  "fingerprint" => "main-app-name-umbrella-app-hash-id",
 "max_fingerprints" => nil,
 "name" => "policy name",
 "type" => "free",
  "validation_type" => "strict"
    }
 }

Delete a license

Examples

   iex> License.delete("3454453444")
   :error

Encode a license

Parameters

  • meta: a map of meta data to enclude in the license
  • policy: a map of the main policy for the license

    Parameters

    • name : the name of the policy
    • type: the type of policy "free | commercial"
    • expiration: the license experation date this is a Datetime.t -> int ie. DateTime.utc_now() |> to_unix
    • validation_type: the validation type "strict | floating | concurrent"
    • checkin: when to checkin "true | false"
    • checkin_interval: when to checkin "nil | daily | weekly | monthly"
    • max_fingerprints: the number of max fingerprints for this license
    • fingerprint: the fingerprint for this license

    Validation Types

    • strict: a license that implements the policy will be considered invalid if its machine limit is surpassed
    • floating: a license that implements the policy will be valid across multiple machines
    • concurrent: a licensing model, where you allow a set number of machines to be activated at one time, and exceeding that limit may invalidate all current sessions.

    Types

    • free: a free license
    • commercial: a free license

Examples

iex> license =  %{meta: %{email: "demo@example.com", name: "licensee name"}, policy: %{name: "policy name", type: "free", expiration: nil, validation_type: "strict", checkin: false, checkin_interval: nil, max_fingerprints: nil, fingerprint: "main-app-name-umbrella-app-hash-id"}}
iex> License.encode(license)
"7DDF63C83E7A274EC1D02F4DB896D07A57A4B7B1F096CD1E545A99C5E702FA37B9372D12A3866312462E93C96C645B033A93A0FF28DFDC4F1F2A609A833EABAED3C98242AD139BA41C477E3FBB7A186584BE9B4D48A88F3E6EB80E0A5B1A075C290FCB29EADD7FA81EF9D91AC0DECB79AA23F71ADA1E18D397B8A7D70749D014EC8D4E12E6A738508CA6F3852573EDDFEA78E601E6B99DAD6ECC55700DDDACFAF051C06BA0DADE97E9CB4CA0B6E6048C2C00354C5FBC2BC9FB82EFC32D26B829405C1452F2132D8185B58CD3567B908A7A99664757E9FC66F03E8EF1C3A2459042C2B658BD37AFD985114FF9804F431FE4436418511B6E19DB83030C083AAB5624C5ED8F482824BFB650388083DD2867668288247B1687F8F5494719DA9D2016860ACF92F0EADEC32EFC"
Link to this function

export(id, type \\ "list") View Source

Export the license file

Examples

 iex> fingerprint = "umbrella-app-id"
 iex> License.export(fingerprint)
 :error
Link to this function

generate_key(hash, number, delimeter \\ "-") View Source

Link to this function

valid?(license_string) View Source
valid?(String.t()) :: any()

Validate a license

Examples

 iex> license_string = "3454453444"
 iex> License.valid?(license_string)
 false
Link to this function

valid?(license_string, fingerprint_in_question) View Source
valid?(String.t(), String.t()) :: any()

Validate a license

Examples

iex> license_string = "3454453444"
iex> fingerprint = "umbrella-app-id"
iex> License.valid?(license_string, fingerprint)
false