filestack/FilestackSecurity.php
private function generate($secret, $options = [])
    {
        if (!$secret) {
            throw new FilestackException("Secret can not be empty", 400);
        }

        // check that options passed in are valid (on allowed list)
        $this->validateOptions($options);

        // set encoded values to policy and signature
        $policy = json_encode($options);
        $policy = $this->urlsafeB64encode($policy);
        $signature = $this->createSignature($policy, $secret);

        return ['policy' => $policy, 'signature' => $signature];
    }
private function generate($secret, $options = [])
    {
        if (!$secret) {
            throw new FilestackException("Secret can not be empty", 400);
        }

        // check that options passed in are valid (on allowed list)
        $this->validateOptions($options);

        // set encoded values to policy and signature
        $policy = json_encode($options);
        $policy = $this->urlsafeB64encode($policy);
        $signature = $this->createSignature($policy, $secret);

        return ['policy' => $policy, 'signature' => $signature];
    }
private function generate ( $ secret , $ options = [ ] ) { if ( ! $ secret ) { throw new FilestackException ( "Secret can not be empty" , 400 ) ; } // check that options passed in are valid (on allowed list) $ this -> validateOptions ( $ options ) ; // set encoded values to policy and signature $ policy = json_encode ( $ options ) ; $ policy = $ this -> urlsafeB64encode ( $ policy ) ; $ signature = $ this -> createSignature ( $ policy , $ secret ) ; return [ 'policy' => $ policy , 'signature' => $ signature ] ; }
generate a security policy and signature

@param string    $secret     random hash secret
@param array     $options    array of policy options

@throws FilestackException   e.g. policy option not allowed

@return array ['policy'=>'encrypted_value', 'signature'=>'encrypted_value']
generate a security policy and signature